<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" >
<beans>
	<bean id="userDetailsService" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
	  <property name="userMap">
	    <value>
	      blueuser=password,ROLE_BASIC,LABEL_BLUE
	      superuser=password2,ROLE_BASIC,LABEL_SHARED
	      orangeuser=password3,ROLE_BASIC,LABEL_ORANGE
	      multiuser=password4,ROLE_BASIC,LABEL_BLUE,LABEL_ORANGE
	    </value>
	  </property>
	</bean>
		
	<bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
	  <property name="userDetailsService"><ref bean="userDetailsService"/></property>
	</bean>        
	
	<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
	  <property name="providers">
	    <list>
	      <ref local="daoAuthenticationProvider"/>
	    </list>
	  </property>
	</bean>

	<bean id="accessDecisionManager" class="org.acegisecurity.vote.UnanimousBased">
		<property name="allowIfAllAbstainDecisions"><value>false</value></property>
		<property name="decisionVoters">
			<list>
				<bean class="org.acegisecurity.vote.RoleVoter"/>
				<bean class="org.acegisecurity.vote.LabelBasedAclVoter">
					<property name="attributeIndicatingLabeledOperation"><value>LABELED_OPERATION</value></property>
					<property name="labelMap">
						<map>
							<entry key="LABEL_BLUE">
								<list>
									<value>blue</value>
									<value>blue-orange</value>
								</list>
							</entry>
							<entry key="LABEL_ORANGE">
								<list>
									<value>orange</value>
									<value>blue-orange</value>
								</list>
							</entry>
							<entry key="LABEL_SHARED">
								<list>
									<value>blue</value>
									<value>orange</value>
									<value>blue-orange</value>
								</list>
							</entry>
						</map>
					</property>
				</bean>
			</list>
		</property>
	</bean>
	
	<bean id="securityInteceptor"
		class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
	  <property name="validateConfigAttributes"><value>false</value></property>
	  <property name="authenticationManager"><ref bean="authenticationManager"/></property>
	  <property name="accessDecisionManager"><ref bean="accessDecisionManager"/></property>
	  <property name="objectDefinitionSource">
	    <value>
	      org.acegisecurity.vote.SampleService.get*=ROLE_BASIC
	      org.acegisecurity.vote.SampleService.do*=ROLE_BASIC,LABELED_OPERATION
	    </value>
	  </property>
	</bean>
	
    <bean id="perfOfSecurity" class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor">
    	<property name="prefix"><value>Security: </value></property>
    </bean>
    
	<bean id="sampleService" class="org.acegisecurity.vote.SampleServiceImpl"/>
	
 	<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
	  <property name="beanNames"><value>sampleService</value></property>
	  <property name="interceptorNames">
	    <list>
	      <value>perfOfSecurity</value>
	      <value>securityInteceptor</value>
	    </list>
	  </property>
	</bean>

</beans>
