Class SessionAndSavedRequestAwareAuthenticationSuccessHandler
java.lang.Object
org.springframework.security.web.authentication.AbstractAuthenticationTargetUrlRequestHandler
org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler
org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler
de.gustavblass.fsu.fmi.roombooking.configuration.SessionAndSavedRequestAwareAuthenticationSuccessHandler
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationSuccessHandler
public class SessionAndSavedRequestAwareAuthenticationSuccessHandler
extends org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler
A
SavedRequestAwareAuthenticationSuccessHandler that uses the REDIRECT_TARGET session attribute in order to
redirect the user to the correct target page after logging in successfully.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @NonNull StringThe name of the session attribute used as theURIthat the user shall be redirected to after successful authentication.Fields inherited from class org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonAuthenticationSuccess(@NonNull jakarta.servlet.http.HttpServletRequest request, @NonNull jakarta.servlet.http.HttpServletResponse response, @NonNull org.springframework.security.core.Authentication authentication) If session attribute namedREDIRECT_TARGETis set (and of typeURI), it will be used to redirect the user.Methods inherited from class org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler
setRequestCacheMethods inherited from class org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler
clearAuthenticationAttributesMethods inherited from class org.springframework.security.web.authentication.AbstractAuthenticationTargetUrlRequestHandler
determineTargetUrl, determineTargetUrl, getDefaultTargetUrl, getRedirectStrategy, getTargetUrlParameter, handle, isAlwaysUseDefaultTargetUrl, setAlwaysUseDefaultTargetUrl, setDefaultTargetUrl, setRedirectStrategy, setTargetUrlParameter, setUseRefererMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.web.authentication.AuthenticationSuccessHandler
onAuthenticationSuccess
-
Field Details
-
REDIRECT_TARGET
-
-
Constructor Details
-
SessionAndSavedRequestAwareAuthenticationSuccessHandler
public SessionAndSavedRequestAwareAuthenticationSuccessHandler()
-
-
Method Details
-
onAuthenticationSuccess
public void onAuthenticationSuccess(@NonNull @NonNull jakarta.servlet.http.HttpServletRequest request, @NonNull @NonNull jakarta.servlet.http.HttpServletResponse response, @NonNull @NonNull org.springframework.security.core.Authentication authentication) throws jakarta.servlet.ServletException, IOException If session attribute named
REDIRECT_TARGETis set (and of typeURI), it will be used to redirect the user.If no such session attribute is found, the supermethod is invoked instead.
- Specified by:
onAuthenticationSuccessin interfaceorg.springframework.security.web.authentication.AuthenticationSuccessHandler- Overrides:
onAuthenticationSuccessin classorg.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler- Parameters:
request- The request of the successful login.response- The server's response to the successful login request.authentication- Passed to the supermethod if noREDIRECT_TARGETsession attribute is found.- Throws:
jakarta.servlet.ServletException- Thrown by the supermethod.IOException- Thrown by the supermethod.
-