Skip to content
Browse files

UP-3561 Provide better default config for ldap connection pools

  • Loading branch information...
1 parent 1a895d5 commit f156fff2968b78f83c9aa9821231951808d47608 @edalquist committed Aug 29, 2012
Showing with 41 additions and 19 deletions.
  1. +41 −19 uportal-war/src/main/resources/properties/contexts/ldapContext.xml
View
60 uportal-war/src/main/resources/properties/contexts/ldapContext.xml
@@ -22,8 +22,10 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<!--
| Example LDAP Server Configurations
@@ -39,32 +41,52 @@
| Required for:
| - SimpleLdapSecurityContext
+-->
+
+ <!-- Delcare the legacy support bean to make LdapServices still work -->
<!--
+ <alias name="defaultLdapServer" alias="Main"/>
<bean id="defaultLdapServer" class="org.jasig.portal.ldap.ContextSourceLdapServerImpl">
- <property name="contextSource">
- <bean id="legacyLdapContext" class="org.springframework.ldap.core.support.LdapContextSource">
- <property name="url" value="ldap://ldap.myuniv.edu:389"/>
- <property name="userDn" value="cn=AuthUser, ou=People, dc=myuniv, dc=edu"/>
- <property name="password" value="foobar"/>
- <property name="pooled" value="false"/>
- </bean>
- </property>
+ <property name="contextSource" ref="defaultLdapContext"/>
<property name="uidAttribute" value="uid"/>
- <property name="baseDN" value="ou=People, dc=myuniv, dc=edu"/>
+ <property name="baseDN" value="${ldap.old_base}"/>
</bean>
-->
- <!--
- | Standard Spring ContextSource declaration, used by all new code post 3.0.0.
- | Required for:
- | - Person Directory LDAP Attributes
+ <!--
+ | Example LDAP Server Configuration for LDAP person attribute lookups
+-->
+ <!-- Declare the standard spring-ldap ContextSource objects to define LDAP server connections -->
<!--
- <bean id="defaultLdapContext" class="org.springframework.ldap.core.support.LdapContextSource">
- <property name="url" value="ldap://ldap.myuniv.edu:389"/>
- <property name="base" value="ou=People, dc=myuniv, dc=edu"/>
- <property name="userDn" value="cn=AuthUser, ou=People, dc=myuniv, dc=edu"/>
- <property name="password" value="foobar"/>
+ <bean id="defaultLdapContext" class="org.springframework.ldap.pool.factory.PoolingContextSource">
+ <property name="contextSource" ref="defaultLdapContext_target"/>
+ <property name="dirContextValidator">
+ <bean class="org.springframework.ldap.pool.validation.DefaultDirContextValidator">
+ <property name="searchControls">
+ <bean class="javax.naming.directory.SearchControls">
+ <property name="searchScope"><util:constant static-field="javax.naming.directory.SearchControls.OBJECT_SCOPE" /></property>
+ <property name="countLimit" value="1" />
+ <property name="returningAttributes"><list><value>objectclass</value></list></property>
+ <property name="timeLimit" value="500" />
+ </bean>
+ </property>
+ </bean>
+ </property>
+ <property name="minIdle" value="1" />
+ <property name="maxActive" value="32" />
+ <property name="maxIdle" value="32" />
+ <property name="maxWait" value="1000"/>
+ <property name="testOnBorrow" value="true"/>
+ <property name="testWhileIdle" value="true"/>
+ <property name="timeBetweenEvictionRunsMillis" value="120000"/>
+ <property name="minEvictableIdleTimeMillis" value="900000"/>
+ <property name="numTestsPerEvictionRun" value="6"/>
+ </bean>
+
+ <bean id="defaultLdapContext_target" class="org.springframework.ldap.core.support.LdapContextSource">
+ <property name="url" value="${ldap.url}"/>
+ <property name="base" value=""/>
+ <property name="userDn" value="${ldap.userName}"/>
+ <property name="password" value="${ldap.password}"/>
<property name="pooled" value="false"/>
</bean>
-->

0 comments on commit f156fff

Please sign in to comment.
Something went wrong with that request. Please try again.