public abstract class AbstractSearchDnResolver extends AbstractSearchOperationFactory implements DnResolver
logger
Constructor and Description |
---|
AbstractSearchDnResolver() |
Modifier and Type | Method and Description |
---|---|
protected SearchFilter |
createSearchFilter(String user)
Returns a search filter using
userFilter and userFilterParameters . |
protected SearchRequest |
createSearchRequest(SearchFilter filter)
Returns a search request for searching for a single entry in an LDAP, returning no attributes.
|
boolean |
getAllowMultipleDns()
Returns whether DN resolution should fail if multiple DNs are found.
|
String |
getBaseDn()
Returns the base DN.
|
protected abstract Connection |
getConnection()
Retrieve a connection that is ready for use.
|
DerefAliases |
getDerefAliases()
Returns how to dereference aliases.
|
ReferralHandler |
getReferralHandler()
Returns the referral handler.
|
boolean |
getSubtreeSearch()
Returns whether subtree searching will be used.
|
String |
getUserFilter()
Returns the filter used to search for the user.
|
Object[] |
getUserFilterParameters()
Returns the filter parameters used to search for the user.
|
protected SearchResult |
performLdapSearch(SearchFilter filter)
Executes the ldap search operation with the supplied filter.
|
String |
resolve(String user)
Attempts to find the DN for the supplied user.
|
protected String |
resolveDn(LdapEntry entry)
Returns the DN for the supplied ldap entry.
|
void |
setAllowMultipleDns(boolean b)
Sets whether DN resolution should fail if multiple DNs are found.
|
void |
setBaseDn(String dn)
Sets the base DN.
|
void |
setDerefAliases(DerefAliases da)
Sets how to dereference aliases.
|
void |
setReferralHandler(ReferralHandler handler)
Sets the referral handler.
|
void |
setSubtreeSearch(boolean b)
Sets whether subtree searching will be used.
|
void |
setUserFilter(String filter)
Sets the filter used to search for the user.
|
void |
setUserFilterParameters(Object[] filterParams)
Sets the filter parameters used to search for the user.
|
createSearchOperation, getSearchCache, getSearchExceptionHandler, getSearchResponseHandlers, setSearchCache, setSearchExceptionHandler, setSearchResponseHandlers
public String getBaseDn()
public void setBaseDn(String dn)
dn
- base DNpublic String getUserFilter()
public void setUserFilter(String filter)
filter
- for searchingpublic Object[] getUserFilterParameters()
public void setUserFilterParameters(Object[] filterParams)
filterParams
- filter parameterspublic boolean getAllowMultipleDns()
public void setAllowMultipleDns(boolean b)
resolve(String)
finds more than one DN matching it's filter. Otherwise the first DN found is returned.b
- whether multiple DNs are allowedpublic boolean getSubtreeSearch()
public void setSubtreeSearch(boolean b)
getBaseDn()
. Otherwise the DN will be searched for in the getBaseDn()
context.b
- whether the DN will be searched for over the entire basepublic DerefAliases getDerefAliases()
public void setDerefAliases(DerefAliases da)
da
- how to dereference aliasespublic ReferralHandler getReferralHandler()
public void setReferralHandler(ReferralHandler handler)
handler
- referral handlerpublic String resolve(String user) throws LdapException
getUserFilter()
is used to look up the DN. The user is
provided as the 'user' variable filter parameter. If more than one entry matches the search, the result is
controlled by setAllowMultipleDns(boolean)
.resolve
in interface DnResolver
user
- to find DN forLdapException
- if the entry resolution failsprotected String resolveDn(LdapEntry entry)
entry
- to retrieve the DN fromprotected SearchFilter createSearchFilter(String user)
userFilter
and userFilterParameters
. The user parameter is injected
as a named parameter of 'user'.user
- identifierprotected SearchRequest createSearchRequest(SearchFilter filter)
filter
- to executeprotected SearchResult performLdapSearch(SearchFilter filter) throws LdapException
filter
- to executeLdapException
- if an error occursprotected abstract Connection getConnection() throws LdapException
LdapException
- if an error occurs opening the connectionCopyright © 2018. All rights reserved.