Add hasAnyAuthority method in AuthorizePayloadsSpec.Access

See Fixes gh-7437

Co-authored-by: Eddú Meléndez <eddu.melendez@gmail.com>
This commit is contained in:
Ebert Toribio
2019-09-18 20:55:03 -05:00
parent 3425db6d16
commit 3a66191756
2 changed files with 30 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ import java.util.List;
* }
* </pre>
* @author Rob Winch
* @author Ebert Toribio
* @since 5.2
*/
public class RSocketSecurity {
@@ -320,6 +321,10 @@ public class RSocketSecurity {
.just(new AuthorizationDecision(true)));
}
public AuthorizePayloadsSpec hasAnyAuthority(String... authorities) {
return access(AuthorityReactiveAuthorizationManager.hasAnyAuthority(authorities));
}
public AuthorizePayloadsSpec access(
ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext> authorization) {
AuthorizePayloadsSpec.this.authzBuilder.add(new PayloadExchangeMatcherEntry<>(this.matcher, authorization));