diff --git a/config/src/main/java/org/springframework/security/config/annotation/rsocket/RSocketSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/rsocket/RSocketSecurity.java index 94c6fa7ed4..dd307f655f 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/rsocket/RSocketSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/rsocket/RSocketSecurity.java @@ -263,7 +263,20 @@ public class RSocketSecurity { return matcher(PayloadExchangeMatchers.setup()); } + /** + * Matches if {@link org.springframework.security.rsocket.api.PayloadExchangeType#isRequest()} is true, else + * not a match + * @return the Access to set up the authorization rule. + */ public Access anyRequest() { + return matcher(PayloadExchangeMatchers.anyRequest()); + } + + /** + * Always matches + * @return the Access to set up the authorization rule. + */ + public Access anyExchange() { return matcher(PayloadExchangeMatchers.anyExchange()); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java b/config/src/test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java index 0dfd968178..4133873ff7 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java @@ -157,7 +157,7 @@ public class JwtITests { .authorizePayload(authorize -> authorize .route("secure.admin.*").authenticated() - .anyRequest().permitAll() + .anyExchange().permitAll() ) .jwt(Customizer.withDefaults()); return rsocket.build(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java b/config/src/test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java index 59dcac2401..1c8d78887a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java @@ -261,7 +261,7 @@ public class RSocketMessageHandlerITests { .authorizePayload(authorize -> { authorize .route("secure.*").authenticated() - .anyRequest().permitAll(); + .anyExchange().permitAll(); }) .basicAuthentication(Customizer.withDefaults()); return rsocket.build();