public class SpringSecurityLdapTemplate extends LdapTemplate
LdapTemplate.MappingCollectingNameClassPairCallbackHandler<T>, LdapTemplate.NullDirContextProcessor
Modifier and Type | Field and Description |
---|---|
static String |
DN_KEY
Every search results where a record is defined by a Map<String,String[]>
contains at least this key - the DN of the record itself.
|
static String[] |
NO_ATTRS |
Constructor and Description |
---|
SpringSecurityLdapTemplate(ContextSource contextSource) |
Modifier and Type | Method and Description |
---|---|
boolean |
compare(String dn,
String attributeName,
Object value)
Performs an LDAP compare operation of the value of an attribute for a particular
directory entry.
|
DirContextOperations |
retrieveEntry(String dn,
String[] attributesToRetrieve)
Composes an object from the attributes of the given DN.
|
Set<Map<String,List<String>>> |
searchForMultipleAttributeValues(String base,
String filter,
Object[] params,
String[] attributeNames)
Performs a search using the supplied filter and returns the values of each named
attribute found in all entries matched by the search.
|
Set<String> |
searchForSingleAttributeValues(String base,
String filter,
Object[] params,
String attributeName)
Performs a search using the supplied filter and returns the union of the values of
the named attribute found in all entries matched by the search.
|
DirContextOperations |
searchForSingleEntry(String base,
String filter,
Object[] params)
Performs a search, with the requirement that the search shall return a single
directory entry, and uses the supplied mapper to create the object from that entry.
|
static DirContextOperations |
searchForSingleEntryInternal(DirContext ctx,
SearchControls searchControls,
String base,
String filter,
Object[] params)
Internal method extracted to avoid code duplication in AD search.
|
void |
setSearchControls(SearchControls searchControls)
Sets the search controls which will be used for search operations by the template.
|
afterPropertiesSet, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, bind, bind, bind, create, delete, deleteRecursively, executeReadOnly, executeReadWrite, find, find, findAll, findAll, findByDn, findOne, getContextSource, getObjectDirectoryMapper, list, list, list, list, list, list, listBindings, listBindings, listBindings, listBindings, listBindings, listBindings, listBindings, listBindings, lookup, lookup, lookup, lookup, lookup, lookup, lookup, lookup, lookup, lookup, lookupContext, lookupContext, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, rebind, rename, rename, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, search, searchForContext, searchForObject, searchForObject, searchForObject, searchForObject, searchForObject, setContextSource, setDefaultCountLimit, setDefaultSearchScope, setDefaultTimeLimit, setIgnoreNameNotFoundException, setIgnorePartialResultException, setIgnoreSizeLimitExceededException, setObjectDirectoryMapper, unbind, unbind, unbind, unbind, update
public static final String[] NO_ATTRS
public static final String DN_KEY
public SpringSecurityLdapTemplate(ContextSource contextSource)
public boolean compare(String dn, String attributeName, Object value)
dn
- the entry who's attribute is to be usedattributeName
- the attribute who's value we want to comparevalue
- the value to be checked against the directory valuepublic DirContextOperations retrieveEntry(String dn, String[] attributesToRetrieve)
dn
- the directory entry which will be readattributesToRetrieve
- the named attributes which will be retrieved from the
directory entry.public Set<String> searchForSingleAttributeValues(String base, String filter, Object[] params, String attributeName)
base
- the DN to search infilter
- search filter to useparams
- the parameters to substitute in the search filterattributeName
- the attribute who's values are to be retrieved.public Set<Map<String,List<String>>> searchForMultipleAttributeValues(String base, String filter, Object[] params, String[] attributeNames)
base
- the DN to search infilter
- search filter to useparams
- the parameters to substitute in the search filterattributeNames
- the attributes' values that are to be retrieved.DN_KEY
.public DirContextOperations searchForSingleEntry(String base, String filter, Object[] params)
Ignores PartialResultException if thrown, for compatibility with Active
Directory (see LdapTemplate.setIgnorePartialResultException(boolean)
).
base
- the search base, relative to the base context supplied by the context
source.filter
- the LDAP search filterparams
- parameters to be substituted in the search.IncorrectResultSizeDataAccessException
- if no results are found or the
search returns more than one result.public static DirContextOperations searchForSingleEntryInternal(DirContext ctx, SearchControls searchControls, String base, String filter, Object[] params) throws NamingException
NamingException
public void setSearchControls(SearchControls searchControls)
searchControls
- the SearchControls instance which will be cached in the
template.