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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- FOR EASIER INJECTION (Not Working) -->
<tx:annotation-driven/>
<context:component-scan base-package="beans"/>
<!-- DEFAULT VALUES FOR SYSTEM PROPERTIES -->
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<props>
<prop key="application.default.property.key">propertyDefalutValue</prop>
</props>
</property>
<property name="systemPropertiesModeName">
<value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
</property>
<property name="ignoreResourceNotFound" value="true"/>
<property name="locations">
<list>
<value>classpath:config.properties</value>
<!-- value>file:${user.home}/application.properties</value-->
</list>
</property>
</bean>
<!-- CONNECTION TO ACTIVE DIRECTORY -->
<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<constructor-arg index="0" value="ldap://xxx.net:389/cn=Users,dc=xxx,dc=net" />
<property name="userDn" value="xxx\xxx" />
<property name="password" value="xxxyyy" />
</bean>
<!-- OBJECT MAKINGS SEARCHES INTO ACTIVE DIRECTORY -->
<bean id="ldapUserSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
<constructor-arg index="0" value="ou=users" />
<constructor-arg index="1" value="(sAMAccountName={0})" /> <!-- Critère de recherche LDAP, ici le login de l'utilisateur correspond à l'uid de l'entrée LDAP -->
<constructor-arg index="2" ref="contextSource" />
<property name="searchSubtree" value="true" />
</bean>
<!-- MANAGING RIGHTS -->
<bean id="testLdapAuthoritiesPopulator" class="com.XXX.test.TestLdapAuthoritiesPopulator"/>
<!-- LDAP PROVIDER -->
<bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<constructor-arg index="0">
<bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
<constructor-arg index="0" ref="contextSource" />
<property name="userSearch" ref="ldapUserSearch" />
</bean>
</constructor-arg>
<constructor-arg index="1">
<!-- <bean ref="testLdapAuthoritiesPopulator" /> -->
<bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="contextSource"/>
<constructor-arg value="ou=users"/>
<property name="groupRoleAttribute" value="ou"/>
</bean>
</constructor-arg>
</bean>
<!--<bean id="springSecurityFilterChain" class="org.springframework.web.filter.Spring ">
</bean>
-->
</beans> |
Partager