shiro获取登陆用户和不退出修改用户当前信息的方法

一、获取当前用户登录信息

UserDetail user = (UserDetail) subject.getPrincipal();

二、不退出登录修改当前登录信息

//更新session登录信息
UserDetail userDetail = (UserDetail) SecurityUtils.getSubject().getPrincipal();
if (userInfoPO == null || userInfoPO.getId() == null) {
BeanUtils.copyProperties(userPO, userDetail);
} else {
BeanUtils.copyProperties(userInfoPO, userDetail);
}

原文地址:https://www.cnblogs.com/zhangrongfei/p/13272718.html