GZMachinesWeb/build/classes/spring/spring-shiro.xml

84 lines
2.9 KiB
XML
Raw Normal View History

2025-06-20 17:47:53 +08:00
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.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/machine/** = anon
/gpsbinding/** = anon
/backstage/machineType/** = anon
/backstage/partstype/** = anon
/backstage/partcoller/** = anon
/backstage/company/** = anon
/backstage/project/** = anon
/backstage/qrcode/** = anon
/backstage/vender/** = anon
/images/** = anon
/upload/** = anon
/optInfo/** = anon
/machineImg/** = anon
/maTypeFile/** = 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
/upgrade/** = anon
/upload/** = anon
/WEB-INF/views/** = anon
/backstage/client/** = anon
/backstage/checkQrCode/** = anon
/libs/images/** = anon
/filePath/** = anon
/** = authc
</value>
</property>
<property name="filters">
<util:map>
<entry key="jwt" value-ref="jwtFilter"/>
</util:map>
</property>
</bean>
<!-- JWT Filter -->
<bean id="jwtFilter" class="com.bonus.core.jwt.JwtFilter"></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>