spring mvc shiro 配置
来源:互联网 发布:出国旅游软件 编辑:程序博客网 时间:2024/05/17 04:50
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="securityCacheManager" class="com.xxx.security.cache.SecurityCacheManager" />
<!-- 安全框架配置 -->
<bean id="securityService" class="com.xxx.security.service.impl.SecurityServiceDBImpl">
<property name="credentialsMatcher" ref="hashedCredentialsMatcher" />
</bean>
<bean id="sessionIdGenerator" class="com.xxx.security.SessionIdGeneratorImpl" />
<bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
<property name="activeSessionsCacheName" value="${session.cache.name}" />
<property name="sessionIdGenerator" ref="sessionIdGenerator" />
</bean>
<bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler">
<property name="interval" value="${session.clear.interval}" />
<property name="sessionManager" ref="sessionManager" />
</bean>
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<property name="globalSessionTimeout" value="${session.global.timeout}" />
<property name="sessionDAO" ref="sessionDAO" />
<property name="sessionValidationScheduler" ref="sessionValidationScheduler" />
</bean>
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="securityService" />
<!--<property name="sessionManager" ref="sessionManager" />-->
<property name="cacheManager" ref="securityCacheManager" />
</bean>
<bean id="hashedCredentialsMatcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
<property name="hashAlgorithmName" value="MD5" />
</bean>
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
<bean id="formAuthenticationFilter" class="com.xxx.security.CaptchaFormAuthenticationFilter">
<property name="usernameParam" value="username" />
<property name="passwordParam" value="password" />
<property name="captchaParam" value="captcha" />
<property name="rememberMeParam" value="rememberme" />
<property name="failureKeyAttribute" value="loginFailureKey" />
</bean>
<bean id="securityFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="/login.htm" />
<property name="successUrl" value="/index.htm" />
<property name="unauthorizedUrl" value="/login.htm" />
<property name="filters">
<util:map>
<entry key="authc" value-ref="formAuthenticationFilter" />
</util:map>
</property>
<property name="filterChainDefinitions">
<value>
/login.htm* = authc
/**/isCaptcha.htm = anon
/forgotpw.htm* = anon
/favicon.ico = anon
/image/** = anon
/css/** = anon
/js/** = anon
/** = user
</value>
</property>
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="securityCacheManager" class="com.xxx.security.cache.SecurityCacheManager" />
<!-- 安全框架配置 -->
<bean id="securityService" class="com.xxx.security.service.impl.SecurityServiceDBImpl">
<property name="credentialsMatcher" ref="hashedCredentialsMatcher" />
</bean>
<bean id="sessionIdGenerator" class="com.xxx.security.SessionIdGeneratorImpl" />
<bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
<property name="activeSessionsCacheName" value="${session.cache.name}" />
<property name="sessionIdGenerator" ref="sessionIdGenerator" />
</bean>
<bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler">
<property name="interval" value="${session.clear.interval}" />
<property name="sessionManager" ref="sessionManager" />
</bean>
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<property name="globalSessionTimeout" value="${session.global.timeout}" />
<property name="sessionDAO" ref="sessionDAO" />
<property name="sessionValidationScheduler" ref="sessionValidationScheduler" />
</bean>
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="securityService" />
<!--<property name="sessionManager" ref="sessionManager" />-->
<property name="cacheManager" ref="securityCacheManager" />
</bean>
<bean id="hashedCredentialsMatcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
<property name="hashAlgorithmName" value="MD5" />
</bean>
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
<bean id="formAuthenticationFilter" class="com.xxx.security.CaptchaFormAuthenticationFilter">
<property name="usernameParam" value="username" />
<property name="passwordParam" value="password" />
<property name="captchaParam" value="captcha" />
<property name="rememberMeParam" value="rememberme" />
<property name="failureKeyAttribute" value="loginFailureKey" />
</bean>
<bean id="securityFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="loginUrl" value="/login.htm" />
<property name="successUrl" value="/index.htm" />
<property name="unauthorizedUrl" value="/login.htm" />
<property name="filters">
<util:map>
<entry key="authc" value-ref="formAuthenticationFilter" />
</util:map>
</property>
<property name="filterChainDefinitions">
<value>
/login.htm* = authc
/**/isCaptcha.htm = anon
/forgotpw.htm* = anon
/favicon.ico = anon
/image/** = anon
/css/** = anon
/js/** = anon
/** = user
</value>
</property>
</bean>
</beans>
0 0
- spring mvc shiro 配置
- shiro配置----spring-mvc.xml
- shiro在Spring MVC + hibernate 中配置
- spring mvc中 shiro logout 配置方式
- spring mvc +hibernate +spring +shiro 实现权限管理详细配置
- Shiro+Spring MVC整合
- Shiro+Spring MVC整合
- spring mvc + shiro
- spring mvc+Mybatis整合shiro 第一章 整体配置
- Spring-mvc与shiro配置遇到的问题
- Shiro系列之Shiro+Spring MVC整合
- Shiro系列之Shiro+Spring MVC整合
- 【Shiro + Spring MVC整合】教程
- Spring mvc + MyBatis 整合Shiro
- Spring MVC 急速集成 Shiro
- Spring mvc+shiro+ehcache整合
- spring mvc与shiro整合
- spring+springmvc+shiro配置
- 关于select标签的一些操作总结
- View的位置参数
- Hdu::Quoit Design
- 利用jsonp实现百度搜索下拉框
- 夜
- spring mvc shiro 配置
- 每天学习一点点——linux命令(7):mv
- poj2965——The Pilots Brothers' refrigerator(模拟)
- 数据结构学习总结
- Poj2479-Maximum sum
- Cocos Creator 初识编辑器界面
- KISSY基础篇乄KISSY之HelloWorld
- Linux的scp命令
- IEC60870-5-103规约通讯过程