RSocketSecurity delegates to correct matcher

Fixes gh-7414
This commit is contained in:
Rob Winch 2019-09-09 15:33:15 -05:00
parent 1b699a49fb
commit 6296e6e896
3 changed files with 15 additions and 2 deletions

View File

@ -263,7 +263,20 @@ public class RSocketSecurity {
return matcher(PayloadExchangeMatchers.setup()); 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() { 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()); return matcher(PayloadExchangeMatchers.anyExchange());
} }

View File

@ -157,7 +157,7 @@ public class JwtITests {
.authorizePayload(authorize -> .authorizePayload(authorize ->
authorize authorize
.route("secure.admin.*").authenticated() .route("secure.admin.*").authenticated()
.anyRequest().permitAll() .anyExchange().permitAll()
) )
.jwt(Customizer.withDefaults()); .jwt(Customizer.withDefaults());
return rsocket.build(); return rsocket.build();

View File

@ -261,7 +261,7 @@ public class RSocketMessageHandlerITests {
.authorizePayload(authorize -> { .authorizePayload(authorize -> {
authorize authorize
.route("secure.*").authenticated() .route("secure.*").authenticated()
.anyRequest().permitAll(); .anyExchange().permitAll();
}) })
.basicAuthentication(Customizer.withDefaults()); .basicAuthentication(Customizer.withDefaults());
return rsocket.build(); return rsocket.build();