Add hasAnyAuthority() and hasAnyRole() in AuthorizeExchangeSpec
Fixes gh-6306
This commit is contained in:
committed by
Rob Winch
parent
a919b4e916
commit
e60ae4984a
+18
@@ -1563,6 +1563,15 @@ public class ServerHttpSecurity {
|
||||
return access(AuthorityReactiveAuthorizationManager.hasRole(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* Require any specific role. This is a shortcut for {@link #hasAnyAuthority(String...)}
|
||||
* @param roles the roles (i.e. "USER" would require "ROLE_USER")
|
||||
* @return the {@link AuthorizeExchangeSpec} to configure
|
||||
*/
|
||||
public AuthorizeExchangeSpec hasAnyRole(String... roles) {
|
||||
return access(AuthorityReactiveAuthorizationManager.hasAnyRole(roles));
|
||||
}
|
||||
|
||||
/**
|
||||
* Require a specific authority.
|
||||
* @param authority the authority to require (i.e. "USER" woudl require authority of "USER").
|
||||
@@ -1572,6 +1581,15 @@ public class ServerHttpSecurity {
|
||||
return access(AuthorityReactiveAuthorizationManager.hasAuthority(authority));
|
||||
}
|
||||
|
||||
/**
|
||||
* Require any authority
|
||||
* @param authorities the authorities to require (i.e. "USER" would require authority of "USER").
|
||||
* @return the {@link AuthorizeExchangeSpec} to configure
|
||||
*/
|
||||
public AuthorizeExchangeSpec hasAnyAuthority(String... authorities) {
|
||||
return access(AuthorityReactiveAuthorizationManager.hasAnyAuthority(authorities));
|
||||
}
|
||||
|
||||
/**
|
||||
* Require an authenticated user
|
||||
* @return the {@link AuthorizeExchangeSpec} to configure
|
||||
|
||||
Reference in New Issue
Block a user