@FunctionalInterface public interface RedisCredentialsProvider
RedisCredentials
that are used for authentication. A commonly-used implementation is
StaticCredentialsProvider
for a fixed set of credentials.
Credentials are requested by the driver after connecting to the server. Therefore, credential retrieval is subject to complete within the connection creation timeout to avoid connection failures.
Modifier and Type | Interface and Description |
---|---|
static interface |
RedisCredentialsProvider.ImmediateRedisCredentialsProvider
Extension to
RedisCredentialsProvider that resolves credentials immediately without the need to defer the
credential resolution. |
Modifier and Type | Method and Description |
---|---|
default Flux<RedisCredentials> |
credentials()
Returns a
Flux emitting RedisCredentials that can be used to authorize a Redis connection. |
static RedisCredentialsProvider |
from(Supplier<RedisCredentials> supplier)
Creates a new
RedisCredentialsProvider from a given Supplier . |
Mono<RedisCredentials> |
resolveCredentials()
Returns
RedisCredentials that can be used to authorize a Redis connection. |
default boolean |
supportsStreaming()
Some implementations of the
RedisCredentialsProvider may support streaming new credentials, based on some event
that originates outside the driver. |
Mono<RedisCredentials> resolveCredentials()
RedisCredentials
that can be used to authorize a Redis connection. Each implementation of
RedisCredentialsProvider
can choose its own strategy for loading credentials. For example, an implementation
might load credentials from an existing key management system, or load new credentials when credentials are rotated. If
an error occurs during the loading of credentials or credentials could not be found, a runtime exception will be raised.Mono
emitting RedisCredentials
that can be used to authorize a Redis connection.static RedisCredentialsProvider from(Supplier<RedisCredentials> supplier)
RedisCredentialsProvider
from a given Supplier
.supplier
- must not be null
.RedisCredentials
using credentials from Supplier
.default boolean supportsStreaming()
RedisCredentialsProvider
may support streaming new credentials, based on some event
that originates outside the driver. In this case they should indicate that so the RedisAuthenticationHandler
is
able to process these new credentials.RedisCredentialsProvider
supports streaming credentials.default Flux<RedisCredentials> credentials()
Flux
emitting RedisCredentials
that can be used to authorize a Redis connection.
For implementations that support streaming credentials (as indicated by supportsStreaming()
returning
true
), this method can emit multiple credentials over time, typically based on external events like token renewal
or rotation.
For implementations that do not support streaming credentials (where supportsStreaming()
returns false
),
this method throws an UnsupportedOperationException
by default.Flux
emitting RedisCredentials
, or throws an exception if streaming is not supported.UnsupportedOperationException
- if the provider does not support streaming credentials.Copyright © 2025 lettuce.io. All rights reserved.