You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.7 KiB
XML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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.xsd">
<!--第一步:直接配置一个 securityManager -->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<!--刚配置时先把这条注释掉等后面写了MyRealm.java时再把它的注释去掉因为如果没有去掉就会在
tomcat开启时报一个错误 -->
<!--<property name="realm" ref="myRealm" /> -->
</bean>
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<!-- 第三步:把请求路径拦截之后的处理 -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<!--shiro整个的处理都由securityManger指定和决定 -->
<property name="securityManager" ref="securityManager"/>
<!-- loginUrl==>如果登录成功,跳转到哪个页面,或者执行哪个请求 -->
<property name="loginUrl" value="/login.jsp"/>
<!-- 验证通过执行的请求或者跳转 -->
<property name="successUrl" value="/home.jsp"/>
<!-- 验证不通过执行的请求或者跳转 -->
<property name="unauthorizedUrl" value="/unauthorized.jsp"/>
<!-- 具体的拦截路径和拦截的方式和角色和权限的范围 -->
<property name="filterChainDefinitions">
<value>
</value>
</property>
</bean>
</beans>