edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector
Class LdapDataConnectorFactoryBean

java.lang.Object
  extended by org.springframework.beans.factory.config.AbstractFactoryBean
      extended by edu.internet2.middleware.shibboleth.common.config.attribute.resolver.AbstractResolutionPluginFactoryBean
          extended by edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector.BaseDataConnectorFactoryBean
              extended by edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector.LdapDataConnectorFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

public class LdapDataConnectorFactoryBean
extends BaseDataConnectorFactoryBean

Spring factory for creating LdapDataConnector beans.


Field Summary
private  long cacheElementTtl
          Length of time, in milliseconds, elements are cached.
private  net.sf.ehcache.CacheManager cacheManager
          Whether results should be cached.
private  X509Credential connectionCredential
          Client authentication material used when connecting to the LDAP over SSL/TLS.
private  edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy connStrategy
          Ldap connection strategy.
private  String filterTemplate
          LDAP query filter template.
private  edu.vt.middleware.ldap.LdapConfig ldapConfig
          Ldap configuration.
private  LdapPoolStrategy ldapPoolStrategy
          Ldap pool strategy.
private  Map<String,String> ldapProperties
          Ldap connection provider specific properties.
private  edu.vt.middleware.ldap.pool.LdapValidator ldapValidator
          Connection validator that performs compares.
private  boolean lowercaseAttributeNames
          Whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.
private  int maximumCachedElements
          Maximum number of queries to keep in the cache.
private  boolean mergeResults
          Whether to merge multiple results into a single set of attributes.
private  boolean noResultsIsError
          Whether a search returning no results should be considered an error.
private  List<String> returnAttributes
          Name of the LDAP attributes to return.
private  TemplateEngine templateEngine
          Template engine used to construct filter queries.
private  X509Credential trustCredential
          Trust material used when connecting to the LDAP over SSL/TLS.
 
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
 
Constructor Summary
LdapDataConnectorFactoryBean()
           
 
Method Summary
protected  Object createInstance()
          
protected  SSLContext createSSLContext()
          Creates an SSLContext if either trust or key material was set.
 LdapDataConnector.AUTHENTICATION_TYPE getAuthenticationType()
          Gets the authentication type used when connecting to the directory.
 String getBaseDN()
          Gets the base search DN.
 long getCacheElementTimeToLive()
          Gets the time to live, in milliseconds, for cache elements.
 net.sf.ehcache.CacheManager getCacheManager()
          Gets the manager for the results cache.
 X509Credential getConnectionCredential()
          Gets the client authentication material used when connecting to the LDAP via SSL or TLS.
 edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy getConnectionStrategy()
          Gets the LDAP connection strategy.
 String getFilterTemplate()
          Gets the LDAP query filter template.
 Map<String,String> getLdapProperties()
          Gets the LDAP connection provider specific properties.
 String getLdapUrl()
          Gets the LDAP server's URL.
 int getMaximumCachedElements()
          Gets the maximum number of elements that will be cached.
 int getMaxResultSize()
          Gets the maximum number of results to return from a query.
 Class<?> getObjectType()
          
 LdapPoolStrategy getPoolStrategy()
          Gets the ldap pool strategy.
 edu.vt.middleware.ldap.pool.LdapValidator getPoolValidator()
          Gets the pool validator.
 String getPrincipal()
          Gets the principal DN used to bind to the directory.
 String getPrincipalCredential()
          Gets the credential of the principal DN used to bind to the directory.
 List<String> getReturnAttributes()
          Gets the attributes to return from a query.
 edu.vt.middleware.ldap.LdapConfig.SearchScope getSearchScope()
          Gets the search scope of a query.
 int getSearchTimeLimit()
          Gets the maximum amount of time, in milliseconds, to wait for a search to complete.
 TemplateEngine getTemplateEngine()
          Gets the template engine used to construct query filters.
 X509Credential getTrustCredential()
          Gets the trust material used when connecting to the LDAP via SSL or TLS.
 boolean getUseStartTLS()
          Gets whether to use StartTLS when connecting to the LDAP.
 boolean isLowercaseAttributeNames()
          Gets whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.
 boolean isMergeResults()
          Gets whether to merge multiple results into a single result.
 boolean isNoResultsIsError()
          Gets whether a query that returns no results is an error condition.
 void setAuthenticationType(LdapDataConnector.AUTHENTICATION_TYPE type)
          Sets the authentication type used when connecting to the directory.
 void setBaseDN(String dn)
          Sets the base search DN.
 void setCacheElementTimeToLive(long ttl)
          Sets the time to live, in milliseconds, for cache elements.
 void setCacheManager(net.sf.ehcache.CacheManager manager)
          Sets the manager for the results cache.
 void setConnectionCredential(X509Credential credential)
          Sets the client authentication material used when connecting to the LDAP via SSL or TLS.
 void setConnectionStrategy(edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy strategy)
          Sets the LDAP connection strategy.
 void setFilterTemplate(String template)
          Sets the LDAP query filter template.
 void setLdapProperties(Map<String,String> properties)
          Sets the LDAP connection provider specific properties.
 void setLdapUrl(String url)
          Sets the LDAP server's URL.
 void setLowercaseAttributeNames(boolean lowercase)
          Sets whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.
 void setMaximumCachedElements(int max)
          Sets the maximum number of elements that will be cached.
 void setMaxResultSize(int max)
          Sets the maximum number of results to return from a query.
 void setMergeResults(boolean merge)
          Sets whether to merge multiple results into a single result.
 void setNoResultsIsError(boolean isError)
          Sets whether a query that returns no results is an error condition.
 void setPoolStrategy(LdapPoolStrategy strategy)
          Sets the ldap pool strategy.
 void setPoolValidator(edu.vt.middleware.ldap.pool.LdapValidator validator)
          Sets the validator used to validate pool connections.
 void setPrincipal(String principalName)
          Sets the principal DN used to bind to the directory.
 void setPrincipalCredential(String credential)
          Sets the credential of the principal DN used to bind to the directory.
 void setReturnAttributes(List<String> attributes)
          Sets the attributes to return from a query.
 void setSearchScope(edu.vt.middleware.ldap.LdapConfig.SearchScope scope)
          Sets the search scope of a query.
 void setSearchTimeLimit(int timeLimit)
          Sets the maximum amount of time, in milliseconds, to wait for a search to complete.
 void setTemplateEngine(TemplateEngine engine)
          Sets the template engine used to construct query filters.
 void setTrustCredential(X509Credential credential)
          Sets the trust material used when connecting to the LDAP via SSL or TLS.
