B
- the ProviderManagerBuilder
type that this is configuring.public class LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuilder<B>> extends SecurityConfigurerAdapter<AuthenticationManager,B>
AuthenticationProvider
in the ProviderManagerBuilder
.Modifier and Type | Class and Description |
---|---|
class |
LdapAuthenticationProviderConfigurer.ContextSourceBuilder
Allows building a
BaseLdapPathContextSource and optionally creating an
embedded LDAP instance. |
class |
LdapAuthenticationProviderConfigurer.PasswordCompareConfigurer
Sets up Password based comparison
|
Constructor and Description |
---|
LdapAuthenticationProviderConfigurer() |
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
public LdapAuthenticationProviderConfigurer()
public LdapAuthenticationProviderConfigurer<B> ldapAuthoritiesPopulator(LdapAuthoritiesPopulator ldapAuthoritiesPopulator)
LdapAuthoritiesPopulator
.ldapAuthoritiesPopulator
- the LdapAuthoritiesPopulator
the default is
DefaultLdapAuthoritiesPopulator
LdapAuthenticationProviderConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
ObjectPostProcessor
for this class.objectPostProcessor
- ChannelSecurityConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> authoritiesMapper(GrantedAuthoritiesMapper grantedAuthoritiesMapper)
GrantedAuthoritiesMapper
.grantedAuthoritiesMapper
- the GrantedAuthoritiesMapper
the default is SimpleAuthorityMapper
LdapAuthenticationProviderConfigurer
for further customizationsprotected GrantedAuthoritiesMapper getAuthoritiesMapper() throws Exception
GrantedAuthoritiesMapper
and defaults to SimpleAuthorityMapper
.GrantedAuthoritiesMapper
Exception
- if errors in SimpleAuthorityMapper.afterPropertiesSet()
public LdapAuthenticationProviderConfigurer<B> contextSource(BaseLdapPathContextSource contextSource)
BaseLdapPathContextSource
to be used. If not specified, an
embedded LDAP server will be created using contextSource()
.contextSource
- the BaseLdapPathContextSource
to useLdapAuthenticationProviderConfigurer
for further customizationscontextSource()
public LdapAuthenticationProviderConfigurer.ContextSourceBuilder contextSource()
BaseLdapPathContextSource
with defaults
pointing to an embedded LDAP server that is created.LdapAuthenticationProviderConfigurer.ContextSourceBuilder
for further customizationspublic LdapAuthenticationProviderConfigurer<B> passwordEncoder(PasswordEncoder passwordEncoder)
passwordEncoder(org.springframework.security.crypto.password.PasswordEncoder)
insteadPasswordEncoder
to be used when authenticating with password
comparison.passwordEncoder
- the PasswordEncoder
to useLdapAuthenticationProviderConfigurer
for further customizationpublic LdapAuthenticationProviderConfigurer<B> passwordEncoder(PasswordEncoder passwordEncoder)
PasswordEncoder
to be used when authenticating with password comparison.passwordEncoder
- the
PasswordEncoder
to useLdapAuthenticationProviderConfigurer
for further customizationpublic LdapAuthenticationProviderConfigurer<B> userDnPatterns(String... userDnPatterns)
userDnPatterns
- the LDAP patterns for finding the usernamesLdapAuthenticationProviderConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> userDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper)
userDetailsContextMapper
- the UserDetailsContextMapper
to useLdapAuthenticationProviderConfigurer
for further customizationsPersonContextMapper
,
InetOrgPersonContextMapper
,
LdapUserDetailsMapper
public LdapAuthenticationProviderConfigurer<B> groupRoleAttribute(String groupRoleAttribute)
groupRoleAttribute
- the attribute name that maps a group to a role.public LdapAuthenticationProviderConfigurer<B> groupSearchBase(String groupSearchBase)
groupSearchBase
- LdapAuthenticationProviderConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> groupSearchFilter(String groupSearchFilter)
groupSearchFilter
- the LDAP filter to search for groupsLdapAuthenticationProviderConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> rolePrefix(String rolePrefix)
rolePrefix
- the prefix to be added to the roles that are loaded.LdapAuthenticationProviderConfigurer
for further customizationsSimpleAuthorityMapper.setPrefix(String)
public LdapAuthenticationProviderConfigurer<B> userSearchBase(String userSearchBase)
userSearchFilter(String)
.userSearchBase
- search base for user searchesLdapAuthenticationProviderConfigurer
for further customizationspublic LdapAuthenticationProviderConfigurer<B> userSearchFilter(String userSearchFilter)
userSearchFilter
- the LDAP filter used to search for usersLdapAuthenticationProviderConfigurer
for further customizationspublic void configure(B builder) throws Exception
SecurityConfigurer
SecurityBuilder
by setting the necessary properties on the
SecurityBuilder
.configure
in interface SecurityConfigurer<AuthenticationManager,B extends ProviderManagerBuilder<B>>
configure
in class SecurityConfigurerAdapter<AuthenticationManager,B extends ProviderManagerBuilder<B>>
Exception
public LdapAuthenticationProviderConfigurer.PasswordCompareConfigurer passwordCompare()