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
Modifier and TypeFieldDescriptionprotected String
protected org.springframework.security.web.RedirectStrategy
-
Constructor Summary
ConstructorDescriptionCreates a new SfmAuthenticationFailureHandler instanceLoginFailureHandler
(String defaultFailureUrl) Creates a new SfmAuthenticationFailureHandler instance -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Details
-
defaultFailureUrl
-
redirectStrategy
protected org.springframework.security.web.RedirectStrategy redirectStrategy
-
-
Constructor Details
-
LoginFailureHandler
public LoginFailureHandler()Creates a new SfmAuthenticationFailureHandler instance -
LoginFailureHandler
Creates a new SfmAuthenticationFailureHandler instance- Parameters:
defaultFailureUrl
- the URL to redirect to in case of login failure
-
-
Method Details
-
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
The URL which will be used as the failure destination.- Parameters:
defaultFailureUrl
- the failure URL, for example "/loginFailed.jsp".
-