This commit is contained in:
efren
2025-06-19 13:59:42 +08:00
parent 93e76dcc46
commit c9edf6a418
6 changed files with 19 additions and 19 deletions

View File

@ -1,8 +1,8 @@
package com.chinaunicom.mall.ebtp.extend.iam.client;
import com.chinaunicom.mall.ebtp.extend.iam.entity.*;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployee;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUser;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployeeDTO;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
@ -56,7 +56,7 @@ public interface IamClient {
* }
*/
@GetMapping("/sign/login/jwt/employee")
IamAuthResponseDTO<IamEmployee> employee(@RequestParam("jwt") String jwt);
IamAuthResponseDTO<IamEmployeeDTO> employee(@RequestParam("jwt") String jwt);
/**
* 获取用户信息接口
@ -64,7 +64,7 @@ public interface IamClient {
* @return IamUserDTO 用户信息
*/
@GetMapping("/sign/api/oauth/v20/me")
IamUser me(@RequestHeader("Authorization") String authorization);
IamUserDTO me(@RequestHeader("Authorization") String authorization);
/**
* code换token
@ -83,6 +83,6 @@ public interface IamClient {
* }
*/
@GetMapping("/sign/authz/oauth/v20/token")
IamToken token(@RequestHeader("Authorization") String authorization, IamTokenRequestDTO request);
IamTokenDTO token(@RequestHeader("Authorization") String authorization, IamTokenRequestDTO request);
}

View File

@ -4,8 +4,8 @@ import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.iam.client.BidRatioClient;
import com.chinaunicom.mall.ebtp.extend.iam.constant.IamEnum;
import com.chinaunicom.mall.ebtp.extend.iam.entity.*;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployee;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUser;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployeeDTO;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUserDTO;
import com.chinaunicom.mall.ebtp.extend.iam.service.IamAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -73,8 +73,8 @@ public class IamAuthController {
*/
@ApiOperation("IAM单点登陆 - jwt使用员工号免密登录")
@GetMapping("/jwt")
public BaseResponse<IamEmployee> employee(@RequestParam("jwt") String jwt) {
IamAuthResponseDTO<IamEmployee> response = iamAuthService.employee(jwt);
public BaseResponse<IamEmployeeDTO> employee(@RequestParam("jwt") String jwt) {
IamAuthResponseDTO<IamEmployeeDTO> response = iamAuthService.employee(jwt);
if (Objects.equals(response.getStatusCodeValue(), IamEnum.IAM_RESP_SUCCESS_CODE.getCode())) {
return BaseResponse.success(response.getMsg(), response.getData());
} else {
@ -90,7 +90,7 @@ public class IamAuthController {
*/
@ApiOperation("IAM单点登陆 - 获取用户信息接口")
@GetMapping("/getUser")
public BaseResponse<IamUser> getUser(@RequestParam("token") String token){
public BaseResponse<IamUserDTO> getUser(@RequestParam("token") String token){
return BaseResponse.success(iamAuthService.me(token));
}
@ -102,7 +102,7 @@ public class IamAuthController {
*/
@ApiOperation("IAM单点登陆 - code换token")
@GetMapping("/getTokenByCode")
public BaseResponse<IamToken> getTokenByCode(IamTokenRequestDTO request) {
public BaseResponse<IamTokenDTO> getTokenByCode(IamTokenRequestDTO request) {
String authorization = "";
return BaseResponse.success(iamAuthService.getToken(authorization, request));
}

View File

@ -6,7 +6,7 @@ import lombok.Data;
* IAM单点登陆Token令牌实体类
*/
@Data
public class IamToken {
public class IamTokenDTO {
// 访问令牌
private String access_token;
// 刷新令牌

View File

@ -3,7 +3,7 @@ package com.chinaunicom.mall.ebtp.extend.iam.entity.data;
import lombok.Data;
@Data
public class IamEmployee {
public class IamEmployeeDTO {
private String[] authorities;
private String displayName;
private String email;

View File

@ -12,7 +12,7 @@ import java.io.Serializable;
@Data
@Accessors(chain = true)
@ApiModel(value = "IamUser对象", description = "人员基本信息表")
public class IamUser implements Serializable {
public class IamUserDTO implements Serializable {
private static final long serialVersionUID = 1L;
/** 生日 */
private String birthday;

View File

@ -2,8 +2,8 @@ package com.chinaunicom.mall.ebtp.extend.iam.service;
import com.chinaunicom.mall.ebtp.extend.iam.client.IamClient;
import com.chinaunicom.mall.ebtp.extend.iam.entity.*;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployee;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUser;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamEmployeeDTO;
import com.chinaunicom.mall.ebtp.extend.iam.entity.data.IamUserDTO;
import org.springframework.stereotype.Service;
@Service
@ -30,15 +30,15 @@ public class IamAuthService {
return iamClient.authorize(request);
}
public IamAuthResponseDTO<IamEmployee> employee(String jwt) {
public IamAuthResponseDTO<IamEmployeeDTO> employee(String jwt) {
return iamClient.employee(jwt);
}
public IamUser me(String token){
public IamUserDTO me(String token){
return iamClient.me(token);
}
public IamToken getToken(String authorization, IamTokenRequestDTO request) {
public IamTokenDTO getToken(String authorization, IamTokenRequestDTO request) {
return iamClient.token(authorization, request);
}
}