Package org.springframework.security.config.annotation.authentication.configurers.provisioning

# Class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>

java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.authentication.AuthenticationManager,B>
org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsAwareConfigurer<B,U>
org.springframework.security.config.annotation.authentication.configurers.userdetails.AbstractDaoAuthenticationConfigurer<B,C,U>
org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsServiceConfigurer<B,C,org.springframework.security.provisioning.UserDetailsManager>
org.springframework.security.config.annotation.authentication.configurers.provisioning.UserDetailsManagerConfigurer<B,C>

Type Parameters:
  `B` - the type of the `SecurityBuilder` that is being configured
  `C` - the type of `UserDetailsManagerConfigurer`

All Implemented Interfaces:
  `SecurityConfigurer<org.springframework.security.authentication.AuthenticationManager,B>`

Direct Known Subclasses:
  `InMemoryUserDetailsManagerConfigurer`, `JdbcUserDetailsManagerConfigurer`

public class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>> extends UserDetailsServiceConfigurer<B,C,org.springframework.security.provisioning.UserDetailsManager>
Base class for populating an `AuthenticationManagerBuilder` with a `UserDetailsManager`.

Since:
  3.2

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`final class`
`UserDetailsManagerConfigurer.UserDetailsBuilder`
Builds the user to be added.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`UserDetailsManagerConfigurer(org.springframework.security.provisioning.UserDetailsManager userDetailsManager)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`initUserDetailsService()`
Populates the users that have been added.
`final UserDetailsManagerConfigurer<B,C>.UserDetailsBuilder`
`withUser(String username)`
Allows adding a user to the `UserDetailsManager` that is being created.
`final C`
`withUser(org.springframework.security.core.userdetails.User.UserBuilder userBuilder)`
Allows adding a user to the `UserDetailsManager` that is being created.
`final C`
`withUser(org.springframework.security.core.userdetails.UserDetails userDetails)`
Allows adding a user to the `UserDetailsManager` that is being created.

### Methods inherited from class org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsServiceConfigurer

`configure`

### Methods inherited from class org.springframework.security.config.annotation.authentication.configurers.userdetails.AbstractDaoAuthenticationConfigurer

`getUserDetailsService, passwordEncoder, userDetailsPasswordManager, withObjectPostProcessor, withObjectPostProcessor`

### Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter

`addObjectPostProcessor, addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder`

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

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

## Constructor Details

### UserDetailsManagerConfigurer

protected UserDetailsManagerConfigurer(org.springframework.security.provisioning.UserDetailsManager userDetailsManager)

## Method Details

### initUserDetailsService

protected void initUserDetailsService() throws Exception
Populates the users that have been added.

Overrides:
  `initUserDetailsService` in class `UserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>,org.springframework.security.provisioning.UserDetailsManager>`
Throws:
  `Exception`

### withUser

public final C withUser(org.springframework.security.core.userdetails.UserDetails userDetails)
Allows adding a user to the `UserDetailsManager` that is being created. This method can be invoked multiple times to add multiple users.

Parameters:
  `userDetails` - the user to add. Cannot be null.
Returns:
  the `UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>.UserDetailsBuilder` for further customizations

### withUser

public final C withUser(org.springframework.security.core.userdetails.User.UserBuilder userBuilder)
Allows adding a user to the `UserDetailsManager` that is being created. This method can be invoked multiple times to add multiple users.

Parameters:
  `userBuilder` - the user to add. Cannot be null.
Returns:
  the `UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>.UserDetailsBuilder` for further customizations

### withUser

public final UserDetailsManagerConfigurer<B,C>.UserDetailsBuilder withUser(String username)
Allows adding a user to the `UserDetailsManager` that is being created. This method can be invoked multiple times to add multiple users.

Parameters:
  `username` - the username for the user being added. Cannot be null.
Returns:
  the `UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>.UserDetailsBuilder` for further customizations