Package se.bth.pulse.security
Class PasswordChangeAuthenticationSuccessHandler
java.lang.Object
se.bth.pulse.security.PasswordChangeAuthenticationSuccessHandler
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationSuccessHandler
public class PasswordChangeAuthenticationSuccessHandler
extends Object
implements org.springframework.security.web.authentication.AuthenticationSuccessHandler
This class is used to redirect the user to the change password page if the user is logging in for
the first time. It uses the AuthenticationSuccessHandler interface to change the behaviour of
onAuthenticationSuccess method. It implements the interface to override the method. The method is
invoked from ApplicationSecurityConfig class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onAuthenticationSuccess
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication auth) This method is used to redirect the user to the change password page if the user is logging in for the first time.void
proceed
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication auth) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.security.web.authentication.AuthenticationSuccessHandler
onAuthenticationSuccess
-
Constructor Details
-
PasswordChangeAuthenticationSuccessHandler
public PasswordChangeAuthenticationSuccessHandler()
-
-
Method Details
-
onAuthenticationSuccess
public void onAuthenticationSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication auth) throws IOException, jakarta.servlet.ServletException This method is used to redirect the user to the change password page if the user is logging in for the first time. It gets the username of the logged-in user from the authentication object.- Specified by:
onAuthenticationSuccess
in interfaceorg.springframework.security.web.authentication.AuthenticationSuccessHandler
- Parameters:
request
- - used to pass on any request after a successful loginresponse
- - used to redirect the user to the change password page if the user is logging in for the first timeauth
- - used to get the username of the logged-in user- Throws:
IOException
- - is thrown from the target onAuthenticationSuccess method.jakarta.servlet.ServletException
- - is thrown from the target onAuthenticationSuccess method.
-
proceed
public void proceed(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication auth) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.ServletException
IOException
-