Skip to content

[reactor-optional] Deprecate RedisCredentialsProvider interface in favor of CredentialsProvider - #3837

Open
a-TODO-rov wants to merge 3 commits into
mainfrom
creds-dirB-7x
Open

[reactor-optional] Deprecate RedisCredentialsProvider interface in favor of CredentialsProvider#3837
a-TODO-rov wants to merge 3 commits into
mainfrom
creds-dirB-7x

Conversation

@a-TODO-rov

@a-TODO-rov a-TODO-rov commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

alternative approach of #3830 . This way we won't deprecate the abstract method of a Functionalinterface


Note

Medium Risk
Touches the public authentication/credential SPI and streaming re-auth path, but keeps backward-compatible defaults and does not yet migrate internal handlers to the new APIs.

Overview
Introduces CredentialsProvider (7.7) as the replacement for RedisCredentialsProvider, with resolveCredentialsAsync() as the primary contract (CompletionStage) and a default resolveCredentials() that bridges to Reactor Mono. The new type extends the old interface so existing implementations keep compiling without deprecating the functional-interface abstract method directly.

RedisCredentialsProvider is marked deprecated (removal in 8.0) and gains forward-compatible defaults: resolveCredentialsAsync() from Mono, and subscribeToCredentials(onNext, onError) returning a new Subscription handle (replacing the deprecated credentials() Flux). CredentialsProvider also adds from(Supplier) and an ImmediateRedisCredentialsProvider nested type mirroring the old pattern.

RedisAuthenticationHandler.subscribe() is unchanged in behavior; it only adds a deprecation suppression while still subscribing via credentials(). Unit tests cover the async bridge and subscription close semantics.

Reviewed by Cursor Bugbot for commit b8b2a25. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment on lines +37 to +47
/**
* Resolves the latest available credentials as a {@link CompletionStage}.
*
* @return a {@link CompletionStage} that completes with the {@link RedisCredentials} used to authorize a Redis connection.
* @since 7.7
*/
@SuppressWarnings("deprecation")
default CompletionStage<RedisCredentials> resolveCredentialsAsync() {
return resolveCredentials().toFuture();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed here anymore.
also moving subscribeToCredentials to new CredentialsProvider would help not confusing users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants