03 Converting ldap.xml or ldap.properties

uPortal 3 now uses the Spring-LDAP framework to configure LDAP connections for the portal. The primary change involves configuring LDAP servers using Spring LdapContextSource objects there are also some support beans needed to ensure correct portal integration.

Move the File

In uPortal 2 either ldap.properties or ldap.xml in the /uPortal/properties directory could be used to configure portal LDAP servers. In uPortal 3 this configuration is done in the file /uPortal/portal-impl/src/main/resources/properties/contexts/ldapContext.xml

Configure LdapContextSource

Use the Spring-LDAP Manual as a reference for adding LdapContextSource beans to ldapContext.xml.

Example conversion from ldap.properties

ldap.host=ldap.myuniv.edu
ldap.port=389
ldap.baseDN=ou=People, dc=myuniv, dc=edu
ldap.uidAttribute=uid
ldap.managerDN=
ldap.managerPW=

The above properties would convert to a LdapContextSource bean as follows:

<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="userName" value=""/>
    <property name="password" value=""/>
</bean>

The ldap.uidAttribute property is not copied to the context configuration as it is a uPortal specific item. The section on Legacy Wrappers will cover this attribute.

Example conversion from ldap.xml

<connection default="true">
    <name>defaultLdapServer</name>
    <host>ldap.myuniv.edu</host>
    <port>636</port>
    <baseDN>ou=People, dc=myuniv, dc=edu</baseDN>
    <managerDN></managerDN>
    <managerPW></managerPW>
    <uidAttribute>uid</uidAttribute>
</connection>

The above properties would convert to a LdapContextSource bean as follows:

<bean id="defaultLdapContext" class="org.springframework.ldap.core.support.LdapContextSource">
    <property name="url" value="ldap://ldap.myuniv.edu:389"/>
    <property name="base" value="dc=Faculty, dc=itstp, dc=yale, dc=edu"/>
    <property name="userName" value="ou=People, dc=myuniv, dc=edu"/>
    <property name="password" value=""/>
    <property name="pooled" value="false"/>
</bean>

The <uidAttribute> element is not copied to the context configuration as it is a uPortal specific item. The section on Legacy Wrappers will cover this attribute.

Configure Legacy Wrappers

As the LdapServices class is still available wrappers around the LdapContextSource beans are needed to provide this functionality to legacy code.

For each LdapContextSource configured in ldapContext.xml a ContextSourceLdapServerImpl bean is also needed. The following example would apply to both examples above:

<bean id="defaultLdapServer" class="org.jasig.portal.ldap.ContextSourceLdapServerImpl">
    <property name="ldapContextSource" ref="defaultLdapContext"/>
    <property name="uidAttribute" value="uid"/>
</bean>

The portal does expect the default ContextSourceLdapServerImpl to be used to be named defaultLdapServer and the default LdapContextSource to be named defaultLdapContext