首先你需要在登陆认证的过程中将获取的到的对象传入
//装配认证信息
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
//用户名
userInfo,
//密码
userInfo.getPassword(),
//salt
ByteSource.Util.bytes(userInfo.getCredentialsSalt()),
//realm name
getName()
);
其次呢,你需要如下即可获取
Subject subject = SecurityUtils.getSubject(); Object principal = subject.getPrincipal();
本文详细介绍了使用Shiro进行用户登录认证的过程。包括如何创建SimpleAuthenticationInfo对象,并设置用户名、密码、salt及realmname等关键参数。此外还介绍了如何通过SecurityUtils获取当前Subject及其Principal。
4955

被折叠的 条评论
为什么被折叠?



