org.springframework.security.config.annotation.authentication.configurers.userdetails
Class UserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>,U extends UserDetailsService>

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,U>
Type Parameters:
B - the type of the SecurityBuilder
C - the SecurityConfigurer (or this)
U - the type of UserDetailsService being used to allow for returning the concrete UserDetailsService.
All Implemented Interfaces:
SecurityConfigurer<AuthenticationManager,B>
Direct Known Subclasses:
UserDetailsManagerConfigurer

public class UserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsServiceConfigurer<B,C,U>,U extends UserDetailsService>
extends UserDetailsAwareConfigurer<B,U>

Allows configuring a UserDetailsService within a AuthenticationManagerBuilder.

Since:
3.2

Constructor Summary
UserDetailsServiceConfigurer(U userDetailsService)
          Creates a new instance
 
Method Summary
 void configure(B builder)
          Configure the SecurityBuilder by setting the necessary properties on the SecurityBuilder.
 U getUserDetailsService()
          Gets the UserDetailsService that is used with the DaoAuthenticationProvider
protected  void initUserDetailsService()
          Allows subclasses to initialize the UserDetailsService.
 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.
 
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

UserDetailsServiceConfigurer

public UserDetailsServiceConfigurer(U userDetailsService)
Creates a new instance

Parameters:
userDetailsService - the UserDetailsService that should be used
Method Detail

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<AuthenticationManager,B extends ProviderManagerBuilder<B>>
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

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