简化 mock login 模拟登录的实现,由 TokenAuthenticationFilter 直接实现

This commit is contained in:
YunaiV
2022-05-08 00:17:48 +08:00
parent 73bf0b6f4f
commit baadb5a937
11 changed files with 67 additions and 86 deletions

View File

@ -211,21 +211,6 @@ public class MemberAuthServiceImpl implements MemberAuthService {
return userSessionApi.getLoginUser(token);
}
@Override
public LoginUser mockLogin(Long userId) {
// 获取用户编号对应的 UserDO
MemberUserDO user = userService.getUser(userId);
if (user == null) {
throw new UsernameNotFoundException(String.valueOf(userId));
}
// 执行登陆
createLoginLog(userId, user.getMobile(), LoginLogTypeEnum.LOGIN_MOCK, LoginResultEnum.SUCCESS);
// 创建 LoginUser 对象
return buildLoginUser(user);
}
@Override
public void logout(String token) {
// 查询用户信息