Selaa lähdekoodia

RSocketSecurity delegates to correct matcher

Fixes gh-7414
Rob Winch 6 vuotta sitten
vanhempi
commit
6296e6e896

+ 13 - 0
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());
 		}
 

+ 1 - 1
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();

+ 1 - 1
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();