1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
<beans:bean id="contextSource"
class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<beans:constructor-arg index="0"
value="ldap://clusterldap.masociete.com:389/dc=corp,dc=masociete,dc=com" />
<beans:property name="userDn" value="cn=readldap,dc=masociete,dc=com" />
<beans:property name="password" value="lecture" />
</beans:bean>
<beans:bean id="ldapUserSearch"
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
<beans:constructor-arg index="0" value="ou=people" /> <!-- Branche principale à partir de laquelle faire la recherche -->
<beans:constructor-arg index="1" value="(uid={0})" /> <!-- Critère de recherche LDAP, ici le login de l'utilisateur correspond
à l'uid de l'entrée LDAP -->
<beans:constructor-arg index="2" ref="contextSource" />
<beans:property name="searchSubtree" value="true" /> <!-- Recherche dans les sous-branches -->
</beans:bean>
<beans:bean id="myAuthoritiesPopulator"
class="com.masociete.monprojet.web.MyAuthoritiesPopulator" />
<beans:bean id="ldapAuthProvider"
class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<beans:constructor-arg index="0">
<beans:bean
class="org.springframework.security.ldap.authentication.BindAuthenticator">
<beans:constructor-arg index="0" ref="contextSource" />
<beans:property name="userSearch" ref="ldapUserSearch" />
</beans:bean>
</beans:constructor-arg>
<beans:constructor-arg index="1"
ref="myAuthoritiesPopulator" />
</beans:bean>
<authentication-manager alias="authenticationManager">
<authentication-provider ref="ldapAuthProvider" />
</authentication-manager>
<!-- reste de la conf a faire pour mapper directement --> |
Partager