Shiro controller中获取当前登录用户信息

Posted gzhbk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Shiro controller中获取当前登录用户信息相关的知识,希望对你有一定的参考价值。

@RequestMapping(value = "/competitorPageList" )
public String competitorPageList(Model model, ) {

Long currentUserId = (Long) SecurityUtils.getSubject().getSession().getAttribute("currentUserId");
}
1
2
3
4
5
方式二:

@RequestMapping(value = "/competitorPageList" )
public String competitorPageList(Model model,HttpServletRequest request ) {
Long currentUserId = (Long) request.getSession().getAttribute("currentUserId");
}
————————————————
版权声明:本文为CSDN博主「fengcai0123」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fengcai0123/article/details/75235861

以上是关于Shiro controller中获取当前登录用户信息的主要内容,如果未能解决你的问题,请参考以下文章

springsecurity-shiro获取登录用户详解

Shiro-认证

shiro登录认证过程讲解

shiro用户登录认证

Shiro学习(24)在线回话管理

Shiro入门到精通之shiro认证流程