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
ConstructorDescriptionCreates 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 successfullyvoid
setLocation
(URI location) Where the user is redirected to upon authentication successvoid
setRedirectStrategy
(ServerRedirectStrategy redirectStrategy) The RedirectStrategy to use.void
setRequestCache
(ServerRequestCache requestCache) Sets theServerRequestCache
used 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 theServerRequestCache
used 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:ServerAuthenticationSuccessHandler
Invoked when the application authenticates successfully- Specified by:
onAuthenticationSuccess
in 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.
-