Shiro 緩衝失效以後的一個問題,shiro失效

來源:互聯網
上載者:User

Shiro 緩衝失效以後的一個問題,shiro失效

shiro 1.2.2和1.2.3

 

為shiro設定了緩衝,但是當伺服器運行幾個小時後,頁面判斷

 

<shiro:hasPermission name="admin">
<li class="mail">有許可權
</li>
</shiro:hasPermission>

 

一直未顯示。重新登陸也無效。判斷問題應該是,實際緩衝失效了,但是架構仍然認為有效。

嘗試無效辦法

(1)

倘若把shiro對應的ehcache配置文章,該掉設定,

timeToIdleSeconds="10"
timeToLiveSeconds="10"

 

該問題依舊出現。但出問題頻次減少

(2)在application-shiro裡面添加

<bean id="sessionManager"

class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<!-- 逾時時間 -->
<property name="globalSessionTimeout" value="3600" />
<property name="sessionDAO" ref="sessionDAO" />

<!-- 定時檢查失效的session -->
<property name="sessionValidationSchedulerEnabled" value="true" />
</bean>

<bean id="sessionDAO"
class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
<property name="activeSessionsCacheName" value="shiro-activeSessionCache" />
</bean>

依舊沒用

google到 http://stackoverflow.com/questions/17657283/cache-invalidate-not-working-in-shiro

 

第一驗證許可權的時候,主動清除緩衝。

protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)     throws AuthenticationException {    ...    SimplePrincipalCollection principals = new SimplePrincipalCollection(username, "jndiJdbcRealm");    super.doClearCache(principals);    ...}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.