Added attributeRepository bean (LdapPersonAttributeDao)
Benjamin Renard

Benjamin Renard commited on 2014-12-11 14:01:00
Showing 1 changed files, with 31 additions and 1 deletions.

... ...
@@ -15,7 +15,8 @@
15 15
 <beans xmlns="http://www.springframework.org/schema/beans"
16 16
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17 17
        xmlns:p="http://www.springframework.org/schema/p"
18
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
18
+       xmlns:util="http://www.springframework.org/schema/util"
19
+       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">
19 20
 	
20 21
 	<!--
21 22
 		|    LDAP authentication.
... ...
@@ -49,4 +50,33 @@
49 50
 		<property name="searchBase" value="${ldap.basedn}" />
50 51
 		<property name="contextSource" ref="contextSource" />
51 52
 	</bean>
53
+
54
+	<util:set id="ldapLoginAttributes">
55
+		<value>uid</value>
56
+		<value>mail</value>
57
+	</util:set>
58
+
59
+	<bean id="attributeRepository"  class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
60
+		<property name="contextSource" ref="contextSource" />
61
+		<property name="baseDN" value="${ldap.basedn}" />
62
+		<property name="requireAllQueryAttributes" value="true" />
63
+
64
+		<property name="queryType" value="OR" />
65
+		<property name="queryAttributeMapping">
66
+			<map>
67
+				<entry key="username" value-ref="ldapLoginAttributes"/>
68
+			</map>
69
+		</property>
70
+
71
+		<property name="resultAttributeMapping">
72
+			<map>
73
+				<entry value="name" key="cn" />
74
+				<entry value="firstname" key="givenName" />
75
+				<entry value="lastname" key="sn" />
76
+				<entry value="mail" key="mail" />
77
+				<entry value="login" key="uid" />
78
+			</map>
79
+		</property>
80
+	</bean>
81
+
52 82
 </beans>
53 83