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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
   | <?xml version="1.0" encoding="UTF-8"?>
 
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:security="http://www.springframework.org/schema/security"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd">
 
	<bean id="springSecurityFilterChain" class="org.springframework.security.util.FilterChainProxy">
		<security:filter-chain-map path-type="ant">
			<security:filter-chain pattern="/**" filters="httpSessionContextIntegrationFilter, exceptionTranslationFilter, ntlmFilter, filterSecurityInterceptor" />
		</security:filter-chain-map>
	</bean>
 
	<bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.context.HttpSessionContextIntegrationFilter">
		<property name="contextClass" value="org.springframework.security.context.SecurityContextImpl" />
	</bean>
 
	<bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter">
		<property name="authenticationEntryPoint">
			<bean id="ntlmFilterEntryPoint" class="org.springframework.security.ui.ntlm.NtlmProcessingFilterEntryPoint">
				<property name="authenticationFailureUrl" value="/index.jsp" />
			</bean>
		</property>
	</bean>
 
	<!-- FILTRE NTLM -->
	<bean id="ntlmFilter" class="org.springframework.security.ui.ntlm.NtlmProcessingFilter">
		<property name="domainController" value="monDC" />
		<property name="defaultDomain" value="monDomaine" />
		<property name="authenticationManager" ref="authenticationManager" />
		<property name="forceIdentification" value="true" />
	</bean>
 
	<bean id="filterSecurityInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
		<property name="authenticationManager">
			<ref local="authenticationManager" />
		</property>
		<property name="accessDecisionManager">
			<bean class="org.springframework.security.vote.UnanimousBased">
				<property name="decisionVoters">
					<list>
						<bean class="org.springframework.security.vote.RoleVoter" />
					</list>
				</property>
			</bean>
		</property>
		<property name="objectDefinitionSource">
			<security:filter-invocation-definition-source>
				<security:intercept-url pattern="/**" access="MON_GROUPE_AD" />
			</security:filter-invocation-definition-source>
		</property>
	</bean>
 
	<bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager">
		<property name="providers">
			<list>
				<ref local="ldapAuthProvider" />
			</list>
		</property>
	</bean>
 
	<bean id="ldapAuthProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
		<constructor-arg>
			<bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
				<constructor-arg ref="contextSource"/>
				<property name="userDnPatterns"><list><value>sAMAccountName={0}</value></list></property>
			</bean>
		</constructor-arg>
		<constructor-arg>
			<bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
				<constructor-arg ref="contextSource"/>
				<constructor-arg value="ou=Groups"/>
				<property name="groupRoleAttribute" value="ou"/>
				<property name="searchSubtree" value="true" />
			</bean>
		</constructor-arg>
	</bean>
 
 
	<bean id="daoAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider">
	<property name="userDetailsService">
		<bean class="org.springframework.security.userdetails.ldap.LdapUserDetailsManager">
			<constructor-arg index="0" ref="contextSource" />
		</bean>
	</property>
	</bean>
 
	<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
		<constructor-arg value="ldap://moncontroleur:389/dc=monentreprise,dc=fr" />
		<property name="userDn" value="admin" />
		<property name="password" value="secret"/>	
	</bean>
 
</beans> | 
Partager