spring-shiro.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.xsd">
<!--創建域-->
<bean id="authRealm" class="ssm.shiro.realm.AuthRealm">

</bean>
<!--創建安全認證管理器-->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="authRealm"></property>

</bean>
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager"></property>
<property name="loginUrl" value="/people/toLogin.do"></property>
<property name="unauthorizedUrl" value="error.jsp"></property>
<property name="filterChainDefinitions">
<value>
<!--對靜態資源不攔截-->
/static/*=anon
/people/login.do=anon
/people/toLogin.do=anon
/people/error.do=anon
/people/index.do=anon
<!--配置/user/list.do只有有user權限的用戶才能訪問
/user/list.do=perms[user:list]
-->
<!--聲明/user/logout.do使用logout的過濾器
該過濾器會自動幫我們清除退出登錄時要清除的東西
-->
/people/logout.do=logout
/*=authc
/*/*=authc
</value>
</property>
</bean>
</beans>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM