Class ConditionalAuthorizationManager<T>

java.lang.Object
org.springframework.security.authorization.ConditionalAuthorizationManager<T>
Type Parameters:
T - the type of object that the authorization check is being performed on
All Implemented Interfaces:
AuthorizationManager<T>

public final class ConditionalAuthorizationManager<T> extends Object implements AuthorizationManager<T>
An AuthorizationManager that delegates to one of two AuthorizationManager instances based on a condition evaluated against the current Authentication.

When authorize(Supplier, Object) is invoked, the condition is evaluated. If the Authentication is non-null and the condition returns true, the whenTrue manager is used; otherwise the whenFalse manager is used.

This is useful for scenarios such as requiring multi-factor authentication only when the user has registered a second factor, or applying different rules based on authentication state.

Since:
7.1