Package com.avoka.fc.core.security
Class LoginFailureHandler
- java.lang.Object
-
- com.avoka.fc.core.security.LoginFailureHandler
-
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationFailureHandler
public class LoginFailureHandler extends Object implements org.springframework.security.web.authentication.AuthenticationFailureHandler
Provides a custom failure handler based on SimpleUrlAuthenticationFailureHandler that will increase failed login attempts, do locking, and finally redirect.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
defaultFailureUrl
protected org.springframework.security.web.RedirectStrategy
redirectStrategy
-
Constructor Summary
Constructors Constructor Description LoginFailureHandler()
Creates a new SfmAuthenticationFailureHandler instanceLoginFailureHandler(String defaultFailureUrl)
Creates a new SfmAuthenticationFailureHandler instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, org.springframework.security.core.AuthenticationException exception)
Performs the redirect to thedefaultFailureUrl
if set, otherwise returns a 401 error code.void
setDefaultFailureUrl(String defaultFailureUrl)
The URL which will be used as the failure destination.
-
-
-
Field Detail
-
defaultFailureUrl
protected String defaultFailureUrl
-
redirectStrategy
protected org.springframework.security.web.RedirectStrategy redirectStrategy
-
-
Constructor Detail
-
LoginFailureHandler
public LoginFailureHandler()
Creates a new SfmAuthenticationFailureHandler instance
-
LoginFailureHandler
public LoginFailureHandler(String defaultFailureUrl)
Creates a new SfmAuthenticationFailureHandler instance- Parameters:
defaultFailureUrl
- the URL to redirect to in case of login failure
-
-
Method Detail
-
onAuthenticationFailure
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) throws IOException, ServletException
Performs the redirect to thedefaultFailureUrl
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.- Specified by:
onAuthenticationFailure
in interfaceorg.springframework.security.web.authentication.AuthenticationFailureHandler
- Parameters:
request
- the HTTP servlet requestresponse
- the HTTP servlet responseexception
- the authentication exception that occurred- Throws:
IOException
- if an error occurs writing to the responseServletException
- if an error occurs during forwarding- See Also:
AuthenticationFailureHandler.onAuthenticationFailure(HttpServletRequest, HttpServletResponse, AuthenticationException)
-
setDefaultFailureUrl
public void setDefaultFailureUrl(String defaultFailureUrl)
The URL which will be used as the failure destination.- Parameters:
defaultFailureUrl
- the failure URL, for example "/loginFailed.jsp".
-
-