refactor(auth): 优化用户认证信息获取逻辑
This commit is contained in:
+3
-2
@@ -22,6 +22,7 @@ import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserInfoVo;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.model.SystemUserVo;
|
||||
import cn.odboy.system.framework.operalog.OperationLog;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
@@ -151,8 +152,8 @@ public class SystemUserController {
|
||||
|
||||
@ApiOperation("获取用户信息")
|
||||
@PostMapping(value = "/getCurrentUserInfo")
|
||||
public ResponseEntity<SystemUserInfoVo> getUserInfo() {
|
||||
SystemUserInfoVo userInfoVo = systemAuthService.getCurrentUserInfoVo();
|
||||
public ResponseEntity<SystemUserJwtVo> getUserInfo() {
|
||||
SystemUserJwtVo userInfoVo = systemAuthService.getCurrentUserInfo();
|
||||
return ResponseEntity.ok(userInfoVo);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -83,10 +83,12 @@ public class SystemAuthService {
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
public SystemUserInfoVo getCurrentUserInfoVo() {
|
||||
public SystemUserJwtVo getCurrentUserInfo() {
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo) KitSecurityHelper.getCurrentUser();
|
||||
// 转换是为了去掉密码
|
||||
return KitBeanUtil.copyToClass(jwtUser, SystemUserInfoVo.class);
|
||||
if (jwtUser.getUser() != null) {
|
||||
jwtUser.getUser().setPassword(null);
|
||||
}
|
||||
return jwtUser;
|
||||
}
|
||||
|
||||
public Map<String, Object> getCaptchaInfo() {
|
||||
|
||||
Reference in New Issue
Block a user