使用shiro登陆成功后将用户信息保存到session

如题所述

第1个回答  2022-06-21
controller中进行参数合法性检验后,由service执行subject的login方法,若未发生异常,则登陆成功,再此直接通过 subject.getPrincipal(); ,将其存入 subject.getSession(); 即可

thymeleaf中使用session可以正常获取