public class ExceptionMappingAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler
If a match isn't found, falls back to the behaviour of the parent class,
SimpleUrlAuthenticationFailureHandler.
The map of exception names to URLs should be injected by setting the exceptionMappings property.
logger| Constructor and Description |
|---|
ExceptionMappingAuthenticationFailureHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
onAuthenticationFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
AuthenticationException exception)
Performs the redirect or forward to the
defaultFailureUrl if set, otherwise
returns a 401 error code. |
void |
setExceptionMappings(java.util.Map<?,?> failureUrlMap)
Sets the map of exception types (by name) to URLs.
|
getRedirectStrategy, isAllowSessionCreation, isUseForward, saveException, setAllowSessionCreation, setDefaultFailureUrl, setRedirectStrategy, setUseForwardpublic ExceptionMappingAuthenticationFailureHandler()
public void onAuthenticationFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
AuthenticationException exception)
throws java.io.IOException,
javax.servlet.ServletException
SimpleUrlAuthenticationFailureHandlerdefaultFailureUrl if set, otherwise
returns a 401 error code.
If redirecting or forwarding, saveException will be called to cache the
exception for use in the target view.
onAuthenticationFailure in interface AuthenticationFailureHandleronAuthenticationFailure in class SimpleUrlAuthenticationFailureHandlerrequest - the request during which the authentication attempt occurred.response - the response.exception - the exception which was thrown to reject the authentication
request.java.io.IOExceptionjavax.servlet.ServletExceptionpublic void setExceptionMappings(java.util.Map<?,?> failureUrlMap)
failureUrlMap - the map keyed by the fully-qualified name of the exception
class, with the corresponding failure URL as the value.java.lang.IllegalArgumentException - if the entries are not Strings or the URL is not
valid.