org.springframework.security.config.annotation.authentication.configurers.provisioning
Class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>

java.lang.Object
  extended by org.springframework.security.config.annotation.SecurityConfigurerAdapter<AuthenticationManager,B>
      extended by org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsAwareConfigurer<B,U>
          extended by org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsServiceConfigurer<B,C,UserDetailsManager>
              extended by 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<AuthenticationManager,B>
Direct Known Subclasses:
InMemoryUserDetailsManagerConfigurer, JdbcUserDetailsManagerConfigurer

public class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>
extends UserDetailsServiceConfigurer<B,C,UserDetailsManager>

Base class for populating an AuthenticationManagerBuilder with a UserDetailsManager.

Since:
3.2

Nested Class Summary
 class UserDetailsManagerConfigurer.UserDetailsBuilder
          Builds the user to be added.
 
Constructor Summary
protected UserDetailsManagerConfigurer(UserDetailsManager userDetailsManager)
           
 
Method Summary
 U getUserDetailsService()
          Gets the UserDetailsService that is used with the DaoAuthenticationProvider
protected  void initUserDetailsService()
          Populates the users that have been added.
 C passwordEncoder(PasswordEncoder passwordEncoder)
          Allows specifying the PasswordEncoder to use with the DaoAuthenticationProvider.
 C passwordEncoder(PasswordEncoder passwordEncoder)
          Allows specifying the PasswordEncoder to use with the DaoAuthenticationProvider.
 C withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
          Adds an ObjectPostProcessor for this class.
 UserDetailsManagerConfigurer.UserDetailsBuilder withUser(String username)
          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.SecurityConfigurerAdapter
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 Detail

UserDetailsManagerConfigurer

protected UserDetailsManagerConfigurer(UserDetailsManager userDetailsManager)
Method Detail

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>,UserDetailsManager>
Throws:
Exception

withUser

public final UserDetailsManagerConfigurer.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:

withObjectPostProcessor

public C withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds an ObjectPostProcessor for this class.

Parameters:
objectPostProcessor -
Returns:
the AbstractDaoAuthenticationConfigurer for further customizations

passwordEncoder

public C passwordEncoder(PasswordEncoder passwordEncoder)
Allows specifying the PasswordEncoder to use with the DaoAuthenticationProvider. The default is is to use plain text.

Parameters:
passwordEncoder - The PasswordEncoder to use.
Returns:

passwordEncoder

public C passwordEncoder(PasswordEncoder passwordEncoder)
Allows specifying the PasswordEncoder to use with the DaoAuthenticationProvider. The default is is to use plain text.

Parameters:
passwordEncoder - The PasswordEncoder to use.
Returns:
the SecurityConfigurer for further customizations

getUserDetailsService

public U getUserDetailsService()
Gets the UserDetailsService that is used with the DaoAuthenticationProvider

Specified by:
getUserDetailsService in class UserDetailsAwareConfigurer<B extends ProviderManagerBuilder<B>,U extends UserDetailsService>
Returns:
the UserDetailsService that is used with the DaoAuthenticationProvider