52 lines
2.0 KiB
XML
52 lines
2.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
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-4.0.xsd"
|
|
default-lazy-init="true">
|
|
|
|
<description>Shiro Configuration</description>
|
|
|
|
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
|
|
<property name="realm" ref="ShiroRealm" />
|
|
</bean>
|
|
|
|
<!-- 項目自定义的Realm -->
|
|
<bean id="ShiroRealm" class="com.bonus.sys.ShiroRealm"></bean>
|
|
|
|
<!-- Shiro Filter -->
|
|
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
|
|
<property name="securityManager" ref="securityManager" />
|
|
<property name="loginUrl" value="/loginIndex" />
|
|
<property name="successUrl" value="/backstage/index" />
|
|
<property name="unauthorizedUrl" value="/loginIndex" />
|
|
<!-- anon:匿名拦截器,即不需要登录即可访问;一般用于静态资源过滤 authc:如果没有登录会跳到相应的登录页面登录 user:用户拦截器,用户已经身份验证/记住我登录的都可 -->
|
|
<property name="filterChainDefinitions">
|
|
<value>
|
|
/backstage/app/** = anon
|
|
/backstage/machines/** = anon
|
|
/static/build/generic/web/** = anon
|
|
/static/js/login/** = anon
|
|
/static/js/system/** = authc
|
|
/static/** = anon
|
|
/favicon.ico = anon
|
|
/verifyCode/** = anon
|
|
/system_login = anon
|
|
/exterInt/** = anon
|
|
/weixin/** = anon
|
|
/upload/** = anon
|
|
/WEB-INF/views/** = anon
|
|
/** = authc
|
|
</value>
|
|
</property>
|
|
</bean>
|
|
|
|
<!-- AOP式方法级权限检查 -->
|
|
<bean
|
|
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
|
|
depends-on="lifecycleBeanPostProcessor">
|
|
<property name="proxyTargetClass" value="true" />
|
|
</bean>
|
|
|
|
<!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->
|
|
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
|
|
</beans> |