public abstract class AbstractSearchDnResolver extends AbstractSearchOperationFactory implements DnResolver
Modifier and Type | Field and Description |
---|---|
private boolean |
allowMultipleDns
Whether to throw an exception if multiple DNs are found.
|
private String |
baseDn
DN to search.
|
private DerefAliases |
derefAliases
How to handle aliases.
|
private ReferralHandler |
referralHandler
Referral handler.
|
private boolean |
subtreeSearch
Whether to use a subtree search when resolving DNs.
|
private String |
userFilter
Filter for searching for the user.
|
private Object[] |
userFilterParameters
Filter parameters for searching for the user.
|
logger
Constructor and Description |
---|
AbstractSearchDnResolver() |
Modifier and Type | Method and Description |
---|---|
protected SearchFilter |
createSearchFilter(User 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(User 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
private String baseDn
private String userFilter
private Object[] userFilterParameters
private boolean allowMultipleDns
private boolean subtreeSearch
private DerefAliases derefAliases
private ReferralHandler referralHandler
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(User)
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(User user) throws LdapException
createSearchFilter(User)
()} is used to create the search
filter. 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(User user)
userFilter
and userFilterParameters
. The user parameter is injected
as a named parameter of 'user'.user
- to resolve DNprotected 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 © 2003-2019 Virginia Tech. All Rights Reserved.