public class TemplateAuthenticationFailureHandler extends Object implements org.springframework.security.web.authentication.AuthenticationFailureHandler
Constructor and Description |
---|
TemplateAuthenticationFailureHandler(String defaultFailureUrl,
cn.home1.oss.lib.errorhandle.api.ExceptionResolver<Throwable> exceptionResolver,
cn.home1.oss.lib.webmvc.api.TypeSafeCookie<cn.home1.oss.lib.errorhandle.api.ResolvedError> resolvedErrorCookie) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.security.web.RedirectStrategy |
getRedirectStrategy() |
protected boolean |
isAllowSessionCreation() |
protected boolean |
isUseForward() |
void |
onAuthenticationFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.security.core.AuthenticationException exception) |
protected void |
saveException(javax.servlet.http.HttpServletRequest request,
org.springframework.security.core.AuthenticationException exception)
Caches the
AuthenticationException for use in view rendering. |
void |
setAllowSessionCreation(boolean allowSessionCreation) |
void |
setDefaultFailureUrl(String defaultFailureUrl)
The URL which will be used as the failure destination.
|
void |
setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
Allows overriding of the behaviour when redirecting to a target URL.
|
void |
setUseForward(boolean forwardToDestination)
If set to true, performs a forward to the failure destination URL instead
of a redirect.
|
static TemplateAuthenticationFailureHandler |
templateFailureHandler(String loginFormUrl,
cn.home1.oss.lib.errorhandle.api.ExceptionResolver<Throwable> exceptionResolver,
cn.home1.oss.lib.webmvc.api.TypeSafeCookie<cn.home1.oss.lib.errorhandle.api.ResolvedError> resolvedErrorCookie) |
public void onAuthenticationFailure(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) throws IOException, javax.servlet.ServletException
onAuthenticationFailure
in interface org.springframework.security.web.authentication.AuthenticationFailureHandler
IOException
javax.servlet.ServletException
protected final void saveException(javax.servlet.http.HttpServletRequest request, org.springframework.security.core.AuthenticationException exception)
Caches the AuthenticationException
for use in view rendering.
forwardToDestination
is set to true, request scope will be used,
otherwise it will attempt to store the exception in the session. If there is no
session and allowSessionCreation
is true
a session will be created.
Otherwise the exception will not be stored.request
- requestexception
- exceptionpublic final void setDefaultFailureUrl(String defaultFailureUrl)
defaultFailureUrl
- the failure URL, for example "/loginFailed.jsp".protected boolean isUseForward()
public void setUseForward(boolean forwardToDestination)
forwardToDestination
- forwardToDestinationpublic void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
redirectStrategy
- redirectStrategyprotected org.springframework.security.web.RedirectStrategy getRedirectStrategy()
protected boolean isAllowSessionCreation()
public void setAllowSessionCreation(boolean allowSessionCreation)
public static TemplateAuthenticationFailureHandler templateFailureHandler(String loginFormUrl, cn.home1.oss.lib.errorhandle.api.ExceptionResolver<Throwable> exceptionResolver, cn.home1.oss.lib.webmvc.api.TypeSafeCookie<cn.home1.oss.lib.errorhandle.api.ResolvedError> resolvedErrorCookie)
Copyright © 2017. All rights reserved.