public class LdapDataConnector extends BaseDataConnector
LdapDataConnector
provides a plugin to retrieve attributes from an LDAP.Modifier and Type | Class and Description |
---|---|
static class |
LdapDataConnector.AUTHENTICATION_TYPE
Authentication type values.
|
protected class |
LdapDataConnector.LDAPValueEscapingStrategy
Escapes values that will be included within an LDAP filter.
|
Constructor and Description |
---|
LdapDataConnector(LdapPoolStrategy pool,
net.sf.ehcache.Cache cache)
This creates a new LDAP data connector with the supplied properties.
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,BaseAttribute> |
buildBaseAttributes(Iterator<SearchResult> results)
This returns a map of attribute ids to attributes from the supplied search results.
|
protected void |
cacheResult(String searchFilter,
Map<String,BaseAttribute> attributes)
This stores the supplied attributes in the cache.
|
protected void |
clearCache()
Removes all entries from the cache if results are being cached.
|
String |
getFilterTemplate()
Gets the template used to create queries.
|
LdapPoolStrategy |
getLdapPool()
This returns the ldap pool strategy this connector is using.
|
String[] |
getReturnAttributes()
This returns the attributes that all searches will request from the ldap.
|
TemplateEngine |
getTemplateEngine()
Gets the engine used to evaluate the query template.
|
boolean |
isCacheResults()
This returns whether this connector will cache search results.
|
boolean |
isNoResultsIsError()
This returns whether this connector will throw an exception if no search results are found.
|
void |
registerTemplate(TemplateEngine engine,
String template)
This sets the underlying template engine and registers the supplied template.
|
Map<String,BaseAttribute> |
resolve(ShibbolethResolutionContext resolutionContext)
Performs the attribute resolution for this plugin.
|
protected Map<String,BaseAttribute> |
retrieveAttributesFromCache(String searchFilter)
This retrieves any cached attributes for the supplied resolution context.
|
protected Iterator<SearchResult> |
searchLdap(String searchFilter)
This searches the LDAP with the supplied filter.
|
void |
setNoResultsIsError(boolean isError)
This sets whether this connector will throw an exception if no search results are found.
|
void |
setReturnAttributes(String s)
This sets the attributes that all searches will request from the ldap.
|
void |
setReturnAttributes(String[] attributes)
This sets the attributes that all searches will request from the ldap.
|
void |
validate()
Validate the internal state of this plug-in.
|
getFailoverDependencyId, setFailoverDependencyIds
getDependencyIds, getId, getValuesFromAllDependencies, getValuesFromAttributeDependency, getValuesFromConnectorDependency, setId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDependencyIds, getId
public LdapDataConnector(LdapPoolStrategy pool, net.sf.ehcache.Cache cache)
pool
- LDAP connection pooling strategycache
- cached used to cache search results, or null if results should not be cachedpublic void registerTemplate(TemplateEngine engine, String template)
engine
- engine used to fill in search filter templatestemplate
- search filter templateprotected void clearCache()
public boolean isCacheResults()
public boolean isNoResultsIsError()
public void setNoResultsIsError(boolean isError)
isError
- true if searches which return no results are considered an error, false otherwisepublic TemplateEngine getTemplateEngine()
public String getFilterTemplate()
public LdapPoolStrategy getLdapPool()
public String[] getReturnAttributes()
String[]
public void setReturnAttributes(String[] attributes)
attributes
- String[]
clearCache()
public void setReturnAttributes(String s)
s
- String[]
comma delimited returnAttributespublic void validate() throws AttributeResolutionException
AttributeResolutionException
- if the plug-in has an invalid internal statepublic Map<String,BaseAttribute> resolve(ShibbolethResolutionContext resolutionContext) throws AttributeResolutionException
resolutionContext
- the context for the resolutionAttributeResolutionException
- the problem that occurred during the resolutionprotected Map<String,BaseAttribute> retrieveAttributesFromCache(String searchFilter)
searchFilter
- the search filter the produced the attributesMap
of attributes IDs to attributesprotected Iterator<SearchResult> searchLdap(String searchFilter) throws AttributeResolutionException
searchFilter
- String
the searchFilter that produced the attributesIterator
of search resultsAttributeResolutionException
- if an error occurs performing the searchprotected Map<String,BaseAttribute> buildBaseAttributes(Iterator<SearchResult> results) throws AttributeResolutionException
results
- Iterator
of LDAP search resultsMap
of attribute ids to attributesAttributeResolutionException
- if an error occurs parsing attribute resultsprotected void cacheResult(String searchFilter, Map<String,BaseAttribute> attributes)
searchFilter
- the searchFilter that produced the attributesattributes
- Map
of attribute IDs to attributesCopyright © 1999–2014. All rights reserved.