fix(iam): 返回加密信息
This commit is contained in:
+10
-4
@@ -28,10 +28,10 @@ public class TestClient {
|
|||||||
public static void main(String[] args) throws JsonProcessingException {
|
public static void main(String[] args) throws JsonProcessingException {
|
||||||
TestClient testClient = new TestClient();
|
TestClient testClient = new TestClient();
|
||||||
// testClient.sendSchemaService(); // 字段映射接口测试
|
// testClient.sendSchemaService(); // 字段映射接口测试
|
||||||
for (int i = 0; i < 1; i++) {
|
// for (int i = 0; i < 1; i++) {
|
||||||
System.out.println(i);
|
// System.out.println(i);
|
||||||
testClient.sendUserCreate(i);
|
// testClient.sendUserCreate(i);
|
||||||
}
|
// }
|
||||||
// 创建用户接口测试
|
// 创建用户接口测试
|
||||||
// testClient.sendUserUpdate(); // 更新用户接口测试
|
// testClient.sendUserUpdate(); // 更新用户接口测试
|
||||||
// testClient.sendOrgCreate(); // 组织创建接口测试
|
// testClient.sendOrgCreate(); // 组织创建接口测试
|
||||||
@@ -39,6 +39,12 @@ public class TestClient {
|
|||||||
// testClient.sendQueryAllOrgIdsService(); // 查询所有组织ID接口测试
|
// testClient.sendQueryAllOrgIdsService(); // 查询所有组织ID接口测试
|
||||||
// testClient.sendQueryOrgByIdService(); // 查询指定id的组织数据测试
|
// testClient.sendQueryOrgByIdService(); // 查询指定id的组织数据测试
|
||||||
// testClient.sendQueryUserByIdService(); // 查询指定id的用户数据测试
|
// testClient.sendQueryUserByIdService(); // 查询指定id的用户数据测试
|
||||||
|
testClient.decryptSting("8rAKWPUwkEZ3yYLy/1TuGGkIGCYtc+MD56pShLi97OmMttoFooo5GXZ/lY4NrQ5DiWmVUX23zqDwyQqufXLZNDU+KuJO/9UonpqUlZxM91w=");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void decryptSting(String encryptString) {
|
||||||
|
String decrypt = BamboocloudUtils.getPlaintext(encryptString, DockingConstant.IAM_ENCRYPT_SECRET, DockingConstant.IAM_ENCRYPT_TYPE);
|
||||||
|
System.out.println("解密后数据:" + decrypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对数据解密
|
// 对数据解密
|
||||||
|
|||||||
+28
-32
@@ -15,12 +15,12 @@ import com.jero.modules.docking.iam.dto.response.*;
|
|||||||
import com.jero.modules.docking.iam.exception.IamGlobalException;
|
import com.jero.modules.docking.iam.exception.IamGlobalException;
|
||||||
import com.jero.modules.docking.iam.po.MessageHeader;
|
import com.jero.modules.docking.iam.po.MessageHeader;
|
||||||
import com.jero.modules.docking.iam.po.decrypt.AcceptDecryptPo;
|
import com.jero.modules.docking.iam.po.decrypt.AcceptDecryptPo;
|
||||||
import com.jero.modules.docking.iam.po.decrypt.SendPoDecryptPo;
|
|
||||||
import com.jero.modules.docking.iam.po.encrypt.AcceptEncryptPo;
|
import com.jero.modules.docking.iam.po.encrypt.AcceptEncryptPo;
|
||||||
import com.jero.modules.docking.iam.po.encrypt.SendPoEncryptPo;
|
import com.jero.modules.docking.iam.po.encrypt.SendPoEncryptPo;
|
||||||
import com.jero.modules.docking.iam.service.SyncIamService;
|
import com.jero.modules.docking.iam.service.SyncIamService;
|
||||||
import com.jero.modules.docking.utils.BamboocloudUtils;
|
import com.jero.modules.docking.utils.BamboocloudUtils;
|
||||||
import com.jero.modules.docking.utils.DockingConstant;
|
import com.jero.modules.docking.utils.DockingConstant;
|
||||||
|
import com.jero.modules.docking.utils.SHA256Util;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -319,7 +319,7 @@ public class SyncIamController {
|
|||||||
* 通过type字段来区分
|
* 通过type字段来区分
|
||||||
*/
|
*/
|
||||||
@PostMapping({"/bpmcCreate"})
|
@PostMapping({"/bpmcCreate"})
|
||||||
public SendPoDecryptPo<BpmcResponseDto> bpmcCreate(@RequestBody AcceptDecryptPo acceptDecryptPo) throws JsonProcessingException {
|
public SendPoEncryptPo bpmcCreate(@RequestBody AcceptDecryptPo acceptDecryptPo) throws JsonProcessingException {
|
||||||
if (acceptDecryptPo == null
|
if (acceptDecryptPo == null
|
||||||
|| acceptDecryptPo.getMessageDecryptTabels() == null
|
|| acceptDecryptPo.getMessageDecryptTabels() == null
|
||||||
|| acceptDecryptPo.getMessageDecryptTabels().getHeader() == null){
|
|| acceptDecryptPo.getMessageDecryptTabels().getHeader() == null){
|
||||||
@@ -331,45 +331,45 @@ public class SyncIamController {
|
|||||||
BpmcAcceptDto bpmcAcceptDto = objectMapper.readValue(acceptDecryptPo.getMessageDecryptTabels().getHeader().getData(), BpmcAcceptDto.class);
|
BpmcAcceptDto bpmcAcceptDto = objectMapper.readValue(acceptDecryptPo.getMessageDecryptTabels().getHeader().getData(), BpmcAcceptDto.class);
|
||||||
|
|
||||||
MessageHeader messageHeader = acceptDecryptPo.getMessageHeader();
|
MessageHeader messageHeader = acceptDecryptPo.getMessageHeader();
|
||||||
|
BpmcResponseDto bpmcResponseDto = BpmcResponseDto.success();
|
||||||
|
|
||||||
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getType())){
|
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getType())){
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
bpmcResponseDto.setReturnCode(DockingConstant.IAM_ERROR_RESULT_CODE);
|
||||||
this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
bpmcResponseDto.setMessage("接口类型(type)未传参,请检查");
|
||||||
BpmcResponseDto.error("接口类型(type)未传参,请检查")
|
log.error(bpmcResponseDto.getMessage());
|
||||||
);
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getEntity())){
|
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getEntity())){
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
bpmcResponseDto.setReturnCode(DockingConstant.IAM_ERROR_RESULT_CODE);
|
||||||
this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
bpmcResponseDto.setMessage("数据实体(entity)未传参,请检查");
|
||||||
BpmcResponseDto.error("数据实体(entity)未传参,请检查")
|
log.error(bpmcResponseDto.getMessage());
|
||||||
);
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getAction())){
|
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getAction())){
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
bpmcResponseDto.setReturnCode(DockingConstant.IAM_ERROR_RESULT_CODE);
|
||||||
this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
bpmcResponseDto.setMessage("操作方式(action)未传参,请检查");
|
||||||
BpmcResponseDto.error("操作方式(action)未传参,请检查")
|
log.error(bpmcResponseDto.getMessage());
|
||||||
);
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getSignature())){
|
if (CharSequenceUtil.isEmpty(bpmcAcceptDto.getSignature())){
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
bpmcResponseDto.setReturnCode(DockingConstant.IAM_ERROR_RESULT_CODE);
|
||||||
this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
bpmcResponseDto.setMessage("签名(signature)未传参,请检查");
|
||||||
BpmcResponseDto.error("签名(signature)未传参,请检查")
|
log.error(bpmcResponseDto.getMessage());
|
||||||
);
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证签名
|
// 验证签名
|
||||||
// String validateSign = SHA256Util.getSHA256StrJava(bpmcAcceptDto.getEntity() + bpmcAppkey + bpmcAcceptDto.getTimestamp());
|
String validateSign = SHA256Util.getSHA256StrJava(bpmcAcceptDto.getEntity() + bpmcAppkey + bpmcAcceptDto.getTimestamp());
|
||||||
// if (!bpmcAcceptDto.getSignature().equals(validateSign)){
|
if (!bpmcAcceptDto.getSignature().equals(validateSign)){
|
||||||
// return new SendPoDecryptPo<BpmcResponseDto>().response(
|
bpmcResponseDto.setReturnCode(DockingConstant.IAM_ERROR_RESULT_CODE);
|
||||||
// this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
bpmcResponseDto.setMessage("签名校验不通过,请检查");
|
||||||
// BpmcResponseDto.error("签名校验不通过,请检查")
|
log.error(bpmcResponseDto.getMessage());
|
||||||
// );
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
// }
|
}
|
||||||
|
|
||||||
BpmcResponseDto bpmcResponseDto = BpmcResponseDto.success();
|
|
||||||
try {
|
try {
|
||||||
switch (bpmcAcceptDto.getType()){
|
switch (bpmcAcceptDto.getType()){
|
||||||
// 角色
|
// 角色
|
||||||
@@ -401,13 +401,9 @@ public class SyncIamController {
|
|||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
bpmcResponseDto = BpmcResponseDto.error(e.getMessage());
|
bpmcResponseDto = BpmcResponseDto.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
log.info(bpmcResponseDto.getMessage());
|
||||||
return new SendPoDecryptPo<BpmcResponseDto>().response(
|
return this.syncIamService.handlerGloablEncryptResponse(messageHeader, bpmcResponseDto);
|
||||||
this.syncIamService.generatorReturnMessageHeader(messageHeader),
|
|
||||||
bpmcResponseDto
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BpmcResponseDto bpmcTypeRoleResource(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
private BpmcResponseDto bpmcTypeRoleResource(ObjectMapper objectMapper, BpmcAcceptDto bpmcAcceptDto, BpmcResponseDto bpmcResponseDto) throws JsonProcessingException {
|
||||||
List<RoleResourceDto> roleResourceDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<RoleResourceDto>>() {});
|
List<RoleResourceDto> roleResourceDtoList = objectMapper.readValue(bpmcAcceptDto.getEntity(), new TypeReference<List<RoleResourceDto>>() {});
|
||||||
// 根据新增/删除调用不同的业务处理代码
|
// 根据新增/删除调用不同的业务处理代码
|
||||||
|
|||||||
+3
-3
@@ -7,12 +7,12 @@ public class BpmcResponseDto {
|
|||||||
|
|
||||||
private String returnCode;
|
private String returnCode;
|
||||||
|
|
||||||
private String returnMsg;
|
private String message;
|
||||||
|
|
||||||
public static BpmcResponseDto success(){
|
public static BpmcResponseDto success(){
|
||||||
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
||||||
bpmcResponseDto.returnCode = "200"; // 成功时固定为200
|
bpmcResponseDto.returnCode = "200"; // 成功时固定为200
|
||||||
bpmcResponseDto.returnMsg = "操作成功";
|
bpmcResponseDto.message = "操作成功";
|
||||||
|
|
||||||
return bpmcResponseDto;
|
return bpmcResponseDto;
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ public class BpmcResponseDto {
|
|||||||
public static BpmcResponseDto error(String message){
|
public static BpmcResponseDto error(String message){
|
||||||
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
||||||
bpmcResponseDto.returnCode = "500"; // 失败时固定为500
|
bpmcResponseDto.returnCode = "500"; // 失败时固定为500
|
||||||
bpmcResponseDto.returnMsg = message;
|
bpmcResponseDto.message = message;
|
||||||
|
|
||||||
return bpmcResponseDto;
|
return bpmcResponseDto;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user