|
|
@@ -5,6 +5,7 @@ import cn.reghao.tnb.account.api.dto.*;
|
|
|
import cn.reghao.tnb.account.api.iface.AccountQuery;
|
|
|
import cn.reghao.tnb.account.app.db.repository.AccountRepository;
|
|
|
import cn.reghao.tnb.account.app.model.po.UserAccount;
|
|
|
+import cn.reghao.tnb.account.app.security.form.AccountAuthToken;
|
|
|
import cn.reghao.tnb.account.app.service.AccountTokenService;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
|
@@ -35,14 +36,15 @@ public class AccountQueryImpl implements AccountQuery {
|
|
|
|
|
|
@Override
|
|
|
public AuthedAccount getAuthedAccount(int type, String sessId) {
|
|
|
- long userId = accountTokenService.getUserId(type, sessId);
|
|
|
- if (userId != -1L) {
|
|
|
- UserAccount userAccount = accountRepository.getUserAccountByUserId(userId);
|
|
|
+ AccountAuthToken accountAuthToken = accountTokenService.getAuthToken(type, sessId);
|
|
|
+ if (accountAuthToken != null) {
|
|
|
+ String loginId = accountAuthToken.getLoginId();
|
|
|
+ long userId = accountAuthToken.getUserId();
|
|
|
String userIdStr = userIdObfuscation.obfuscate(userId);
|
|
|
- Set<String> roles = userAccount.getAuthorities().stream()
|
|
|
+ Set<String> roles = accountAuthToken.getAuthorities().stream()
|
|
|
.map(GrantedAuthority::getAuthority)
|
|
|
.collect(Collectors.toSet());
|
|
|
- return new AuthedAccount(userId, userIdStr, roles);
|
|
|
+ return new AuthedAccount(loginId, userId, userIdStr, roles);
|
|
|
}
|
|
|
|
|
|
return null;
|