diff --git a/source/_posts/shiro-spring.md b/source/_posts/shiro-spring.md index 8f85b49..d1cc9e5 100644 --- a/source/_posts/shiro-spring.md +++ b/source/_posts/shiro-spring.md @@ -342,7 +342,7 @@ public class UsernameRealm extends AuthoringRealm { protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { var token = (UsernamePasswordToken) authenticationToken; return memberRepository.findMemberByUsername((String) token.getPrincipal()) - .map(member -> new SimpleAuthenticationInfo(member, member.getPassword(), member.getFulLName())) + .map(member -> new SimpleAuthenticationInfo(member.getUsername(), member.getPassword(), "UsernameRealm")) .orElseThrow(() -> new AuthenticationException("用户不存在。")); } } @@ -406,7 +406,7 @@ public class TokenRealm extends AuthorizingRealm { // 在BearerToken中,无论是principal还是crendentials里保存的都是用户令牌信息 return storeRepository.findTokenById(token.getToken()) .filter(t -> t.getExpires().isAfter(LocalDateTime.now())) - .map(t -> new SimpleAuthenticationInfo(t.getMember(), t.getToken(), t.getMember().getFulLName())) + .map(t -> new SimpleAuthenticationInfo(t.getMember().getUsername(), t.getToken(), "TokenRealm")) .orElseThrow(() -> new AuthenticationException("用户令牌不存在。")); } }