Class MfaConfiguration
java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.MfaConfiguration
@Configuration(value="mfaWebConfiguration",
proxyBeanMethods=false)
@EnableMultiFactorAuthentication(authorities={})
public class MfaConfiguration
extends Object
Wires multi-factor authentication: Spring Security's multi-factor support (it enables the entry points for a missing
factor authority; the factors are not required globally, because the
MfaAuthorizationManager requires them
only when the client or the user asks for it), the registry of AuthenticationFactor beans, the policy
manager, and its application to the login chain and to /oauth2/authorize.
A login method adds its factor by declaring an AuthenticationFactor bean (see
PasswordFactor); nothing here is edited.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuilds the registry of the known factors.mfaAuthorizationManager(MfaPolicy mfaPolicy, AuthenticationFactorRegistry factorRegistry, IsUserMfaRequiredUseCase isUserMfaRequiredUseCase, IsClientMfaRequiredUseCase isClientMfaRequiredUseCase) Builds the manager that applies the multi-factor policy.mfaLoginChainCustomizer(MfaAuthorizationManager authorizationManager, AuthenticationFactorRegistry factorRegistry, SecondFactorRequiredEntryPoint secondFactorEntryPoint) Applies the policy to the login/UI chain.mfaProtocolChainCustomizer(MfaAuthorizationManager authorizationManager, SecondFactorRequiredEntryPoint secondFactorEntryPoint, ReauthenticationEntryPoint reauthenticationEntryPoint) Applies the policy to/oauth2/authorize.Builds the entry point that forces a new sign-in, resuming the saved request afterwards.Builds the entry point that sends a user to the second-factor page, resuming the saved request afterwards.stepUpProtocolChainCustomizer(FactorTimeline factorTimeline, Clock clock) Applies step-up authentication (acr_values,max_age) to/oauth2/authorize.
-
Constructor Details
-
MfaConfiguration
public MfaConfiguration()
-
-
Method Details
-
authenticationFactorRegistry
@Bean public AuthenticationFactorRegistry authenticationFactorRegistry(List<AuthenticationFactor> factors) Builds the registry of the known factors.- Parameters:
factors- everyAuthenticationFactorbean.- Returns:
- the registry.
-
secondFactorRequiredEntryPoint
Builds the entry point that sends a user to the second-factor page, resuming the saved request afterwards.- Returns:
- the entry point, sharing the session request cache of the form login.
-
mfaAuthorizationManager
@Bean public MfaAuthorizationManager mfaAuthorizationManager(MfaPolicy mfaPolicy, AuthenticationFactorRegistry factorRegistry, IsUserMfaRequiredUseCase isUserMfaRequiredUseCase, IsClientMfaRequiredUseCase isClientMfaRequiredUseCase) Builds the manager that applies the multi-factor policy.- Parameters:
mfaPolicy- the policy.factorRegistry- the registry of the known factors.isUserMfaRequiredUseCase- tells whether a user's account requires a second factor.isClientMfaRequiredUseCase- tells whether the client of a request requires a second factor.- Returns:
- the manager.
-
mfaLoginChainCustomizer
@Bean @Order(0) public LoginChainCustomizer mfaLoginChainCustomizer(MfaAuthorizationManager authorizationManager, AuthenticationFactorRegistry factorRegistry, SecondFactorRequiredEntryPoint secondFactorEntryPoint) Applies the policy to the login/UI chain.- Parameters:
authorizationManager- the manager.factorRegistry- the registry of the known factors.secondFactorEntryPoint- the entry point of the second-factor page.- Returns:
- the customizer.
-
mfaProtocolChainCustomizer
@Bean @Order(0) public ProtocolChainCustomizer mfaProtocolChainCustomizer(MfaAuthorizationManager authorizationManager, SecondFactorRequiredEntryPoint secondFactorEntryPoint, ReauthenticationEntryPoint reauthenticationEntryPoint) Applies the policy to/oauth2/authorize.- Parameters:
authorizationManager- the manager.secondFactorEntryPoint- the entry point of the second-factor page.reauthenticationEntryPoint- the entry point that forces a new sign-in.- Returns:
- the customizer.
-
reauthenticationEntryPoint
Builds the entry point that forces a new sign-in, resuming the saved request afterwards.- Returns:
- the entry point, sharing the session request cache of the form login.
-
stepUpProtocolChainCustomizer
@Bean @Order(1) public ProtocolChainCustomizer stepUpProtocolChainCustomizer(FactorTimeline factorTimeline, Clock clock) Applies step-up authentication (acr_values,max_age) to/oauth2/authorize.- Parameters:
factorTimeline- reads the counted factors of the session and their instants.clock- the clock the age of the authentication is measured with.- Returns:
- the customizer.
-