Polish RSocket Anonymous Support

Changed the DSL method name to anonymous to align with jwt.
Since basicAuthenication is deprecated, we don't need to
align with its naming convention.

Also added a since attribute to the method.

Issue gh-17132
This commit is contained in:
Josh Cummings 2025-08-26 17:21:39 -06:00
parent 559b73b39f
commit 4cbe8de7ea
2 changed files with 3 additions and 2 deletions

View File

@ -121,7 +121,7 @@ public class AnonymousAuthenticationITests {
ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext> anonymous = (authentication, ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext> anonymous = (authentication,
exchange) -> authentication.map(trustResolver::isAnonymous).map(AuthorizationDecision::new); exchange) -> authentication.map(trustResolver::isAnonymous).map(AuthorizationDecision::new);
rsocket.authorizePayload((authorize) -> authorize.anyExchange().access(anonymous)); rsocket.authorizePayload((authorize) -> authorize.anyExchange().access(anonymous));
rsocket.anonymousAuthentication((anonymousAuthentication) -> anonymousAuthentication.disable()); rsocket.anonymous((anonymousAuthentication) -> anonymousAuthentication.disable());
return rsocket.build(); return rsocket.build();
} }

View File

@ -171,8 +171,9 @@ public class RSocketSecurity {
* Adds anonymous authentication * Adds anonymous authentication
* @param anonymous a customizer * @param anonymous a customizer
* @return this instance * @return this instance
* @since 7.0
*/ */
public RSocketSecurity anonymousAuthentication(Customizer<AnonymousAuthenticationSpec> anonymous) { public RSocketSecurity anonymous(Customizer<AnonymousAuthenticationSpec> anonymous) {
if (this.anonymousAuthSpec == null) { if (this.anonymousAuthSpec == null) {
this.anonymousAuthSpec = new AnonymousAuthenticationSpec(this); this.anonymousAuthSpec = new AnonymousAuthenticationSpec(this);
} }