shiro学习笔记1

shrio会话管理.

http://shiro.apache.org/session-management.html#SessionManagement-UsingSessions

Using Sessions

Subject currentUser = SecurityUtils.getSubject();

Session session = currentUser.getSession();
session.setAttribute( "someKey", someValue);

getSession()是getSession(true)的简写,有则返回,无则创建一个新的并返回.

getSession(false),有则返回, 无返回null.

Custom Session IDs

you can implement the SessionIdGenerator interface and configure the implementation on Shiro’s SessionDAO instance.

Session Validation & Scheduling

SessionValidationScheduler可以清理孤立的会话.

默认的调度是1小时一次.

如果使用redis代替shiro session, 需要有个调度任务, 每隔一段时间查询下失效的session(猜测session每次访问都会被更新时间,当长久不更新的session将被清除)

转载于:https://www.cnblogs.com/liyudong1991/p/11017710.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值