+

Added attributeRepository bean (LdapPersonAttributeDao)

Benjamin Renard [2014-12-11 14:01:00]
Added attributeRepository bean (LdapPersonAttributeDao)
Filename
custom/webpages/WEB-INF/auth-configuration/ldap-auth.xml
diff --git a/custom/webpages/WEB-INF/auth-configuration/ldap-auth.xml b/custom/webpages/WEB-INF/auth-configuration/ldap-auth.xml
index 3b3c006..cc58f71 100644
--- a/custom/webpages/WEB-INF/auth-configuration/ldap-auth.xml
+++ b/custom/webpages/WEB-INF/auth-configuration/ldap-auth.xml
@@ -15,7 +15,8 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

 	<!--
 		|    LDAP authentication.
@@ -49,4 +50,33 @@
 		<property name="searchBase" value="${ldap.basedn}" />
 		<property name="contextSource" ref="contextSource" />
 	</bean>
+
+	<util:set id="ldapLoginAttributes">
+		<value>uid</value>
+		<value>mail</value>
+	</util:set>
+
+	<bean id="attributeRepository"  class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
+		<property name="contextSource" ref="contextSource" />
+		<property name="baseDN" value="${ldap.basedn}" />
+		<property name="requireAllQueryAttributes" value="true" />
+
+		<property name="queryType" value="OR" />
+		<property name="queryAttributeMapping">
+			<map>
+				<entry key="username" value-ref="ldapLoginAttributes"/>
+			</map>
+		</property>
+
+		<property name="resultAttributeMapping">
+			<map>
+				<entry value="name" key="cn" />
+				<entry value="firstname" key="givenName" />
+				<entry value="lastname" key="sn" />
+				<entry value="mail" key="mail" />
+				<entry value="login" key="uid" />
+			</map>
+		</property>
+	</bean>
+
 </beans>
ViewGit