Class HttpMessageConverterAuthenticationSuccessHandler
java.lang.Object
org.springframework.security.web.authentication.HttpMessageConverterAuthenticationSuccessHandler
- All Implemented Interfaces:
- AuthenticationSuccessHandler
public final class HttpMessageConverterAuthenticationSuccessHandler
extends Object
implements AuthenticationSuccessHandler
An 
AuthenticationSuccessHandler that writes a JSON response with the redirect
 URL and an authenticated status similar to:
 
     {
         "redirectUrl": "/user/profile",
         "authenticated": true
     }
 - Since:
- 6.4
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA response object used to write the JSON response for successful authentication.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidonAuthenticationSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Authentication authentication) Called when a user has been successfully authenticated.voidsetConverter(org.springframework.http.converter.HttpMessageConverter<Object> converter) Sets theGenericHttpMessageConverterto write to the response.voidsetRequestCache(RequestCache requestCache) Sets theRequestCacheto use.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.web.authentication.AuthenticationSuccessHandleronAuthenticationSuccess
- 
Constructor Details- 
HttpMessageConverterAuthenticationSuccessHandlerpublic HttpMessageConverterAuthenticationSuccessHandler()
 
- 
- 
Method Details- 
setConverterSets theGenericHttpMessageConverterto write to the response. The default isMappingJackson2HttpMessageConverter.- Parameters:
- converter- the- GenericHttpMessageConverterto use. Cannot be null.
 
- 
setRequestCacheSets theRequestCacheto use. The default isHttpSessionRequestCache.- Parameters:
- requestCache- the- RequestCacheto use. Cannot be null
 
- 
onAuthenticationSuccesspublic void onAuthenticationSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Authentication authentication) throws IOException, jakarta.servlet.ServletException Description copied from interface:AuthenticationSuccessHandlerCalled when a user has been successfully authenticated.- Specified by:
- onAuthenticationSuccessin interface- AuthenticationSuccessHandler
- Parameters:
- request- the request which caused the successful authentication
- response- the response
- authentication- the Authentication object which was created during the authentication process.
- Throws:
- IOException
- jakarta.servlet.ServletException
 
 
-