javaspringldapcasjasig

Multiple AttributeRepository in CAS


I'm using CAS (JASIG) 3.5.2 server. I have two LDAP server configured for authentication as authenticationHandlers.

Now, I have a requirement to pass user attribute in Validation Response. I am able to configure CAS to return user attributes from one of the LDAP servers with attributeRepository bean.

I'm not able to figure out how we can configure CAS to get user attributes from multiple LDAPs.

Following config I have tried.

<bean id="attributeRepository" class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
   <property name="contextSource" ref="openldap-contextSource" />
   <property name="requireAllQueryAttributes" value="true" />
   <property name="baseDN" value="dc=myorg,dc=com" />
   <property name="queryAttributeMapping">
      <map>
         <entry key="username" value="uid" />
      </map>
   </property>
   <property name="resultAttributeMapping">
      <map>
         <entry key="sn" value="lastName" />
         <entry key="givenName" value="firstName" />
         <entry key="mail" value="email" />
      </map>
   </property>
</bean>

This configuration works, if we want single LDAP to get user. If I try to rename the bean name it gives me error in initialization.

Can any one suggest approach to achieve this?


Solution

  • You need to define two attribute repositories, merge them and call the merged one "attributeRepository"

    https://github.com/Jasig/person-directory#mergingpersonattributedaoimpl