MCPcopy
hub / github.com/redis/go-redis / StreamingCredentialsProvider

Interface StreamingCredentialsProvider

auth/auth.go:8–26  ·  auth/auth.go::StreamingCredentialsProvider

StreamingCredentialsProvider is an interface that defines the methods for a streaming credentials provider. It is used to provide credentials for authentication. The CredentialsListener is used to receive updates when the credentials change.

Source from the content-addressed store, hash-verified

6// It is used to provide credentials for authentication.
7// The CredentialsListener is used to receive updates when the credentials change.
8type StreamingCredentialsProvider interface {
9 // Subscribe subscribes to the credentials provider for updates.
10 // It returns the current credentials, a cancel function to unsubscribe from the provider,
11 // and an error if any.
12 //
13 // Implementations MUST be idempotent with respect to listener identity:
14 // subscribing the same listener value more than once must not produce
15 // duplicate notifications and must not create multiple independent
16 // subscriptions that each need to be cancelled separately. Every
17 // UnsubscribeFunc returned for a given listener must cancel that
18 // listener's subscription; calling any one of them must be sufficient to
19 // stop updates to that listener, and calling subsequent ones must be a
20 // safe no-op. Callers (including go-redis internals) may retain only
21 // the most recently returned UnsubscribeFunc and rely on it to fully
22 // unsubscribe the listener.
23 //
24 // TODO(ndyakov): Should we add context to the Subscribe method?
25 Subscribe(listener CredentialsListener) (Credentials, UnsubscribeFunc, error)
26}
27
28// UnsubscribeFunc is a function that is used to cancel the subscription to the credentials provider.
29// It is used to unsubscribe from the provider when the credentials are no longer needed.

Callers

nothing calls this directly

Implementers 8

ClusterClientosscluster.go
Clientredis.go
Ringring.go
PubSubpubsub.go
entraidLikeProviderinternal_test.go
SentinelClientsentinel.go
mockStreamingProviderauth/auth_test.go

Calls

no outgoing calls

Tested by

no test coverage detected