Class MfaProtocolChainCustomizer
java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.MfaProtocolChainCustomizer
- All Implemented Interfaces:
ProtocolChainCustomizer
Applies the multi-factor policy to
/oauth2/authorize: a user whose client or account requires a second factor
and has not presented one is sent to the second-factor page, with the authorize request saved, before any code is
issued. The framework's own request validation still runs first.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MfaAuthorizationManagerManager that applies the policy.private final org.springframework.security.web.authentication.AuthenticationFailureHandlerHandler of the endpoint's errors, which sends the user to the second-factor page when needed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer server) Customizes the authorization endpoint.private voidrequireSecondFactor(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationContext context) Refuses the request when the user still owes a second factor.
-
Field Details
-
authorizationManager
Manager that applies the policy. -
errorResponseHandler
private final org.springframework.security.web.authentication.AuthenticationFailureHandler errorResponseHandlerHandler of the endpoint's errors, which sends the user to the second-factor page when needed.
-
-
Constructor Details
-
MfaProtocolChainCustomizer
public MfaProtocolChainCustomizer()
-
-
Method Details
-
customize
public void customize(org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer server) Customizes the authorization endpoint.- Specified by:
customizein interfaceProtocolChainCustomizer- Parameters:
server- configurer of the authorization server.
-
requireSecondFactor
private void requireSecondFactor(org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationContext context) Refuses the request when the user still owes a second factor.- Parameters:
context- the authorization request being validated.- Throws:
SecondFactorRequiredException- if the policy is not satisfied.
-