01 Example Person Directory Conversion
uPortal 2.6 personDirectory.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="personAttributeDao" class="org.jasig.portal.services.persondir.support.CachingPersonAttributeDaoImpl"> <property name="cachedPersonAttributesDao"> <ref bean="mergedPersonAttributeDao"/> </property> </bean> <bean id="mergedPersonAttributeDao" class="org.jasig.portal.services.persondir.support.MergingPersonAttributeDaoImpl"> <property name="personAttributeDaos"> <list> <ref bean="uPortalJdbcAttributeSource"/> <ref bean="uPortalLdapAttributeSource"/> </list> </property> </bean> <!-- JDBC Person Attribute Source, using the default portal DataSource via RDBMServices --> <bean id="uPortalJdbcAttributeSource" class="org.jasig.portal.services.persondir.support.JdbcPersonAttributeDaoImpl"> <constructor-arg> <!-- | here we're saying, Spring, please call RDBMServices.getDataSource() and inject the returned DataSource as the first constructor argument | to our JdbcPersonAttributeDaoImpl instance. +--> <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod"> <value>org.jasig.portal.RDBMServices.getDataSource</value> </property> </bean> </constructor-arg> <constructor-arg> <list> <value>username</value> </list> </constructor-arg> <constructor-arg> <value> SELECT concat(concat(FIRST_NAME,' '),LAST_NAME) AS FIRST_LAST, FIRST_NAME, LAST_NAME, EMAIL, USER_NAME FROM UP_PERSON_DIR WHERE USER_NAME=? </value> </constructor-arg> <property name="columnsToAttributes"> <map> <entry key="FIRST_LAST"> <value>displayName</value> </entry> <entry key="FIRST_NAME"> <set> <value>givenName</value> <value>user.name.given</value> </set> </entry> <entry key="LAST_NAME"> <set> <value>sn</value> <value>user.name.family</value> </set> </entry> <entry key="EMAIL"> <set> <value>mail</value> <value>user.home-info.online.email</value> </set> </entry> <entry key="USER_NAME"> <value>user.login.id</value> </entry> </map> </property> </bean> <!-- LDAP Person Attribute Source, uses the default ILdapServer via the LdapServices.getDefaultLdapServer method call --> <bean id="uPortalLdapAttributeSource" class="org.jasig.portal.services.persondir.support.LdapPersonAttributeDaoImpl"> <property name="ldapServer"> <ref bean="defaultLdapServer"/> </property> <property name="queryAttributes"> <list> <value>username</value> </list> </property> <property name="query"> <value>(uid={0})</value> </property> <property name="ldapAttributesToPortalAttributes"> <map> <entry key="cn"> <value>cn</value> </entry> <entry key="displayName"> <value>displayName</value> </entry> <entry key="givenName"> <value>givenName</value> </entry> <entry key="mail"> <value>Mail</value> </entry> <entry key="sn"> <value>sn</value> </entry> <entry key="uid"> <value>uid</value> </entry> <entry key="ENTPersonLogin"> <value>Login</value> </entry> <entry key="ENTPersonAlias"> <value>Alias</value> </entry> </map> </property> </bean> <bean id="defaultLdapServer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="staticMethod"> <value>org.jasig.portal.ldap.LdapServices.getDefaultLdapServer</value> </property> </bean> </beans>
uPortal 3.0 personDirectoryContext.xml
Â
uPortal 3.1 is based on personDirectory 1.5 with slightly different configuration. See example on page: LDAP Attribute Source.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="personAttributeDao" class="org.jasig.services.persondir.support.CachingPersonAttributeDaoImpl"> <property name="userInfoCache"> <bean class="org.jasig.portal.utils.cache.MapCacheFactoryBean"> <property name="cacheFactory" ref="cacheFactory"/> <property name="cacheName" value="org.jasig.services.persondir.USER_INFO"/> </bean> </property> <property name="cachedPersonAttributesDao" ref="mergedPersonAttributeDao"/> </bean> <bean id="mergedPersonAttributeDao" class="org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl"> <property name="personAttributeDaos"> <list> <ref bean="uPortalJdbcAttributeSource"/> <ref bean="uPortalLdapAttributeSource"/> </list> </property> </bean> <bean id="uPortalJdbcAttributeSource" class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao"> <constructor-arg index="0" ref="PortalDb"/> <constructor-arg> <list> <value>username</value> </list> </constructor-arg> <constructor-arg> <value> SELECT FIRST_NAME||' '||LAST_NAME AS FIRST_LAST, FIRST_NAME, LAST_NAME, EMAIL, USER_NAME FROM UP_PERSON_DIR WHERE USER_NAME=? </value> </constructor-arg> <property name="columnsToAttributes"> <map> <entry key="FIRST_LAST"> <value>displayName</value> </entry> <entry key="FIRST_NAME"> <set> <value>givenName</value> <value>user.name.given</value> </set> </entry> <entry key="LAST_NAME"> <set> <value>sn</value> <value>user.name.family</value> </set> </entry> <entry key="EMAIL"> <set> <value>mail</value> <value>user.home-info.online.email</value> </set> </entry> <entry key="USER_NAME"> <value>user.login.id</value> </entry> </map> </property> </bean> <bean id="uPortalLdapAttributeSource" class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao"> <property name="contextSource" ref="defaultLdapContext"/> <property name="queryAttributes"> <list> <value>username</value> </list> </property> <property name="query"> <value>(uid={0})</value> </property> <property name="ldapAttributesToPortalAttributes"> <map> <entry key="uid"> <value>uid</value> </entry> <entry key="cn"> <value>cn</value> </entry> <entry key="displayName"> <value>displayName</value> </entry> <entry key="givenName"> <value>givenName</value> </entry> <entry key="mail"> <value>Mail</value> </entry> <entry key="sn"> <value>sn</value> </entry> <entry key="telephoneNumber"> <value>Numero de Telephone</value> </entry> <entry key="Title"> <value>Titre</value> </entry> <entry key="personalTitle"> <value>Civilite</value> </entry> </map> </property> </bean> </beans>