public class CommunoteLdapUserSearch extends Object implements org.springframework.security.ldap.search.LdapUserSearch
Constructor and Description |
---|
CommunoteLdapUserSearch(LdapConfiguration config,
LdapUserAttribute communoteAttributeName)
Creates a search for retrieving LDAP users.
|
CommunoteLdapUserSearch(LdapSearchConfiguration userSearchConfig,
LdapUserAttributesMapper mapper,
org.springframework.ldap.core.support.LdapContextSource context,
LdapUserAttribute communoteAttributeName,
String userLogin,
String userPassword)
Creates a search for retrieving LDAP users.
|
Modifier and Type | Method and Description |
---|---|
LdapUserAttributesMapper |
getUserAttributesMapper()
Returns the
LdapUserAttributesMapper used by the search. |
org.springframework.ldap.core.DirContextOperations |
searchForUser(String username) |
ExternalUserVO |
searchForUserTransformed(String username)
Same as
searchForUser(String) but automatically transforms the LdapUserDetails to
the VO by invoking transformResult(DirContextOperations) . |
ExternalUserVO |
transformResult(org.springframework.ldap.core.DirContextOperations details)
Transforms the LdapUserDetails into a VO.
|
public CommunoteLdapUserSearch(LdapConfiguration config, LdapUserAttribute communoteAttributeName) throws LdapAttributeMappingException
config
- the LDAP configurationcommunoteAttributeName
- the Communote attribute to be used for the searchForUser(String)
method.
A search for this attribute should return at most one user.LdapAttributeMappingException
- if it's not possible to create an LdapUserAttributesMapper
from the LDAP
configurationpublic CommunoteLdapUserSearch(LdapSearchConfiguration userSearchConfig, LdapUserAttributesMapper mapper, org.springframework.ldap.core.support.LdapContextSource context, LdapUserAttribute communoteAttributeName, String userLogin, String userPassword)
userSearchConfig
- the user search configuration of the LDAP configurationmapper
- the attributes mapper to be usedcontext
- the initialized JNDI context based on the provided LDAP configurationcommunoteAttributeName
- the Communote attribute to be used for the searchForUser(String)
method.
A search for this attribute should return at most one user.userLogin
- the login to use for querying the LDAP server. If null the configured managerDn
will be used.userPassword
- the password to use with the userLogin when querying the LDAP serverpublic LdapUserAttributesMapper getUserAttributesMapper()
LdapUserAttributesMapper
used by the search.public org.springframework.ldap.core.DirContextOperations searchForUser(String username)
searchForUser
in interface org.springframework.security.ldap.search.LdapUserSearch
public ExternalUserVO searchForUserTransformed(String username) throws LdapAttributeMappingException
searchForUser(String)
but automatically transforms the LdapUserDetails to
the VO by invoking transformResult(DirContextOperations)
.username
- the user name to search for. The search must not return more than one valueLdapAttributeMappingException
- if the transformation failsorg.springframework.security.core.userdetails.UsernameNotFoundException
- in case no user is foundorg.springframework.dao.IncorrectResultSizeDataAccessException
- in case more than users are foundpublic ExternalUserVO transformResult(org.springframework.ldap.core.DirContextOperations details) throws LdapAttributeMappingException
details
- the details to transformLdapAttributeMappingException
- if the transformation failsCopyright © 2019 Communote team. All rights reserved.