|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.shibboleth.common.attribute.resolver.provider.AbstractResolutionPlugIn<Map<String,BaseAttribute>>
edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.BaseDataConnector
edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.LdapDataConnector
public class LdapDataConnector
LdapDataConnector
provides a plugin to retrieve attributes from an LDAP.
Nested Class Summary | |
---|---|
static class |
LdapDataConnector.AUTHENTICATION_TYPE
Authentication type values. |
protected class |
LdapDataConnector.LDAPValueEscapingStrategy
Escapes values that will be included within an LDAP filter. |
Field Summary | |
---|---|
private LdapDataConnector.LDAPValueEscapingStrategy |
escapingStrategy
Filter value escaping strategy. |
private TemplateEngine |
filterCreator
Template engine used to change filter template into actual filter. |
private String |
filterTemplate
Template that produces the query to use. |
private String |
filterTemplateName
Name the filter template is registered under within the template engine. |
private LdapPoolStrategy |
ldapPool
Ldap pool strategy. |
private org.slf4j.Logger |
log
Class logger. |
private boolean |
noResultsIsError
Whether an empty result set is an error. |
private net.sf.ehcache.Cache |
resultsCache
Cache of past search results. |
private String[] |
returnAttributes
Attributes to return from ldap searches. |
Constructor Summary | |
---|---|
LdapDataConnector(LdapPoolStrategy pool,
net.sf.ehcache.Cache cache)
This creates a new LDAP data connector with the supplied properties. |
Method Summary | |
---|---|
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. |
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.BaseDataConnector |
---|
getFailoverDependencyId, setFailoverDependencyIds |
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.AbstractResolutionPlugIn |
---|
getDependencyIds, getId, getValuesFromAllDependencies, getValuesFromAttributeDependency, getValuesFromConnectorDependency, setId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.ResolutionPlugIn |
---|
getDependencyIds, getId |
Field Detail |
---|
private final org.slf4j.Logger log
private LdapPoolStrategy ldapPool
private TemplateEngine filterCreator
private String filterTemplateName
private String filterTemplate
private String[] returnAttributes
private boolean noResultsIsError
private net.sf.ehcache.Cache resultsCache
private final LdapDataConnector.LDAPValueEscapingStrategy escapingStrategy
Constructor Detail |
---|
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 cachedMethod Detail |
---|
public 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 resolution
AttributeResolutionException
- the problem that occurred during the resolutionprotected Map<String,BaseAttribute> retrieveAttributesFromCache(String searchFilter)
searchFilter
- the search filter the produced the attributes
Map
of attributes IDs to attributesprotected Iterator<SearchResult> searchLdap(String searchFilter) throws AttributeResolutionException
searchFilter
- String
the searchFilter that produced the attributes
Iterator
of search results
AttributeResolutionException
- if an error occurs performing the searchprotected Map<String,BaseAttribute> buildBaseAttributes(Iterator<SearchResult> results) throws AttributeResolutionException
results
- Iterator
of LDAP search results
Map
of attribute ids to attributes
AttributeResolutionException
- 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 attributes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |