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

# Class UserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>,U extends org.springframework.security.core.userdetails.UserDetailsService>

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,U>

Type Parameters:
  `B` - the type of the `ProviderManagerBuilder`
  `C` - the `UserDetailsServiceConfigurer` (or this)
  `U` - the type of UserDetailsService being used to allow for returning the concrete UserDetailsService.

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

Direct Known Subclasses:
  `UserDetailsManagerConfigurer`

public class UserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>,U extends org.springframework.security.core.userdetails.UserDetailsService> extends AbstractDaoAuthenticationConfigurer<B,C,U>
Allows configuring a `UserDetailsService` within a `AuthenticationManagerBuilder`.

Since:
  3.2

## Constructor Summary

Constructors
Constructor
Description
`UserDetailsServiceConfigurer(U userDetailsService)`
Creates a new instance

## Method Summary

Modifier and Type
Method
Description
`void`
`configure(B builder)`
Configure the `SecurityBuilder` by setting the necessary properties on the `SecurityBuilder`.
`protected void`
`initUserDetailsService()`
Allows subclasses to initialize the `UserDetailsService`.

### 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

### UserDetailsServiceConfigurer

public UserDetailsServiceConfigurer(U userDetailsService)
Creates a new instance

Parameters:
  `userDetailsService` - the `UserDetailsService` that should be used

## Method Details

### configure

public void configure(B builder) throws Exception
Description copied from interface: `SecurityConfigurer`
Configure the `SecurityBuilder` by setting the necessary properties on the `SecurityBuilder`.

Specified by:
  `configure` in interface `SecurityConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>>`
Overrides:
  `configure` in class `AbstractDaoAuthenticationConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>,U extends org.springframework.security.core.userdetails.UserDetailsService>`
Throws:
  `Exception`

### initUserDetailsService

protected void initUserDetailsService() throws Exception
Allows subclasses to initialize the `UserDetailsService`. For example, it might add users, initialize schema, etc.

Throws:
  `Exception`