【添加】竹云统一权限服务平台,接口层外壳和相关校验处理完毕
This commit is contained in:
+56
-4
@@ -1,14 +1,13 @@
|
||||
package com.jero.modules.docking.iam.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jero.modules.docking.iam.dto.BpmcAcceptDto;
|
||||
import com.jero.modules.docking.iam.dto.IamCommonAcceptDto;
|
||||
import com.jero.modules.docking.iam.dto.IamOrgAcceptDto;
|
||||
import com.jero.modules.docking.iam.dto.IamUserAcceptDto;
|
||||
import com.jero.modules.docking.iam.dto.response.IamCommonResponseDto;
|
||||
import com.jero.modules.docking.iam.dto.response.IamOrgCreateResponse;
|
||||
import com.jero.modules.docking.iam.dto.response.IamSchemaResponse;
|
||||
import com.jero.modules.docking.iam.dto.response.IamUserCreateResponse;
|
||||
import com.jero.modules.docking.iam.dto.response.*;
|
||||
import com.jero.modules.docking.iam.exception.IamGlobalException;
|
||||
import com.jero.modules.docking.iam.po.AcceptPoSystemPo;
|
||||
import com.jero.modules.docking.iam.po.MessageHeader;
|
||||
@@ -16,7 +15,9 @@ import com.jero.modules.docking.iam.po.SendPoSystemPo;
|
||||
import com.jero.modules.docking.iam.service.SyncIamService;
|
||||
import com.jero.modules.docking.utils.BamboocloudUtils;
|
||||
import com.jero.modules.docking.utils.DockingConstant;
|
||||
import com.jero.modules.docking.utils.SHA256Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -32,6 +33,9 @@ import javax.annotation.Resource;
|
||||
@Slf4j
|
||||
public class SyncIamController {
|
||||
|
||||
@Value("${iam.bpmcAppkey}")
|
||||
private String bpmcAppkey;
|
||||
|
||||
@Resource
|
||||
private SyncIamService syncIamService;
|
||||
|
||||
@@ -238,5 +242,53 @@ public class SyncIamController {
|
||||
return sendPoSystemPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对接统一权限服务平台。
|
||||
* 该接口包含角色创建、菜单创建、角色菜单关联、用户角色关联等4个接口
|
||||
* 通过type字段来区分
|
||||
*/
|
||||
@PostMapping({"/OrgDeleteService"})
|
||||
public BpmcResponseDto bpmcCreate(@RequestBody BpmcAcceptDto bpmcAcceptDto){
|
||||
if (StrUtil.isEmpty(bpmcAcceptDto.getType())){
|
||||
return BpmcResponseDto.error("接口类型(type)未传参,请检查");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(bpmcAcceptDto.getEntity())){
|
||||
return BpmcResponseDto.error("数据实体(entity)未传参,请检查");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(bpmcAcceptDto.getAction())){
|
||||
return BpmcResponseDto.error("操作方式(action)未传参,请检查");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(bpmcAcceptDto.getSignature())){
|
||||
return BpmcResponseDto.error("签名(signature)未传参,请检查");
|
||||
}
|
||||
|
||||
// 验证签名
|
||||
String validateSign = SHA256Util.getSHA256StrJava(bpmcAcceptDto.getEntity() + bpmcAppkey + bpmcAcceptDto.getTimestamp());
|
||||
if (!bpmcAcceptDto.getSignature().equals(validateSign)){
|
||||
return BpmcResponseDto.error("签名校验不通过,请检查");
|
||||
}
|
||||
|
||||
// 分接口类型分别处理
|
||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_ROLE)){
|
||||
|
||||
}
|
||||
|
||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_RESOURCE)){
|
||||
|
||||
}
|
||||
|
||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_USER_ROLE)){
|
||||
|
||||
}
|
||||
|
||||
if (bpmcAcceptDto.getType().equals(DockingConstant.BPMC_TYPE_ROLE_RESOURCE)){
|
||||
|
||||
}
|
||||
|
||||
return BpmcResponseDto.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.jero.modules.docking.iam.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 和竹云统一权限服务平台对接的实体
|
||||
*/
|
||||
@Data
|
||||
public class BpmcAcceptDto {
|
||||
|
||||
/**
|
||||
* 角色:D_AR (本系统对接)
|
||||
* 功能权限:D_AM (本系统对接)
|
||||
* 账号与应用角色关系: R_USER_AR (本系统对接)
|
||||
* 应用角色与应用功能权限关系:R_AR_AM (本系统对接)
|
||||
* 账号与功能权限关系:R_USER_AM
|
||||
* 群组与应用角色关系:R_ACCSET_AR
|
||||
* 群组与功能权限关系:R_ACCSET_AM
|
||||
* 机构/岗位与应用角色关系:R_USERSET_AR
|
||||
* 机构/岗位与功能权限关系:R_USERSET_AM
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 后续基础数据接口、权限关系接口章节中对应操作的entity JSON格式数据字符串
|
||||
*/
|
||||
private String entity;
|
||||
|
||||
/**
|
||||
* 操作方式
|
||||
* 基础数据接口:(add:新增;delete:删除;update:更新)
|
||||
* 关系数据接口:
|
||||
* (add:新增;delete:删除;)
|
||||
*/
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* 请求签名,计算方式
|
||||
* SHA256 (entity+appKey+timestamp)
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private long timestamp;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.jero.modules.docking.iam.dto.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
public class BpmcResponseDto {
|
||||
|
||||
private String returnCode;
|
||||
|
||||
private String returnMsg;
|
||||
|
||||
public static BpmcResponseDto success(){
|
||||
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
||||
bpmcResponseDto.returnCode = "200"; // 成功时固定为200
|
||||
bpmcResponseDto.returnMsg = "操作成功";
|
||||
|
||||
return bpmcResponseDto;
|
||||
}
|
||||
|
||||
public static BpmcResponseDto error(String message){
|
||||
BpmcResponseDto bpmcResponseDto = new BpmcResponseDto();
|
||||
bpmcResponseDto.returnCode = "500"; // 失败时固定为500
|
||||
bpmcResponseDto.returnMsg = message;
|
||||
|
||||
return bpmcResponseDto;
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -35,4 +35,24 @@ public class DockingConstant {
|
||||
*/
|
||||
public static String IAM_SUCCESS_MESSAGE = "success";
|
||||
|
||||
/**
|
||||
* 竹云统一认证平台,接口类型:角色
|
||||
*/
|
||||
public static String BPMC_TYPE_ROLE = "D_AR";
|
||||
|
||||
/**
|
||||
* 竹云统一认证平台,接口类型:功能权限
|
||||
*/
|
||||
public static String BPMC_TYPE_RESOURCE = "D_AM";
|
||||
|
||||
/**
|
||||
* 竹云统一认证平台,接口类型:账号与应用角色关系
|
||||
*/
|
||||
public static String BPMC_TYPE_USER_ROLE = "R_USER_AR";
|
||||
|
||||
/**
|
||||
* 竹云统一认证平台,接口类型:应用角色与应用功能权限关系
|
||||
*/
|
||||
public static String BPMC_TYPE_ROLE_RESOURCE = "R_AR_AM";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user