Skip to content

Commit

Permalink
formating
Browse files Browse the repository at this point in the history
  • Loading branch information
ggivo committed Dec 8, 2024
1 parent 779edca commit 21bf696
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
31 changes: 19 additions & 12 deletions src/main/java/io/lettuce/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,33 +706,40 @@ public TimeoutOptions getTimeoutOptions() {

/**
* Defines the re-authentication behavior of the Redis client in relation to the {@link CredentialsProvider}.
*/s
*/
public enum ReauthenticateBehavior {

/**
* This is the default behavior. The client will fetch current credentials from the underlying
* {@link RedisCredentialsProvider} only when required.
*
* <p>No re-authentication is performed automatically when new credentials are emitted by the
* {@link StreamingCredentialsProvider} .</p>
* <p>
* No re-authentication is performed automatically when new credentials are emitted by the
* {@link StreamingCredentialsProvider} .
* </p>
*
* <p>This behavior is suitable for use cases with static credentials or where explicit reconnection
* is required to change credentials.</p>
* <p>
* This behavior is suitable for use cases with static credentials or where explicit reconnection is required to change
* credentials.
* </p>
*/
DEFAULT,

/**
* Automatically triggers re-authentication whenever new credentials are emitted by the
* {@link StreamingCredentialsProvider} or any other credentials manager.
*
* <p>When enabled, the client subscribes to the credentials stream provided by the
* {@link StreamingCredentialsProvider} (or other compatible sources) and issues an {@code AUTH}
* command to the Redis server each time new credentials are received. This behavior supports
* dynamic credential scenarios, such as token-based authentication, or credential rotation where credentials
* are refreshed periodically to maintain access.</p>
* <p>
* When enabled, the client subscribes to the credentials stream provided by the {@link StreamingCredentialsProvider}
* (or other compatible sources) and issues an {@code AUTH} command to the Redis server each time new credentials are
* received. This behavior supports dynamic credential scenarios, such as token-based authentication, or credential
* rotation where credentials are refreshed periodically to maintain access.
* </p>
*
* <p>Note: {@code AUTH} commands issued as part of this behavior may interleave with user-submitted
* commands, as the client performs re-authentication independently of user command flow.</p>
* <p>
* Note: {@code AUTH} commands issued as part of this behavior may interleave with user-submitted commands, as the
* client performs re-authentication independently of user command flow.
* </p>
*/
ON_NEW_CREDENTIALS
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ void nodeSelectionApiShouldWork() {
@Test
void shouldPerformNodeConnectionReauth() {
ClusterClientOptions origClientOptions = redisClient.getClusterClientOptions();
origClientOptions.mutate()
.reauthenticateBehavior(ClientOptions.ReauthenticateBehavior.ON_NEW_CREDENTIALS).build();
origClientOptions.mutate().reauthenticateBehavior(ClientOptions.ReauthenticateBehavior.ON_NEW_CREDENTIALS).build();
redisClient.setOptions(origClientOptions.mutate()
.reauthenticateBehavior(ClientOptions.ReauthenticateBehavior.ON_NEW_CREDENTIALS).build());

Expand Down

0 comments on commit 21bf696

Please sign in to comment.