Class AllAuthoritiesReactiveAuthorizationManager<T>
java.lang.Object
org.springframework.security.authorization.AllAuthoritiesReactiveAuthorizationManager<T>
- All Implemented Interfaces:
ReactiveAuthorizationManager<T>
public final class AllAuthoritiesReactiveAuthorizationManager<T>
extends Object
implements ReactiveAuthorizationManager<T>
A
ReactiveAuthorizationManager that determines if the current user is
authorized by evaluating if the Authentication contains all the specified
authorities.- Since:
- 7.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<AuthorizationResult>authorize(reactor.core.publisher.Mono<Authentication> authentication, T object) Determines if the current user is authorized by evaluating if theAuthenticationcontains any of specified authorities.static <T> AllAuthoritiesReactiveAuthorizationManager<T>hasAllAuthorities(String... authorities) Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.static <T> AllAuthoritiesReactiveAuthorizationManager<T>hasAllPrefixedAuthorities(String prefix, String... authorities) Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.static <T> AllAuthoritiesReactiveAuthorizationManager<T>hasAllRoles(String... roles) Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.voidsetRoleHierarchy(RoleHierarchy roleHierarchy) Sets theRoleHierarchyto be used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.authorization.ReactiveAuthorizationManager
verify
-
Method Details
-
setRoleHierarchy
Sets theRoleHierarchyto be used. Default isNullRoleHierarchy. Cannot be null.- Parameters:
roleHierarchy- theRoleHierarchyto use
-
authorize
public reactor.core.publisher.Mono<AuthorizationResult> authorize(reactor.core.publisher.Mono<Authentication> authentication, T object) Determines if the current user is authorized by evaluating if theAuthenticationcontains any of specified authorities.- Specified by:
authorizein interfaceReactiveAuthorizationManager<T>- Parameters:
authentication- theSupplierof theAuthenticationto checkobject- the object to check authorization on (not used).- Returns:
- an
AuthorityAuthorizationDecision
-
hasAllRoles
Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.- Type Parameters:
T- the type of object being authorized- Parameters:
roles- the authorities to check for prefixed with "ROLE_". Each role should not start with "ROLE_" since it is automatically prepended already.- Returns:
- the new instance
-
hasAllPrefixedAuthorities
public static <T> AllAuthoritiesReactiveAuthorizationManager<T> hasAllPrefixedAuthorities(String prefix, String... authorities) Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.- Type Parameters:
T- the type of object being authorized- Parameters:
prefix- the prefix forauthoritiesauthorities- the authorities to check for prefixed withprefix- Returns:
- the new instance
-
hasAllAuthorities
public static <T> AllAuthoritiesReactiveAuthorizationManager<T> hasAllAuthorities(String... authorities) Creates an instance ofAllAuthoritiesReactiveAuthorizationManagerwith the provided authorities.- Type Parameters:
T- the type of object being authorized- Parameters:
authorities- the authorities to check for- Returns:
- the new instance
-