Package org.springframework.security.web.server.authentication

# 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

Constructors
Constructor
Description
`RedirectServerAuthenticationSuccessHandler()`
Creates a new instance with location of "/"
`RedirectServerAuthenticationSuccessHandler(String location)`
Creates a new instance with the specified location

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
`onAuthenticationSuccess(WebFilterExchange webFilterExchange, org.springframework.security.core.Authentication authentication)`
Invoked when the application authenticates successfully
`void`
`setLocation(URI location)`
Where the user is redirected to upon authentication success
`void`
`setRedirectStrategy(ServerRedirectStrategy redirectStrategy)`
The RedirectStrategy to use.
`void`
`setRequestCache(ServerRequestCache requestCache)`
Sets the `ServerRequestCache` used to redirect to.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RedirectServerAuthenticationSuccessHandler

public RedirectServerAuthenticationSuccessHandler()
Creates a new instance with location of "/"

### RedirectServerAuthenticationSuccessHandler

public RedirectServerAuthenticationSuccessHandler(String location)
Creates a new instance with the specified location

Parameters:
  `location` - the location to redirect if the no request is cached in `setRequestCache(ServerRequestCache)`

## Method Details

### setRequestCache

public void setRequestCache(ServerRequestCache requestCache)
Sets the `ServerRequestCache` used to redirect to. Default is `WebSessionServerRequestCache`.

Parameters:
  `requestCache` - the cache to use

### onAuthenticationSuccess

public reactor.core.publisher.Mono<Void> onAuthenticationSuccess(WebFilterExchange webFilterExchange, org.springframework.security.core.Authentication authentication)
Description copied from interface: `ServerAuthenticationSuccessHandler`
Invoked when the application authenticates successfully

Specified by:
  `onAuthenticationSuccess` in interface `ServerAuthenticationSuccessHandler`
Parameters:
  `webFilterExchange` - the exchange
  `authentication` - the `Authentication`
Returns:
  a completion notification (success or error)

### setLocation

public void setLocation(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.