-
Notifications
You must be signed in to change notification settings - Fork 5
Home
serac edited this page Feb 13, 2013
·
12 revisions
The following pages describe the benefits of ldaptive over Spring LDAP in three notable areas: performance, availability, and feature set.
- Performance Comparison
- Error Handling and Recovery Comparison
- Feature Comparison
The following code snippet demonstrates how to wire up ldaptive beans to provide for CAS authentication and pricipal resolution against an LDAP directory.
<bean id="ldapAuthHandler"
class="edu.vt.middleware.cas.authentication.handler.LdapAuthenticationHandler">
<constructor-arg>
<bean id="authenticator" class="org.ldaptive.auth.Authenticator">
<!-- Define the strategy for resolving DNs from the CAS username. -->
<constructor-arg>
<bean class="org.ldaptive.auth.PooledSearchDnResolver"
p:baseDn="${ldap.baseDn}"
p:allowMultipleDns="false"
p:connectionFactory-ref="pooledLdapConnectionFactory"
p:userFilter="authId={user}" />
</constructor-arg>
<!-- Define the source of LDAP connections used for authentication. -->
<constructor-arg>
<bean class="org.ldaptive.auth.PooledBindAuthenticationHandler"
p:connectionFactory-ref="pooledLdapConnectionFactory" />
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean id="jndiProvider" class="org.ldaptive.provider.jndi.JndiProvider">
<property name="providerConfig">
<bean class="org.ldaptive.provider.jndi.JndiProviderConfig">
<property name="environment">
<map>
<entry key="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory" />
</map>
</property>
</bean>
</property>
</bean>
<bean id="ldapConnectionConfig" class="org.ldaptive.ConnectionConfig"
p:ldapUrl="${ldapPurl}"
p:connectTimeout="${ldap.connectTimeout}"
p:useStartTLS="${ldap.useStartTLS}" />
<bean id="ldapConnectionFactory" class="org.ldaptive.DefaultConnectionFactory"
p:connectionConfig-ref="ldapConnectionConfig"
p:provider-ref="jndiProvider" />
<bean id="ldapPoolConfig" class="org.ldaptive.pool.PoolConfig"
p:minPoolSize="${ldap.pool.minSize}"
p:maxPoolSize="${ldap.pool.maxSize}"
p:validateOnCheckOut="${ldap.pool.validateOnCheckout}"
p:validatePeriodically="${ldap.pool.validatePeriodically}"
p:validatePeriod="${ldap.pool.validatePeriod}" />
<bean id="searchValidator" class="org.ldaptive.pool.SearchValidator" />
<bean id="pruneStrategy" class="org.ldaptive.pool.IdlePruneStrategy"
p:prunePeriod="${ldap.pool.prunePeriod}"
p:idleTime="${ldap.pool.idleTime}" />
<bean id="ldapConnectionPool" class="org.ldaptive.pool.BlockingConnectionPool"
init-method="initialize"
p:connectionFactory-ref="ldapConnectionFactory"
p:poolConfig-ref="ldapPoolConfig"
p:blockWaitTime="${ldap.pool.blockWaitTime}"
p:validator-ref="searchValidator"
p:pruneStrategy-ref="pruneStrategy"/>
<bean id="pooledLdapConnectionFactory" class="org.ldaptive.pool.PooledConnectionFactory"
p:connectionPool-ref="ldapConnectionPool" />