tao1027879132 2015-08-20 02:08 采纳率: 100%
浏览 23876
已采纳

shiro和spring集成时session管理器超时时间问题

这是我的配置文件,我配置了并发人数控制和动态权限过滤,然后session超时时间这里也是配置了的,然后并没有什么鸟用,在登录以后获取超时时间也是正常的,但还是1分钟就过期了。

<?xml version="1.0" encoding="UTF-8"?>
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject" ref="shiroFilter"/>
    <property name="targetMethod" value="setFilterChainResolver"/>
    <property name="arguments" ref="filterChainResolver"/>
</bean>
<bean id="filterChainResolver"   class="com.sfkj.platform.shiro.CustomPathMatchingFilterChainResolver">  
    <property name="customDefaultFilterChainManager" ref="filterChainManager"/>  
</bean>  
<bean id="filterChainManager"    class="com.sfkj.platform.shiro.CustomDefaultFilterChainManager">  
    <property name="loginUrl" value="/index/redirect.html"/>  
    <property name="successUrl" value="/index/redirect.html"/>  
    <property name="unauthorizedUrl" value="/index/unauthorizedUrl.html"/>  
    <property name="customFilters">  
        <util:map>  
            <entry key="kickout" value-ref="kickoutSessionControlFilter"/> 
            <entry key="sysUser" value-ref="sysUserFilter"/>
        </util:map>  
    </property>  
    <property name="defaultFilterChainDefinitions">  
        <value>  
            <!-- /login = authc  
            /logout = logout  
            /unauthorized.jsp = authc  
            /** = user,sysUser  --> 
            /admin/**=kickout
            /** =anon
        </value>  
    </property>  
</bean>  
 <bean id="sysUserFilter" class="com.sfkj.platform.shiro.SysUserFilter"/>
<bean id="kickoutSessionControlFilter"   class="com.sfkj.platform.shiro.KickoutSessionControlFilter">  
    <property name="cacheManager" ref="cacheManager"/>  
    <property name="sessionManager" ref="sessionManager"/>  
    <property name="kickoutAfter" value="false"/>  
    <property name="maxSession" value="1"/>  
    <property name="kickoutUrl" value="/index/kickoutUrl.html"/>  
</bean> 
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
    <property name="securityManager" ref="securityManager" />
</bean>
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
    <property name="realm" ref="userRealm" />
    <property name="cacheManager" ref="cacheManager" />
    <property name="sessionManager" ref="sessionManager"/>
</bean>
<bean id="userRealm" class="com.sfkj.platform.shiro.UserRealm"/> 
 <!-- 缓存管理器 使用Ehcache实现 -->
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
    <property name="cacheManager" ref="ehCacheManager"/>
    <property name="cacheManagerConfigFile" value="classpath:ehcache-shiro.xml"/>
</bean>
<bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>

  <!-- 会话管理器 -->
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
    <property name="globalSessionTimeout" value="604800000"/>
    <property name="deleteInvalidSessions" value="true"/>
    <property name="sessionValidationSchedulerEnabled" value="true"/>
    <!--  <property name="sessionValidationScheduler" ref="sessionValidationScheduler"/>  -->
    <property name="sessionDAO" ref="sessionDAO"/>
    <property name="sessionIdCookieEnabled" value="true"/>
    <property name="sessionIdCookie" ref="sessionIdCookie"/>
</bean>
<!-- 会话验证调度器 -->
<!--<bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.quartz.QuartzSessionValidationScheduler">
    <property name="sessionValidationInterval" value="1800000"/>
    <property name="sessionManager" ref="sessionManager"/>
</bean> -->
<!-- 会话DAO -->
<bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
    <property name="activeSessionsCacheName" value="shiro-activeSessionCache"/>
    <property name="sessionIdGenerator" ref="sessionIdGenerator"/>
</bean>
<!-- 会话ID生成器 -->
<bean id="sessionIdGenerator" class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator"/>
 <!-- 会话Cookie模板 -->
<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
    <constructor-arg value="sid"/>
    <property name="httpOnly" value="true"/>
    <property name="maxAge" value="-1"/>
</bean>

 <!-- Shiro生命周期处理器-->
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>




maxEntriesLocalHeap="2000"
eternal="false"
timeToIdleSeconds="604800"
timeToLiveSeconds="0"
overflowToDisk="false"
statistics="true">

maxEntriesLocalHeap="2000"
eternal="false"
timeToIdleSeconds="604800"
timeToLiveSeconds="0"
overflowToDisk="false"
statistics="true">

maxEntriesLocalHeap="2000"
eternal="false"
timeToIdleSeconds="604800"
timeToLiveSeconds="0"
overflowToDisk="false"
statistics="true">

maxEntriesLocalHeap="2000"
eternal="false"
timeToIdleSeconds="604800"
timeToLiveSeconds="0"
overflowToDisk="false"
statistics="true">


  • 写回答

8条回答 默认 最新

  • tao1027879132 2016-08-08 03:00
    关注

    具体是什么原因我还没找到,希望知道的朋友说一声 谢谢 qq就是我的名字 大家相互讨论

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