【发布时间】:2019-08-22 15:14:21
【问题描述】:
我正在我的项目中实现 redis-shiro 会话管理功能,目前我对 Shiro 和 Redis 的信息很少。
我想知道每次调用下面是否会访问redis数据库以检查redis数据库中是否存在任何sessionId。
服务中的代码
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
控制器中的代码:
public String getSomrthing(@CookieValue("JSESSIONID") String fooCookie){
callingSomeServiceMethod(fooCookie);
return "It does not matter";
}
我们是否必须像下面在我们的服务中手动匹配 sessionId 还是 Shiro 会自动匹配它,因为我的应用程序将在多实例环境中运行。?
Subject currentUser = SecurityUtils.getSubject();
if(currentUser.getId.equals(fooCookie)){
//.....Some Code
//.....Some Code
}
【问题讨论】:
标签: java spring-boot redis shiro