protected  void setupPoolStrategy()
          Initializes the LDAP factory and validator for the selected pool strategy, and initializes the pool.
 void setUseStartTLS(boolean startTLS)
          Sets whether to use StartTLS when connecting to the LDAP.
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.config.attribute.resolver.dataConnector.BaseDataConnectorFactoryBean
getFailoverDataConnectorId, populateDataConnector, setFailoverDataConnectorIds
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.config.attribute.resolver.AbstractResolutionPluginFactoryBean
getDependencyIds, getPluginId, setDependencyIds, setPluginId
 
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ldapPoolStrategy

private LdapPoolStrategy ldapPoolStrategy
Ldap pool strategy.


ldapConfig

private edu.vt.middleware.ldap.LdapConfig ldapConfig
Ldap configuration.


connStrategy

private edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy connStrategy
Ldap connection strategy.


ldapProperties

private Map<String,String> ldapProperties
Ldap connection provider specific properties.


ldapValidator

private edu.vt.middleware.ldap.pool.LdapValidator ldapValidator
Connection validator that performs compares.


templateEngine

private TemplateEngine templateEngine
Template engine used to construct filter queries.


filterTemplate

private String filterTemplate
LDAP query filter template.


returnAttributes

private List<String> returnAttributes
Name of the LDAP attributes to return.


trustCredential

private X509Credential trustCredential
Trust material used when connecting to the LDAP over SSL/TLS.


connectionCredential

private X509Credential connectionCredential
Client authentication material used when connecting to the LDAP over SSL/TLS.


mergeResults

private boolean mergeResults
Whether to merge multiple results into a single set of attributes.


noResultsIsError

private boolean noResultsIsError
Whether a search returning no results should be considered an error.


lowercaseAttributeNames

private boolean lowercaseAttributeNames
Whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.


cacheManager

private net.sf.ehcache.CacheManager cacheManager
Whether results should be cached.


maximumCachedElements

private int maximumCachedElements
Maximum number of queries to keep in the cache.


cacheElementTtl

private long cacheElementTtl
Length of time, in milliseconds, elements are cached.

Constructor Detail

LdapDataConnectorFactoryBean

public LdapDataConnectorFactoryBean()
Method Detail

createInstance

protected Object createInstance()
                         throws Exception

