<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"
       default-lazy-init="true">

	<description>Shiro安全配置</description>

	<!-- Shiro's main business-tier object for web-enabled applications -->
	<bean id="securityManager" class="com.house365.web.shiro.CustomSecurityManager">
		<property name="realm" ref="shiroRealm" />
		<property name="cacheManager" ref="shiroEhcacheManager" />
	</bean>

	<bean id="shiroRealm" class="com.house365.web.shiro.CustomRealm">
		<property name="defaultRoles" value="ROLE_USER" />
		<property name="roleAttributeNames" value="roles" />
		<property name="permissionAttributeNames" value="permissions" />
	</bean>

	<!-- 用户授权信息Cache, 采用EhCache -->
	<bean id="shiroEhcacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
		<property name="cacheManagerConfigFile" value="classpath:ehcache-shiro.xml" />
	</bean>

	<!-- Shiro Filter -->
	<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
		<property name="securityManager" ref="securityManager" />
		<property name="loginUrl" value="/login" />
		<!-- <property name="successUrl" value="/" /> -->
		<property name="unauthorizedUrl" value="/"></property> 
		<property name="filterChainDefinitions">
			<value>
				/index/=authc,perms[GL] 
				/customer/=authc,perms[SJGH] 
				/statstic/status/=authc,perms[TJFX] 
				/statistic/projectSource/=authc,perms[TJFX] 
				/statstic/customer/=authc,perms[TJFX] 
				/statstic/user/=authc,perms[TJFX] 
				/statistic/projectTransform/=authc,perms[TJFX] 
				/notice/=authc,perms[GGGL] 
				
				/customer/myCustomer=authc,perms[WDKH] 
				
				/project/myProjects=authc,perms[WDZCXM] 
				/project=authc,perms[XMLB]
				
				/department/main=authc,perms[ZZJG] 
				/role=authc,perms[QXZGL]
				/appversion=authc,perms[BBGL]
				/platformmanagement=authc,perms[PTKHFPGZ]
				
				/customersource=authc,perms[SJBSC]
				/report=authc,perms[HDLYGL]
				/callbackrecord=authc,perms[HFLY]

                /evaluateusercustomerlog/evaluate/**=anon
                /evaluateusercustomerlog/**=anon
				/oaLogin=anon
				/resources/**=anon
				/login=anon
				/doLogin=anon
				/rest/**=anon
				/secure/**=anon
				/**=authc
				/platformmanagement/**=anon
			</value>
		</property>
	</bean>

	<!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->
	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />

</beans>
