Class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<AuthenticationManager,B>
-
- org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsAwareConfigurer<B,U>
-
- org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsServiceConfigurer<B,C,UserDetailsManager>
-
- org.springframework.security.config.annotation.authentication.configurers.provisioning.UserDetailsManagerConfigurer<B,C>
-
- Type Parameters:
B
- the type of theSecurityBuilder
that is being configuredC
- the type ofUserDetailsManagerConfigurer
- 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 anAuthenticationManagerBuilder
with aUserDetailsManager
.- Since:
- 3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
UserDetailsManagerConfigurer.UserDetailsBuilder
Builds the user to be added.
-
Constructor Summary
Constructors Modifier Constructor Description protected
UserDetailsManagerConfigurer(UserDetailsManager userDetailsManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description U
getUserDetailsService()
Gets theUserDetailsService
that is used with theDaoAuthenticationProvider
protected void
initUserDetailsService()
Populates the users that have been added.C
passwordEncoder(PasswordEncoder passwordEncoder)
Allows specifying thePasswordEncoder
to use with theDaoAuthenticationProvider
.C
userDetailsPasswordManager(UserDetailsPasswordService passwordManager)
C
withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds anObjectPostProcessor
for this class.UserDetailsManagerConfigurer.UserDetailsBuilder
withUser(java.lang.String username)
Allows adding a user to theUserDetailsManager
that is being created.C
withUser(User.UserBuilder userBuilder)
Allows adding a user to theUserDetailsManager
that is being created.C
withUser(UserDetails userDetails)
Allows adding a user to theUserDetailsManager
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
-
-
-
-
Constructor Detail
-
UserDetailsManagerConfigurer
protected UserDetailsManagerConfigurer(UserDetailsManager userDetailsManager)
-
-
Method Detail
-
initUserDetailsService
protected void initUserDetailsService() throws java.lang.Exception
Populates the users that have been added.- Overrides:
initUserDetailsService
in classUserDetailsServiceConfigurer<B extends ProviderManagerBuilder<B>,C extends UserDetailsManagerConfigurer<B,C>,UserDetailsManager>
- Throws:
java.lang.Exception
-
withUser
public final C withUser(UserDetails userDetails)
Allows adding a user to theUserDetailsManager
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.UserDetailsBuilder
for further customizations
-
withUser
public final C withUser(User.UserBuilder userBuilder)
Allows adding a user to theUserDetailsManager
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.UserDetailsBuilder
for further customizations
-
withUser
public final UserDetailsManagerConfigurer.UserDetailsBuilder withUser(java.lang.String username)
Allows adding a user to theUserDetailsManager
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.UserDetailsBuilder
for further customizations
-
withObjectPostProcessor
public C withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds anObjectPostProcessor
for this class.- Parameters:
objectPostProcessor
-- Returns:
- the
AbstractDaoAuthenticationConfigurer
for further customizations
-
passwordEncoder
public C passwordEncoder(PasswordEncoder passwordEncoder)
Allows specifying thePasswordEncoder
to use with theDaoAuthenticationProvider
. The default is to use plain text.- Parameters:
passwordEncoder
- ThePasswordEncoder
to use.- Returns:
- the
AbstractDaoAuthenticationConfigurer
for further customizations
-
userDetailsPasswordManager
public C userDetailsPasswordManager(UserDetailsPasswordService passwordManager)
-
getUserDetailsService
public U getUserDetailsService()
Gets theUserDetailsService
that is used with theDaoAuthenticationProvider
- Specified by:
getUserDetailsService
in classUserDetailsAwareConfigurer<B extends ProviderManagerBuilder<B>,U extends UserDetailsService>
- Returns:
- the
UserDetailsService
that is used with theDaoAuthenticationProvider
-
-