NutzCN Logo
问答 请问退出浏览器后怎样实现账号也退出登录?
发布于 105天前 作者 qq_16db7f4e 146 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

用nutz框架写的java项目,退出浏览器后还再打开还是能查看网页,退出浏览器后怎样实现账号也退出登录?

7 回复

做了session持久化?

[main]
# cacheManager
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile=classpath:ehcache.xml


;jedisAgent = org.nutz.integration.jedis.JedisAgent
;cacheManager_ehcache = org.apache.shiro.cache.ehcache.EhCacheManager
;cacheManager_ehcache.cacheManagerConfigFile=classpath:ehcache.xml
;cacheManager_redis = org.nutz.plugins.cache.impl.redis.RedisCacheManager
;cacheManager_redis.mode=kv
;cacheManager_redis.debug=true
;cacheManager = org.nutz.plugins.cache.impl.lcache.LCacheManager
;cacheManager.jedisAgent = $jedisAgent
;cacheManager.level1 = $cacheManager_ehcache
;cacheManager.level2 = $cacheManager_redis

# Session
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager

# Session Cache
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionDAO.cacheManager=$cacheManager
sessionDAO.activeSessionsCacheName=shiro-activeSessionCache
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager

# Cookie
sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
#sessionIdCookie.domain=wizzer.cn
#sessionIdCookie.path=
sessionIdCookie.maxAge=1800000
sessionIdCookie.httpOnly=true
sessionManager.sessionIdCookie=$sessionIdCookie
sessionManager.sessionIdCookieEnabled=true
sessionManager.globalSessionTimeout=1800000
sessionManager.sessionValidationSchedulerEnabled = true

#bak...
#sessionManager=org.apache.shiro.web.session.mgt.DefaultWebSessionManager
#sessionListener1 = cn.wizzer.common.shiro.listener.MySessionListener
#sessionManager.sessionListeners = $sessionListener1
#sessionManager.globalSessionTimeout=50000
#securityManager.sessionManager=$sessionManager

rememberMeCookie = org.apache.shiro.web.servlet.SimpleCookie
rememberMeCookie.name=remember
rememberMeCookie.maxAge = 604800
rememberMeCookie.httpOnly = true
rememberMeManager = org.apache.shiro.web.mgt.CookieRememberMeManager
rememberMeManager.cookie = $rememberMeCookie

sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
sha256Matcher.storedCredentialsHexEncoded = false
sha256Matcher.hashIterations = 1024
sha256Matcher.hashSalted = true

shiroDbRealm = cn.wizzer.common.shiro.realm.NutDaoRealm
shiroDbRealm.credentialsMatcher = $sha256Matcher

securityManager.realms = $shiroDbRealm
authcStrategy = cn.wizzer.common.shiro.authc.pam.AnySuccessfulStrategy
securityManager.authenticator.authenticationStrategy = $authcStrategy
securityManager.cacheManager = $cacheManager
securityManager.rememberMeManager = $rememberMeManager

authc = cn.wizzer.common.shiro.filter.SimpleAuthenticationFilter
authc.loginUrl  = /platform/login
logout.redirectUrl= /platform/login

[urls]
/platform/doLogin    = anon
/assets/**          = anon
/**                 = anon
/platform/**         = authc

请问应该怎么实现啊

1800000改小嘛

sessionIdCookie.maxAge=600

哦, 你想要的是关掉浏览器就失效,那应该改成-1

sessionIdCookie.maxAge=-1
添加回复
请先登陆
回到顶部