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

# Class RedirectServerAuthenticationFailureHandler

java.lang.Object
org.springframework.security.web.server.authentication.RedirectServerAuthenticationFailureHandler

All Implemented Interfaces:
  `ServerAuthenticationFailureHandler`

public class RedirectServerAuthenticationFailureHandler extends Object implements ServerAuthenticationFailureHandler
Performs a redirect to a specified location.

Since:
  5.0

## Constructor Summary

Constructors
Constructor
Description
`RedirectServerAuthenticationFailureHandler(String location)`
Creates an instance

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
`onAuthenticationFailure(WebFilterExchange webFilterExchange, org.springframework.security.core.AuthenticationException exception)`
Invoked when authentication attempt fails
`void`
`setRedirectStrategy(ServerRedirectStrategy redirectStrategy)`
Sets the RedirectStrategy to use.

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

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

## Constructor Details

### RedirectServerAuthenticationFailureHandler

public RedirectServerAuthenticationFailureHandler(String location)
Creates an instance

Parameters:
  `location` - the location to redirect to (i.e. "/login?failed")

## Method Details

### setRedirectStrategy

public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy)
Sets the RedirectStrategy to use.

Parameters:
  `redirectStrategy` - the strategy to use. Default is DefaultRedirectStrategy.

### onAuthenticationFailure

public reactor.core.publisher.Mono<Void> onAuthenticationFailure(WebFilterExchange webFilterExchange, org.springframework.security.core.AuthenticationException exception)
Description copied from interface: `ServerAuthenticationFailureHandler`
Invoked when authentication attempt fails

Specified by:
  `onAuthenticationFailure` in interface `ServerAuthenticationFailureHandler`
Parameters:
  `webFilterExchange` - the exchange
  `exception` - the reason authentication failed
Returns:
  a completion notification (success or error)