Class SecondFactorRequiredEntryPoint
java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.SecondFactorRequiredEntryPoint
- All Implemented Interfaces:
org.springframework.security.web.AuthenticationEntryPoint
public class SecondFactorRequiredEntryPoint
extends Object
implements org.springframework.security.web.AuthenticationEntryPoint
Sends a user who has presented a primary factor but not yet the second one to the second-factor page, after saving
the request being served (typically
/oauth2/authorize?...) so the sign-in resumes where it left off once the
second factor is verified. It also records in the session whether the request is a step-up
(SecondFactorRequiredException.isStepUp()), which TrustedDeviceFilter reads so that a trusted device
does not resume a request it cannot satisfy (that would redirect back here again).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.web.RedirectStrategyStrategy that redirects, honouring the context path.private final org.springframework.security.web.savedrequest.RequestCacheCache that keeps the request to resume after the second factor, shared with the form login.static final StringPath of the second-factor page.static final StringName of the session attribute present while the pending request is a step-up that needs a real factor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) Saves the request, remembers whether it is a step-up and redirects to the second-factor page.static booleanisStepUpPending(jakarta.servlet.http.HttpServletRequest request) Tells whether the request the session is waiting to resume is a step-up that needs a real second factor.
-
Field Details
-
SECOND_FACTOR_PATH
Path of the second-factor page.- See Also:
-
STEP_UP_ATTRIBUTE
Name of the session attribute present while the pending request is a step-up that needs a real factor. -
redirectStrategy
private final org.springframework.security.web.RedirectStrategy redirectStrategyStrategy that redirects, honouring the context path. -
requestCache
private final org.springframework.security.web.savedrequest.RequestCache requestCacheCache that keeps the request to resume after the second factor, shared with the form login.
-
-
Constructor Details
-
SecondFactorRequiredEntryPoint
public SecondFactorRequiredEntryPoint()
-
-
Method Details
-
isStepUpPending
public static boolean isStepUpPending(jakarta.servlet.http.HttpServletRequest request) Tells whether the request the session is waiting to resume is a step-up that needs a real second factor.- Parameters:
request- a request of the session.- Returns:
truewhen the last redirect to the second-factor page was for a step-up.
-
commence
public void commence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) throws IOException Saves the request, remembers whether it is a step-up and redirects to the second-factor page.- Specified by:
commencein interfaceorg.springframework.security.web.AuthenticationEntryPoint- Parameters:
request- the request that needs a second factor.response- the response to redirect.authException- why the request was refused.- Throws:
IOException- if the redirect cannot be sent.
-