Class RedirectServerAuthenticationSuccessHandler
- java.lang.Object
-
- org.springframework.security.web.server.authentication.RedirectServerAuthenticationSuccessHandler
-
- All Implemented Interfaces:
ServerAuthenticationSuccessHandler
public class RedirectServerAuthenticationSuccessHandler extends java.lang.Object implements ServerAuthenticationSuccessHandler
Performs a redirect on authentication success. The default is to redirect to a saved request if present and otherwise "/".- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description RedirectServerAuthenticationSuccessHandler()Creates a new instance with location of "/"RedirectServerAuthenticationSuccessHandler(java.lang.String location)Creates a new instance with the specified location
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<java.lang.Void>onAuthenticationSuccess(WebFilterExchange webFilterExchange, org.springframework.security.core.Authentication authentication)Invoked when the application authenticates successfullyvoidsetLocation(java.net.URI location)Where the user is redirected to upon authentication successvoidsetRedirectStrategy(ServerRedirectStrategy redirectStrategy)The RedirectStrategy to use.voidsetRequestCache(ServerRequestCache requestCache)Sets theServerRequestCacheused to redirect to.
-
-
-
Constructor Detail
-
RedirectServerAuthenticationSuccessHandler
public RedirectServerAuthenticationSuccessHandler()
Creates a new instance with location of "/"
-
RedirectServerAuthenticationSuccessHandler
public RedirectServerAuthenticationSuccessHandler(java.lang.String location)
Creates a new instance with the specified location- Parameters:
location- the location to redirect if the no request is cached insetRequestCache(ServerRequestCache)
-
-
Method Detail
-
setRequestCache
public void setRequestCache(ServerRequestCache requestCache)
Sets theServerRequestCacheused to redirect to. Default isWebSessionServerRequestCache.- Parameters:
requestCache- the cache to use
-
onAuthenticationSuccess
public reactor.core.publisher.Mono<java.lang.Void> onAuthenticationSuccess(WebFilterExchange webFilterExchange, org.springframework.security.core.Authentication authentication)
Description copied from interface:ServerAuthenticationSuccessHandlerInvoked when the application authenticates successfully- Specified by:
onAuthenticationSuccessin interfaceServerAuthenticationSuccessHandler- Parameters:
webFilterExchange- the exchangeauthentication- theAuthentication- Returns:
- a completion notification (success or error)
-
setLocation
public void setLocation(java.net.URI location)
Where the user is redirected to upon authentication success- Parameters:
location- the location to redirect to. The default is "/"
-
setRedirectStrategy
public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy)
The RedirectStrategy to use.- Parameters:
redirectStrategy- the strategy to use. Default is DefaultRedirectStrategy.
-
-