public abstract class AbstractSearchEntryResolver extends AbstractSearchOperationFactory implements EntryResolver
AuthenticationCriteria.getDn()
if no userFilter
is configured. If a userFilter
is configured, then
a search is executed using that filter.Modifier and Type | Field and Description |
---|---|
private boolean |
allowMultipleEntries
Whether to throw an exception if multiple entries are found.
|
private String |
baseDn
DN to search.
|
private DerefAliases |
derefAliases
How to handle aliases.
|
private SearchEntryHandler[] |
entryHandlers
Ldap entry handlers.
|
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 |
---|
AbstractSearchEntryResolver() |
Modifier and Type | Method and Description |
---|---|
protected SearchFilter |
createSearchFilter(AuthenticationCriteria ac)
Returns a search filter using
userFilter and userFilterParameters . |
protected SearchRequest |
createSearchRequest(AuthenticationCriteria ac)
Returns a search request for the supplied authentication criteria.
|
boolean |
getAllowMultipleEntries()
Returns whether entry resolution should fail if multiple entries are found.
|
String |
getBaseDn()
Returns the base DN.
|
DerefAliases |
getDerefAliases()
Returns how to dereference aliases.
|
ReferralHandler |
getReferralHandler()
Returns the referral handler.
|
SearchEntryHandler[] |
getSearchEntryHandlers()
Returns the search entry handlers.
|
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 abstract SearchResult |
performLdapSearch(AuthenticationCriteria criteria,
AuthenticationHandlerResponse response)
Executes an ldap search with the supplied authentication criteria.
|
LdapEntry |
resolve(AuthenticationCriteria criteria,
AuthenticationHandlerResponse response)
Attempts to find the LDAP entry for the supplied authentication criteria and authentication handler response.
|
void |
setAllowMultipleEntries(boolean b)
Sets whether entry resolution should fail if multiple entries 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 |
setSearchEntryHandlers(SearchEntryHandler... handlers)
Sets the search entry handlers.
|
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 allowMultipleEntries
private boolean subtreeSearch
private DerefAliases derefAliases
private ReferralHandler referralHandler
private SearchEntryHandler[] entryHandlers
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 getAllowMultipleEntries()
public void setAllowMultipleEntries(boolean b)
resolve(AuthenticationCriteria, AuthenticationHandlerResponse)
finds more than one entry matching it's
filter. Otherwise the first entry found is returned.b
- whether multiple entries are allowedpublic boolean getSubtreeSearch()
public void setSubtreeSearch(boolean b)
getBaseDn()
. Otherwise the entry will be searched for in the getBaseDn()
context.b
- whether the entry 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 SearchEntryHandler[] getSearchEntryHandlers()
public void setSearchEntryHandlers(SearchEntryHandler... handlers)
handlers
- search entry handlersprotected abstract SearchResult performLdapSearch(AuthenticationCriteria criteria, AuthenticationHandlerResponse response) throws LdapException
criteria
- authentication criteria associated with the userresponse
- response from the authentication eventLdapException
- if an error occurs attempting the searchprotected SearchFilter createSearchFilter(AuthenticationCriteria ac)
userFilter
and userFilterParameters
. User.getIdentifier()
is injected with a named parameter of 'user', User.getContext()
is injected with a
named parameter of 'context', and AuthenticationCriteria.getDn()
is injected with a named parameter of
'dn'.ac
- authentication criteriaprotected SearchRequest createSearchRequest(AuthenticationCriteria ac)
userFilter
is defined then an
object level search on the authentication criteria DN is returned. Otherwise the userFilter
, baseDn
and subtreeSearch
are used to create the search request.ac
- authentication criteria containing a DNpublic LdapEntry resolve(AuthenticationCriteria criteria, AuthenticationHandlerResponse response) throws LdapException
EntryResolver
resolve
in interface EntryResolver
criteria
- authentication criteria used to perform the authenticationresponse
- produced by the authentication handlerLdapException
- if an LDAP error occursCopyright © 2003-2019 Virginia Tech. All Rights Reserved.