Package io.lettuce.core
Class StaticCredentialsProvider
- java.lang.Object
-
- io.lettuce.core.StaticCredentialsProvider
-
- All Implemented Interfaces:
RedisCredentialsProvider
,RedisCredentialsProvider.ImmediateRedisCredentialsProvider
public class StaticCredentialsProvider extends Object implements RedisCredentialsProvider, RedisCredentialsProvider.ImmediateRedisCredentialsProvider
Static implementation ofRedisCredentialsProvider
.- Since:
- 6.2
- Author:
- Mark Paluch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.lettuce.core.RedisCredentialsProvider
RedisCredentialsProvider.ImmediateRedisCredentialsProvider
-
-
Constructor Summary
Constructors Constructor Description StaticCredentialsProvider(RedisCredentials credentials)
Create a staticStaticCredentialsProvider
object fromRedisCredentials
.StaticCredentialsProvider(String username, char[] password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<RedisCredentials>
resolveCredentials()
ReturnsRedisCredentials
that can be used to authorize a Redis connection.RedisCredentials
resolveCredentialsNow()
ReturnsRedisCredentials
that can be used to authorize a Redis connection.
-
-
-
Constructor Detail
-
StaticCredentialsProvider
public StaticCredentialsProvider(String username, char[] password)
- Parameters:
username
- can benull
.password
- can benull
.
-
StaticCredentialsProvider
public StaticCredentialsProvider(RedisCredentials credentials)
Create a staticStaticCredentialsProvider
object fromRedisCredentials
. The snapshot of the given credentials is used to create a static representation to avoid credentials changes if theRedisCredentials
change over time.- Parameters:
credentials
- must not benull
.
-
-
Method Detail
-
resolveCredentials
public Mono<RedisCredentials> resolveCredentials()
Description copied from interface:RedisCredentialsProvider
ReturnsRedisCredentials
that can be used to authorize a Redis connection. Each implementation ofRedisCredentialsProvider
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.- Specified by:
resolveCredentials
in interfaceRedisCredentialsProvider
- Specified by:
resolveCredentials
in interfaceRedisCredentialsProvider.ImmediateRedisCredentialsProvider
- Returns:
- a
Mono
emittingRedisCredentials
that can be used to authorize a Redis connection.
-
resolveCredentialsNow
public RedisCredentials resolveCredentialsNow()
Description copied from interface:RedisCredentialsProvider.ImmediateRedisCredentialsProvider
ReturnsRedisCredentials
that can be used to authorize a Redis connection. Each implementation ofRedisCredentialsProvider
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.- Specified by:
resolveCredentialsNow
in interfaceRedisCredentialsProvider.ImmediateRedisCredentialsProvider
- Returns:
- the resolved
RedisCredentials
that can be used to authorize a Redis connection.
-
-