<?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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-3.0.xsd
						http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">

	<sec:http>
		<!-- Slip in a bean property name EL test -->
		<sec:intercept-url pattern="/**" access="@fsi.getAccessDecisionManager() eq @accessDecisionManager" />
		<sec:form-login />
		<sec:custom-filter ref="fsi" after="FILTER_SECURITY_INTERCEPTOR " />
		<sec:csrf disabled="true"/>
	</sec:http>

	<bean id="fsi" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor">
		<property name="authenticationManager" ref="authenticationManager"/>
		<property name="accessDecisionManager" ref="accessDecisionManager"/>
		<property name="securityMetadataSource">
			<sec:filter-security-metadata-source use-expressions="false">
				<sec:intercept-url pattern="/secure/extreme/**" access="ROLE_2"/>
				<sec:intercept-url pattern="/secure/**" access="ROLE_1"/>
			</sec:filter-security-metadata-source>
		</property>
		<property name="observeOncePerRequest" value="false" />
	</bean>

	<bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
		<constructor-arg>
			<list>
				<bean class="org.springframework.security.access.vote.RoleVoter"/>
			</list>
		</constructor-arg>
		<property name="allowIfAllAbstainDecisions" value="false"/>
	</bean>

	<sec:authentication-manager alias="authenticationManager">
		<sec:authentication-provider>
			<sec:user-service id="userService">
				<sec:user name="notused" password="notused" authorities="ROLE_0,ROLE_1"/>
			</sec:user-service>
		</sec:authentication-provider>
	</sec:authentication-manager>

</beans>
