Class AuthenticationFailureExceptionMapping
java.lang.Object
com.broadleafcommerce.auth.security.web.authentication.AuthenticationFailureExceptionMapping
- All Implemented Interfaces:
org.springframework.core.Ordered
- Direct Known Subclasses:
OAuth2LoginSystemAuthenticationFailureExceptionMapping
public class AuthenticationFailureExceptionMapping
extends Object
implements org.springframework.core.Ordered
Class used for mapping an exception to a redirect URI.
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationFailureExceptionMapping(Class<?> exception, @NonNull String redirectUrl) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanClass<?>The exception class that this mapping should be handling.intgetOrder()The redirect URL when the target exception happens.protected StringgetRootCauseException(Throwable exception) inthashCode()booleanshouldApply(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) This is a method called byDefaultExceptionMappingAuthenticationFailureHandlerto determine whether this failure mapping should apply for a particular request/exception flow.toString()
-
Constructor Details
-
AuthenticationFailureExceptionMapping
-
-
Method Details
-
shouldApply
public boolean shouldApply(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) This is a method called by
DefaultExceptionMappingAuthenticationFailureHandlerto determine whether this failure mapping should apply for a particular request/exception flow.For backward compatibility, the default implementation of this method matches the logic used by
DefaultExceptionMappingAuthenticationFailureHandlerbefore this method existed.- Parameters:
request- the request passed toDefaultExceptionMappingAuthenticationFailureHandler.onAuthenticationFailure(HttpServletRequest, HttpServletResponse, AuthenticationException)response- the response passed toDefaultExceptionMappingAuthenticationFailureHandler.onAuthenticationFailure(HttpServletRequest, HttpServletResponse, AuthenticationException)exception- the exception passed toDefaultExceptionMappingAuthenticationFailureHandler.onAuthenticationFailure(HttpServletRequest, HttpServletResponse, AuthenticationException)- Returns:
- true if this failure mapping should apply for the given inputs, false otherwise
- Since:
- AuthenticationServices 2.3.0, RT 2.3.0
-
getRootCauseException
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Returns:
- relative bean order for this component
- Since:
- AuthenticationServices 2.3.0, RT 2.3.0
-
getException
The exception class that this mapping should be handling. This is primarily relevant in simple cases where just comparing exception types is enough to determine whether this mapping should apply. In cases whereshouldApply(HttpServletRequest, HttpServletResponse, AuthenticationException)has been overridden with more complicated logic, this field may not be relevant, and therefore will be null. -
getRedirectUrl
The redirect URL when the target exception happens.Except in some special circumstances, the redirect URL should generally redirect to the login page with an "error=true" and "errorCode" param. For example:
/login?error=true&errorCode=login.error.user-inactive -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-