Specified by:
createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean
Throws:
Exception

setupPoolStrategy

protected void setupPoolStrategy()
                          throws Exception
Initializes the LDAP factory and validator for the selected pool strategy, and initializes the pool.

Throws:
Exception - thrown if the pool cannot be initialized

createSSLContext

protected SSLContext createSSLContext()
                               throws Exception
Creates an SSLContext if either trust or key material was set.

Returns:
the created SSL context or null if no trust or key material was provided
Throws:
Exception - thrown if the SSLContext can not be created and initialized

getAuthenticationType

public LdapDataConnector.AUTHENTICATION_TYPE getAuthenticationType()
Gets the authentication type used when connecting to the directory.

Returns:
authentication type used when connecting to the directory

getBaseDN

public String getBaseDN()
Gets the base search DN.

Returns:
the base search DN

getCacheElementTimeToLive

public long getCacheElementTimeToLive()
Gets the time to live, in milliseconds, for cache elements.

Returns:
time to live, in milliseconds, for cache elements

getCacheManager

public net.sf.ehcache.CacheManager getCacheManager()
Gets the manager for the results cache.

Returns:
manager for the results cache

getConnectionCredential

public X509Credential getConnectionCredential()
Gets the client authentication material used when connecting to the LDAP via SSL or TLS.

Returns:
client authentication material used when connecting to the LDAP via SSL or TLS

getFilterTemplate

public String getFilterTemplate()
Gets the LDAP query filter template.

Returns:
LDAP query filter template

getLdapProperties

public Map<String,String> getLdapProperties()
Gets the LDAP connection provider specific properties.

Returns:
LDAP connection provider specific properties

getLdapUrl

public String getLdapUrl()
Gets the LDAP server's URL.

Returns:
LDAP server's URL

getConnectionStrategy

public edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy getConnectionStrategy()
Gets the LDAP connection strategy.

Returns:
connection strategy

getMaximumCachedElements

public int getMaximumCachedElements()
Gets the maximum number of elements that will be cached.

Returns:
maximum number of elements that will be cached

getMaxResultSize

public int getMaxResultSize()
Gets the maximum number of results to return from a query.

Returns:
maximum number of results to return from a query

getObjectType

public Class<?> getObjectType()

Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean
Specified by:
getObjectType in class org.springframework.beans.factory.config.AbstractFactoryBean

getPoolStrategy

public LdapPoolStrategy getPoolStrategy()
Gets the ldap pool strategy.

Returns:
ldap pool strategy

getPoolValidator

public edu.vt.middleware.ldap.pool.LdapValidator getPoolValidator()
Gets the pool validator.

Returns:
pool validator

getPrincipal

public String getPrincipal()
Gets the principal DN used to bind to the directory.

Returns:
principal DN used to bind to the directory

getPrincipalCredential

public String getPrincipalCredential()
Gets the credential of the principal DN used to bind to the directory.

Returns:
credential of the principal DN used to bind to the directory

getReturnAttributes

public List<String> getReturnAttributes()
Gets the attributes to return from a query.

Returns:
attributes to return from a query

getSearchScope

public edu.vt.middleware.ldap.LdapConfig.SearchScope getSearchScope()
Gets the search scope of a query.

Returns:
search scope of a query

getSearchTimeLimit

public int getSearchTimeLimit()
Gets the maximum amount of time, in milliseconds, to wait for a search to complete.

Returns:
maximum amount of time, in milliseconds, to wait for a search to complete

getTemplateEngine

public TemplateEngine getTemplateEngine()
Gets the template engine used to construct query filters.

Returns:
template engine used to construct query filters

getTrustCredential

public X509Credential getTrustCredential()
Gets the trust material used when connecting to the LDAP via SSL or TLS.

Returns:
trust material used when connecting to the LDAP via SSL or TLS

getUseStartTLS

public boolean getUseStartTLS()
Gets whether to use StartTLS when connecting to the LDAP.

Returns:
whether to use StartTLS when connecting to the LDAP

isLowercaseAttributeNames

public boolean isLowercaseAttributeNames()
Gets whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.

Returns:
whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased

isMergeResults

public boolean isMergeResults()
Gets whether to merge multiple results into a single result.

Returns:
whether to merge multiple results into a single result

isNoResultsIsError

public boolean isNoResultsIsError()
Gets whether a query that returns no results is an error condition.

Returns:
whether a query that returns no results is an error condition

setAuthenticationType

