Class RedirectServerAuthenticationSuccessHandler
java.lang.Object
org.springframework.security.web.server.authentication.RedirectServerAuthenticationSuccessHandler
- All Implemented Interfaces:
ServerAuthenticationSuccessHandler
public class RedirectServerAuthenticationSuccessHandler
extends 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
ConstructorsConstructorDescriptionCreates a new instance with location of "/"Creates a new instance with the specified location -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>onAuthenticationSuccess(WebFilterExchange webFilterExchange, Authentication authentication) Invoked when the application authenticates successfullyvoidsetLocation(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 Details
-
RedirectServerAuthenticationSuccessHandler
public RedirectServerAuthenticationSuccessHandler()Creates a new instance with location of "/" -
RedirectServerAuthenticationSuccessHandler
Creates a new instance with the specified location- Parameters:
location- the location to redirect if the no request is cached insetRequestCache(ServerRequestCache)
-
-
Method Details
-
setRequestCache
Sets theServerRequestCacheused to redirect to. Default isWebSessionServerRequestCache.- Parameters:
requestCache- the cache to use
-
onAuthenticationSuccess
public reactor.core.publisher.Mono<Void> onAuthenticationSuccess(WebFilterExchange webFilterExchange, 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
Where the user is redirected to upon authentication success- Parameters:
location- the location to redirect to. The default is "/"
-
setRedirectStrategy
The RedirectStrategy to use.- Parameters:
redirectStrategy- the strategy to use. Default is DefaultRedirectStrategy.
-