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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.springframework.security.web.RedirectStrategy -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SfmAuthenticationFailureHandler instanceLoginFailureHandler(String defaultFailureUrl) Creates a new SfmAuthenticationFailureHandler instance -
Method Summary
Modifier and TypeMethodDescriptionvoidonAuthenticationFailure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) Performs the redirect to thedefaultFailureUrlif set, otherwise returns a 401 error code.voidsetDefaultFailureUrl(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(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception) throws IOException, jakarta.servlet.ServletException Performs the redirect to thedefaultFailureUrlif set, otherwise returns a 401 error code.If redirecting or forwarding,
saveExceptionwill be called to cache the exception for use in the target view.- Specified by:
onAuthenticationFailurein 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 responsejakarta.servlet.ServletException- if an error occurs during forwarding- See Also:
-
setDefaultFailureUrl
The URL which will be used as the failure destination.- Parameters:
defaultFailureUrl- the failure URL, for example "/loginFailed.jsp".
-