|
||||||||||
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. |
static class |
LdapDataConnector.SEARCH_SCOPE
Search scope values. |
Constructor Summary | |
---|---|
LdapDataConnector(String ldapUrl,
String ldapBaseDn,
boolean startTls,
int maxIdle,
int initIdleCapacity)
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 |
clearCache()
This removes all entries from the cache. |
LdapDataConnector.AUTHENTICATION_TYPE |
getAuthenticationType()
This returns the authentication type used when binding to the ldap. |
String |
getBaseDn()
This returns the base DN this connector is using. |
protected Map<String,BaseAttribute> |
getCachedAttributes(ShibbolethResolutionContext resolutionContext,
String searchFilter)
This retrieves any cached attributes for the supplied resolution context. |
String |
getFilterTemplate()
Gets the template used to create queries. |
HostnameVerifier |
getHostnameVerifier()
This returns the hostname verifier that will be used for all TLS and SSL connections to the ldap. |
String |
getLdapUrl()
This returns the URL this connector is using. |
long |
getMaxResultSize()
This returns the maximum number of search results the ldap will return. |
String |
getPrincipal()
This returns the principal dn used to bind to the ldap for all searches. |
String |
getPrincipalCredential()
This returns the principal credential used to bind to the ldap for all searches. |
String[] |
getReturnAttributes()
This returns the attributes that all searches will request from the ldap. |
LdapDataConnector.SEARCH_SCOPE |
getSearchScope()
This returns the search scope used when searching the ldap. |
int |
getSearchTimeLimit()
This returns the time in milliseconds that the ldap will wait for search results. |
KeyManager[] |
getSslKeyManagers()
This returns the key managers that will be used for all TLS and SSL connections to the ldap. |
SSLSocketFactory |
getSslSocketFactory()
This returns the SSL Socket Factory that will be used for all TLS and SSL connections to the ldap. |
TrustManager[] |
getSslTrustManagers()
This returns the trust managers that will be used for all TLS and SSL connections to the ldap. |
TemplateEngine |
getTemplateEngine()
Gets the engine used to evaluate the query template. |
void |
initialize()
Initializes the connector and prepares it for use. |
protected void |
initializeCache()
Initializes the cache and prepares it for use. |
protected void |
initializeLdapPool()
Initializes the ldap pool and prepares it for use. |
boolean |
isCacheResults()
This returns whether this connector will cache search results. |
boolean |
isLinkDereferencing()
This returns whether link dereferencing will be used during the search. |
boolean |
isMergeResults()
This returns whether this connector will merge multiple search results into one result. |
boolean |
isNoResultsIsError()
This returns whether this connector will throw an exception if no search results are found. |
boolean |
isReturningObjects()
This returns whether objects will be returned in the search results. |
boolean |
isUseStartTls()
This returns whether this connector will start TLS for all connections to the ldap. |
void |
onApplicationEvent(ApplicationEvent evt)
|
protected void |
registerTemplate()
Registers the query template with template engine. |
Map<String,BaseAttribute> |
resolve(ShibbolethResolutionContext resolutionContext)
Performs the attribute resolution for this plugin. |
protected Iterator<SearchResult> |
searchLdap(String searchFilter)
This searches the LDAP with the supplied filter. |
void |
setAuthenticationType(LdapDataConnector.AUTHENTICATION_TYPE type)
This sets the authentication type used when binding to the ldap. |
protected void |
setCachedAttributes(ShibbolethResolutionContext resolutionContext,
String searchFiler,
Map<String,BaseAttribute> attributes)
This stores the supplied attributes in the cache. |
void |
setCacheResults(boolean b)
This sets whether this connector will cache search results. |
void |
setFilterTemplate(String template)
Sets the template used to create queries. |
void |
setHostnameVerifier(HostnameVerifier hv)
This sets the hostname verifier that will be used for all TLS and SSL connections to the ldap. |
void |
setLdapProperties(Map<String,String> ldapProperties)
This sets additional ldap context environment properties. |
void |
setLinkDereferencing(boolean b)
This sets whether link dereferencing will be used during the search. |
void |
setMaxResultSize(long l)
This sets the maximum number of search results the ldap will return. |
void |
setMergeResults(boolean b)
This sets whether this connector will merge multiple search results into one result. |
void |
setNoResultsIsError(boolean b)
This sets whether this connector will throw an exception if no search results are found. |
void |
setPrincipal(String s)
This sets the principal dn used to bind to the ldap for all searches. |
void |
setPrincipalCredential(String s)
This sets the principal credential used to bind to the ldap for all searches. |
void |
setReturnAttributes(String s)
This sets the attributes that all searches will request from the ldap. |
void |
setReturnAttributes(String[] s)
This sets the attributes that all searches will request from the ldap. |
void |
setReturningObjects(boolean b)
This sets whether objects will be returned in the search results. |
void |
setSearchScope(LdapDataConnector.SEARCH_SCOPE scope)
This sets the search scope used when searching the ldap. |
void |
setSearchTimeLimit(int i)
This sets the time in milliseconds that the ldap will wait for search results. |
void |
setSslKeyManagers(org.opensaml.xml.security.x509.X509Credential kc)
This sets the key managers that will be used for all TLS and SSL connections to the ldap. |
void |
setSslSocketFactory(SSLSocketFactory sf)
This sets the SSL Socket Factory that will be used for all TLS and SSL connections to the ldap. |
void |
setSslTrustManagers(org.opensaml.xml.security.x509.X509Credential tc)
This sets the trust managers that will be used for all TLS and SSL connections to the ldap. |
void |
setTemplateEngine(TemplateEngine engine)
Sets the engine used to evaluate the query template. |
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 |
Constructor Detail |
---|
public LdapDataConnector(String ldapUrl, String ldapBaseDn, boolean startTls, int maxIdle, int initIdleCapacity)
ldapUrl
- String
to connect toldapBaseDn
- String
to begin searching atstartTls
- boolean
whether connection should startTlsmaxIdle
- int
maximum number of idle pool objectsinitIdleCapacity
- int
initial capacity of the poolMethod Detail |
---|
public void initialize()
protected void initializeLdapPool()
initialize()
must be called first or this method does
nothing.
protected void initializeCache()
initialize()
must be called first or this method does
nothing.
protected void clearCache()
initialize()
must be called first or this method does nothing.
protected void registerTemplate()
initialize()
must be called first or this method does
nothing.
public boolean isMergeResults()
boolean
public void setMergeResults(boolean b)
b
- boolean
clearCache()
public boolean isCacheResults()
boolean
public void setCacheResults(boolean b)
b
- boolean
initializeCache()
public boolean isNoResultsIsError()
boolean
public void setNoResultsIsError(boolean b)
b
- boolean
public TemplateEngine getTemplateEngine()
public void setTemplateEngine(TemplateEngine engine)
engine
- engine used to evaluate the query templatepublic String getFilterTemplate()
public void setFilterTemplate(String template)
template
- template used to create queriespublic String getLdapUrl()
String
public String getBaseDn()
String
public boolean isUseStartTls()
boolean
public SSLSocketFactory getSslSocketFactory()
SSLSocketFactory
public void setSslSocketFactory(SSLSocketFactory sf)
sf
- SSLSocketFactory
clearCache()
,
initializeLdapPool()
public TrustManager[] getSslTrustManagers()
TrustManager[]
public void setSslTrustManagers(org.opensaml.xml.security.x509.X509Credential tc)
tc
- X509Credential
to create TrustManagers withclearCache()
,
initializeLdapPool()
,
setSslSocketFactory(SSLSocketFactory)
public KeyManager[] getSslKeyManagers()
KeyManager[]
public void setSslKeyManagers(org.opensaml.xml.security.x509.X509Credential kc)
kc
- X509Credential
to create KeyManagers withclearCache()
,
initializeLdapPool()
,
setSslSocketFactory(SSLSocketFactory)
public HostnameVerifier getHostnameVerifier()
HostnameVerifier
public void setHostnameVerifier(HostnameVerifier hv)
hv
- HostnameVerifier
clearCache()
,
initializeLdapPool()
public LdapDataConnector.AUTHENTICATION_TYPE getAuthenticationType()
AUTHENTICATION_TYPE
public void setAuthenticationType(LdapDataConnector.AUTHENTICATION_TYPE type)
type
- AUTHENTICATION_TYPE
clearCache()
,
initializeLdapPool()
public LdapDataConnector.SEARCH_SCOPE getSearchScope()
int
public void setSearchScope(LdapDataConnector.SEARCH_SCOPE scope)
scope
- directory search scopeclearCache()
public String[] getReturnAttributes()
String[]
public void setReturnAttributes(String[] s)
s
- String[]
clearCache()
public void setReturnAttributes(String s)
s
- String[]
comma delimited returnAttributespublic int getSearchTimeLimit()
int
millisecondspublic void setSearchTimeLimit(int i)
i
- int
millisecondsclearCache()
public long getMaxResultSize()
long
maximum number of search resultspublic void setMaxResultSize(long l)
l
- long
maximum number of search resultsclearCache()
public boolean isReturningObjects()
boolean
public void setReturningObjects(boolean b)
b
- boolean
clearCache()
public boolean isLinkDereferencing()
boolean
public void setLinkDereferencing(boolean b)
b
- boolean
clearCache()
public String getPrincipal()
String
principal dnpublic void setPrincipal(String s)
s
- String
principal dnclearCache()
,
initializeLdapPool()
public String getPrincipalCredential()
String
principal credentialpublic void setPrincipalCredential(String s)
s
- String
principal credentialclearCache()
,
initializeLdapPool()
public void setLdapProperties(Map<String,String> ldapProperties)
ldapProperties
- Map
of name/value pairsclearCache()
,
initializeLdapPool()
public void onApplicationEvent(ApplicationEvent evt)
onApplicationEvent
in interface ApplicationListener
public Map<String,BaseAttribute> resolve(ShibbolethResolutionContext resolutionContext) throws AttributeResolutionException
resolve
in interface ResolutionPlugIn<Map<String,BaseAttribute>>
resolutionContext
- the context for the resolution
AttributeResolutionException
- the problem that occurred during the resolutionpublic void validate() throws AttributeResolutionException
validate
in interface ResolutionPlugIn<Map<String,BaseAttribute>>
AttributeResolutionException
- if the plug-in has an invalid internal stateprotected 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 setCachedAttributes(ShibbolethResolutionContext resolutionContext, String searchFiler, Map<String,BaseAttribute> attributes)
resolutionContext
- ResolutionContext
searchFiler
- the searchFilter that produced the attributesattributes
- Map
of attribute ids to attributesprotected Map<String,BaseAttribute> getCachedAttributes(ShibbolethResolutionContext resolutionContext, String searchFilter)
resolutionContext
- ResolutionContext
searchFilter
- the search filter the produced the attributes
Map
of attributes ids to attributes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |