Class AllRequiredFactorsAuthorizationManager<T>
java.lang.Object
org.springframework.security.authorization.AllRequiredFactorsAuthorizationManager<T>
- All Implemented Interfaces:
AuthorizationManager<T>
public final class AllRequiredFactorsAuthorizationManager<T>
extends Object
implements AuthorizationManager<T>
An
AuthorizationManager that determines if the current user is authorized by
evaluating if the Authentication contains a FactorGrantedAuthority that
is not expired for each RequiredFactor.- Since:
- 7.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder forAllRequiredFactorsAuthorizationManager. -
Method Summary
Modifier and TypeMethodDescriptionauthorize(Supplier<? extends @Nullable Authentication> authentication, T object) For eachRequiredFactorfinds the firstFactorGrantedAuthority.getAuthority()that matches theRequiredFactor.getAuthority().static <T> AllRequiredFactorsAuthorizationManager.Builder<T>builder()Creates a newAllRequiredFactorsAuthorizationManager.BuildervoidSets theClockto use.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.AuthorizationManager
verify
-
Method Details
-
setClock
Sets theClockto use.- Parameters:
clock- theClockto use. Cannot be null.
-
authorize
public FactorAuthorizationDecision authorize(Supplier<? extends @Nullable Authentication> authentication, T object) For eachRequiredFactorfinds the firstFactorGrantedAuthority.getAuthority()that matches theRequiredFactor.getAuthority(). TheFactorGrantedAuthority.getIssuedAt()must be more recent thanRequiredFactor.getValidDuration()(if non-null).- Specified by:
authorizein interfaceAuthorizationManager<T>- Parameters:
authentication- theSupplierof theAuthenticationto checkobject- the object to check authorization on (not used).- Returns:
- an
FactorAuthorizationDecision
-
builder
Creates a newAllRequiredFactorsAuthorizationManager.Builder- Returns:
-