Package org.springframework.security.authentication

# Class AbstractUserDetailsReactiveAuthenticationManager

java.lang.Object
org.springframework.security.authentication.AbstractUserDetailsReactiveAuthenticationManager

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.context.MessageSourceAware`, `ReactiveAuthenticationManager`

Direct Known Subclasses:
  `UserDetailsRepositoryReactiveAuthenticationManager`

public abstract class AbstractUserDetailsReactiveAuthenticationManager extends Object implements ReactiveAuthenticationManager, org.springframework.context.MessageSourceAware
A base `ReactiveAuthenticationManager` that allows subclasses to override and work with `UserDetails` objects.

Upon successful validation, a `UsernamePasswordAuthenticationToken` will be created and returned to the caller. The token will include as its principal either a `String` representation of the username, or the `UserDetails` that was returned from the authentication repository.

Since:
  5.2

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final org.apache.commons.logging.Log`
`logger`
`protected org.springframework.context.support.MessageSourceAccessor`
`messages`

## Constructor Summary

Constructors
Constructor
Description
`AbstractUserDetailsReactiveAuthenticationManager()`

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Authentication>`
`authenticate(Authentication authentication)`
Attempts to authenticate the provided `Authentication`
`protected abstract reactor.core.publisher.Mono<UserDetails>`
`retrieveUser(String username)`
Allows subclasses to retrieve the `UserDetails` from an implementation-specific location.
`void`
`setCompromisedPasswordChecker(ReactiveCompromisedPasswordChecker compromisedPasswordChecker)`
Sets the `ReactiveCompromisedPasswordChecker` to be used before creating a successful authentication.
`void`
`setMessageSource(org.springframework.context.MessageSource messageSource)`
`void`
`setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)`
The `PasswordEncoder` that is used for validating the password.
`void`
`setPostAuthenticationChecks(UserDetailsChecker postAuthenticationChecks)`
Sets the strategy which will be used to validate the loaded `UserDetails` object after authentication occurs.
`void`
`setScheduler(reactor.core.scheduler.Scheduler scheduler)`
Sets the `Scheduler` used by the `UserDetailsRepositoryReactiveAuthenticationManager`.
`void`
`setUserDetailsPasswordService(ReactiveUserDetailsPasswordService userDetailsPasswordService)`
Sets the service to use for upgrading passwords on successful authentication.

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

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

## Field Details

### logger

protected final org.apache.commons.logging.Log logger

### messages

protected org.springframework.context.support.MessageSourceAccessor messages

## Constructor Details

### AbstractUserDetailsReactiveAuthenticationManager

public AbstractUserDetailsReactiveAuthenticationManager()

## Method Details

### authenticate

public reactor.core.publisher.Mono<Authentication> authenticate(Authentication authentication)
Description copied from interface: `ReactiveAuthenticationManager`
Attempts to authenticate the provided `Authentication`

Specified by:
  `authenticate` in interface `ReactiveAuthenticationManager`
Parameters:
  `authentication` - the `Authentication` to test
Returns:
  if authentication is successful an `Authentication` is returned. If authentication cannot be determined, an empty Mono is returned. If authentication fails, a Mono error is returned.

### setPasswordEncoder

public void setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
The `PasswordEncoder` that is used for validating the password. The default is `PasswordEncoderFactories.createDelegatingPasswordEncoder()`

Parameters:
  `passwordEncoder` - the `PasswordEncoder` to use. Cannot be null

### setScheduler

public void setScheduler(reactor.core.scheduler.Scheduler scheduler)
Sets the `Scheduler` used by the `UserDetailsRepositoryReactiveAuthenticationManager`. The default is `Schedulers.newParallel(String)` because modern password encoding is a CPU intensive task that is non blocking. This means validation is bounded by the number of CPUs. Some applications may want to customize the `Scheduler`. For example, if users are stuck using the insecure `NoOpPasswordEncoder` they might want to leverage `Schedulers.immediate()`.

Parameters:
  `scheduler` - the `Scheduler` to use. Cannot be null.
Since:
  5.0.6

### setUserDetailsPasswordService

public void setUserDetailsPasswordService(ReactiveUserDetailsPasswordService userDetailsPasswordService)
Sets the service to use for upgrading passwords on successful authentication.

Parameters:
  `userDetailsPasswordService` - the service to use

### setPostAuthenticationChecks

public void setPostAuthenticationChecks(UserDetailsChecker postAuthenticationChecks)
Sets the strategy which will be used to validate the loaded `UserDetails` object after authentication occurs.

Parameters:
  `postAuthenticationChecks` - The `UserDetailsChecker`
Since:
  5.2

### setMessageSource

public void setMessageSource(org.springframework.context.MessageSource messageSource)

Specified by:
  `setMessageSource` in interface `org.springframework.context.MessageSourceAware`
Since:
  5.5

### setCompromisedPasswordChecker

public void setCompromisedPasswordChecker(ReactiveCompromisedPasswordChecker compromisedPasswordChecker)
Sets the `ReactiveCompromisedPasswordChecker` to be used before creating a successful authentication. Defaults to `null`.

Parameters:
  `compromisedPasswordChecker` - the `CompromisedPasswordChecker` to use
Since:
  6.3

### retrieveUser

protected abstract reactor.core.publisher.Mono<UserDetails> retrieveUser(String username)
Allows subclasses to retrieve the `UserDetails` from an implementation-specific location.

Parameters:
  `username` - The username to retrieve
Returns:
  the user information. If authentication fails, a Mono error is returned.