public void setAuthenticationType(LdapDataConnector.AUTHENTICATION_TYPE type)
Sets the authentication type used when connecting to the directory.

Parameters:
type - authentication type used when connecting to the directory

setBaseDN

public void setBaseDN(String dn)
Sets the base search DN.

Parameters:
dn - the base search DN

setCacheElementTimeToLive

public void setCacheElementTimeToLive(long ttl)
Sets the time to live, in milliseconds, for cache elements.

Parameters:
ttl - time to live, in milliseconds, for cache elements

setCacheManager

public void setCacheManager(net.sf.ehcache.CacheManager manager)
Sets the manager for the results cache.

Parameters:
manager - manager for the results cache

setConnectionCredential

public void setConnectionCredential(X509Credential credential)
Sets the client authentication material used when connecting to the LDAP via SSL or TLS.

Parameters:
credential - client authentication material used when connecting to the LDAP via SSL or TLS

setFilterTemplate

public void setFilterTemplate(String template)
Sets the LDAP query filter template.

Parameters:
template - LDAP query filter template

setLdapProperties

public void setLdapProperties(Map<String,String> properties)
Sets the LDAP connection provider specific properties.

Parameters:
properties - LDAP connection provider specific properties

setLdapUrl

public void setLdapUrl(String url)
Sets the LDAP server's URL.

Parameters:
url - LDAP server's URL

setConnectionStrategy

public void setConnectionStrategy(edu.vt.middleware.ldap.handler.ConnectionHandler.ConnectionStrategy strategy)
Sets the LDAP connection strategy.

Parameters:
strategy - connection strategy

setLowercaseAttributeNames

public void setLowercaseAttributeNames(boolean lowercase)
Sets whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased.

Parameters:
lowercase - whether LDAP attribute names used as Shibboleth attribute IDs will be lowercased

setMaximumCachedElements

public void setMaximumCachedElements(int max)
Sets the maximum number of elements that will be cached.

Parameters:
max - maximum number of elements that will be cached

setMaxResultSize

public void setMaxResultSize(int max)
Sets the maximum number of results to return from a query.

Parameters:
max - maximum number of results to return from a query

setMergeResults

public void setMergeResults(boolean merge)
Sets whether to merge multiple results into a single result.

Parameters:
merge - whether to merge multiple results into a single result

setNoResultsIsError

public void setNoResultsIsError(boolean isError)
Sets whether a query that returns no results is an error condition.

Parameters:
isError - whether a query that returns no results is an error condition

setPoolStrategy

public void setPoolStrategy(LdapPoolStrategy strategy)
Sets the ldap pool strategy.

Parameters:
strategy - to use for pooling

setPoolValidator

public void setPoolValidator(edu.vt.middleware.ldap.pool.LdapValidator validator)
Sets the validator used to validate pool connections.

Parameters:
validator - validator used to validate pool connections

setPrincipal

public void setPrincipal(String principalName)
Sets the principal DN used to bind to the directory.

Parameters:
principalName - principal DN used to bind to the directory

setPrincipalCredential

public void setPrincipalCredential(String credential)
Sets the credential of the principal DN used to bind to the directory.

Parameters:
credential - credential of the principal DN used to bind to the directory

setReturnAttributes

public void setReturnAttributes(List<String> attributes)
Sets the attributes to return from a query.

Parameters:
attributes - attributes to return from a query

setSearchScope

public void setSearchScope(edu.vt.middleware.ldap.LdapConfig.SearchScope scope)
Sets the search scope of a query.

Parameters:
scope - search scope of a query

setSearchTimeLimit

public void setSearchTimeLimit(int timeLimit)
Sets the maximum amount of time, in milliseconds, to wait for a search to complete.

Parameters:
timeLimit - maximum amount of time, in milliseconds, to wait for a search to complete

setTemplateEngine

public void setTemplateEngine(TemplateEngine engine)
Sets the template engine used to construct query filters.

Parameters:
engine - template engine used to construct query filters

setTrustCredential

public void setTrustCredential(X509Credential credential)
Sets the trust material used when connecting to the LDAP via SSL or TLS.

Parameters:
credential - trust material used when connecting to the LDAP via SSL or TLS

setUseStartTLS

public void setUseStartTLS(boolean startTLS)
Sets whether to use StartTLS when connecting to the LDAP.

Parameters:
startTLS - whether to use StartTLS when connecting to the LDAP


Copyright © 1999-2012. All Rights Reserved.