public class LdapUserDetailsService extends Object implements org.springframework.security.core.userdetails.UserDetailsService
UserDetailsService implementation that obtains user details from an LDAP search.
Two searches are performed by this component for every user details lookup:
setAllowMultipleResults(boolean) property may be toggled to change that behavior.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ROLE_PREFIX
Default role prefix.
|
static String |
UNKNOWN_PASSWORD
Placeholder for unknown password given to user details.
|
| Constructor and Description |
|---|
LdapUserDetailsService(org.ldaptive.ConnectionFactory factory,
org.ldaptive.SearchExecutor userSearchExecutor,
org.ldaptive.SearchExecutor roleSearchExecutor,
String userAttributeName,
String roleAttributeName)
Creates a new instance with the given required parameters.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.security.core.userdetails.UserDetails |
loadUserByUsername(String username) |
void |
setAllowMultipleResults(boolean allowMultiple)
Sets whether to allow multiple search results for user details given a username.
|
void |
setRolePrefix(String rolePrefix)
Sets the prefix appended to the uppercase
roleAttributeName per the normal Spring Security convention. |
public static final String DEFAULT_ROLE_PREFIX
public static final String UNKNOWN_PASSWORD
public LdapUserDetailsService(org.ldaptive.ConnectionFactory factory,
org.ldaptive.SearchExecutor userSearchExecutor,
org.ldaptive.SearchExecutor roleSearchExecutor,
String userAttributeName,
String roleAttributeName)
factory - Source of LDAP connections for searches.userSearchExecutor - Executes the LDAP search for user data.roleSearchExecutor - Executes the LDAP search for role data.userAttributeName - Name of LDAP attribute that contains username for user details.roleAttributeName - Name of LDAP attribute that contains role membership data for the user.public void setRolePrefix(String rolePrefix)
roleAttributeName per the normal Spring Security convention.
The default value "ROLE_" is sufficient in most cases.rolePrefix - Role prefix.public void setAllowMultipleResults(boolean allowMultiple)
allowMultiple - True to allow multiple search results in which case the first result
returned is used to construct user details, or false to indicate that
a runtime exception should be raised on multiple search results for user details.public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username)
loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsServiceCopyright © 2004-2015 Jasig. All Rights Reserved.