权限修改
This commit is contained in:
parent
9bea50466f
commit
1d8869fad8
@ -28,19 +28,15 @@ public class InternalAuthorizationInterceptor implements HandlerInterceptor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequireRole requireRole = findAnnotation(handlerMethod, RequireRole.class);
|
RequireInternalAuth requireInternalAuth = findAnnotation(handlerMethod, RequireInternalAuth.class);
|
||||||
if (requireRole != null) {
|
if (requireInternalAuth != null) {
|
||||||
String currentRole = (String) request.getAttribute(InternalApiAuthInterceptor.ATTR_ROLE_CODE);
|
String currentRole = (String) request.getAttribute(InternalApiAuthInterceptor.ATTR_ROLE_CODE);
|
||||||
if (!requireRole.value().equals(currentRole)) {
|
if (!requireInternalAuth.role().getCode().equals(currentRole)) {
|
||||||
writeForbidden(response, "role not allowed");
|
writeForbidden(response, "role not allowed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
RequireAuthLevel requireAuthLevel = findAnnotation(handlerMethod, RequireAuthLevel.class);
|
|
||||||
if (requireAuthLevel != null) {
|
|
||||||
String currentAuthLevel = (String) request.getAttribute(InternalApiAuthInterceptor.ATTR_AUTH_LEVEL);
|
String currentAuthLevel = (String) request.getAttribute(InternalApiAuthInterceptor.ATTR_AUTH_LEVEL);
|
||||||
if (!requireAuthLevel.value().equals(currentAuthLevel)) {
|
if (!requireInternalAuth.authLevel().name().equals(currentAuthLevel)) {
|
||||||
writeForbidden(response, "auth level not allowed");
|
writeForbidden(response, "auth level not allowed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,10 +55,6 @@ public class InitPreviewRequest {
|
|||||||
@Schema(description = "初始化许可证与配置包引用")
|
@Schema(description = "初始化许可证与配置包引用")
|
||||||
private Licenses licenses;
|
private Licenses licenses;
|
||||||
|
|
||||||
@Valid
|
|
||||||
@Schema(description = "签名服务配置,直参版按需填写")
|
|
||||||
private SignServer signServer;
|
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
@Schema(description = "直连 TLQ 配置,直参版按需填写")
|
@Schema(description = "直连 TLQ 配置,直参版按需填写")
|
||||||
private DirectTlqConfig directTlq;
|
private DirectTlqConfig directTlq;
|
||||||
@ -127,14 +123,6 @@ public class InitPreviewRequest {
|
|||||||
this.licenses = licenses;
|
this.licenses = licenses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SignServer getSignServer() {
|
|
||||||
return signServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignServer(SignServer signServer) {
|
|
||||||
this.signServer = signServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DirectTlqConfig getDirectTlq() {
|
public DirectTlqConfig getDirectTlq() {
|
||||||
return directTlq;
|
return directTlq;
|
||||||
}
|
}
|
||||||
@ -223,6 +211,10 @@ public class InitPreviewRequest {
|
|||||||
@Schema(description = "CFMQ 配置文件 fileId", example = "FILE-20260310-000002")
|
@Schema(description = "CFMQ 配置文件 fileId", example = "FILE-20260310-000002")
|
||||||
private String cfmqConfigFileId;
|
private String cfmqConfigFileId;
|
||||||
|
|
||||||
|
@Size(max = 64, message = "mq.cipsGatewayHost length must be <= 64")
|
||||||
|
@Schema(description = "CIPS 中心网关地址,仅 DIRECT + RABBITMQ_TLQ 使用", example = "192.168.10.20")
|
||||||
|
private String cipsGatewayHost;
|
||||||
|
|
||||||
public String getMqType() {
|
public String getMqType() {
|
||||||
return mqType;
|
return mqType;
|
||||||
}
|
}
|
||||||
@ -262,6 +254,14 @@ public class InitPreviewRequest {
|
|||||||
public void setCfmqConfigFileId(String cfmqConfigFileId) {
|
public void setCfmqConfigFileId(String cfmqConfigFileId) {
|
||||||
this.cfmqConfigFileId = cfmqConfigFileId;
|
this.cfmqConfigFileId = cfmqConfigFileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCipsGatewayHost() {
|
||||||
|
return cipsGatewayHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCipsGatewayHost(String cipsGatewayHost) {
|
||||||
|
this.cipsGatewayHost = cipsGatewayHost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "许可证和配置包引用")
|
@Schema(description = "许可证和配置包引用")
|
||||||
@ -295,80 +295,6 @@ public class InitPreviewRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "签名服务配置")
|
|
||||||
public static class SignServer {
|
|
||||||
|
|
||||||
@Size(max = 64, message = "signServer.signHost length must be <= 64")
|
|
||||||
@Schema(description = "签名服务地址", example = "10.0.0.20")
|
|
||||||
private String signHost;
|
|
||||||
|
|
||||||
@NotNull(message = "signServer.signPort must not be null")
|
|
||||||
@Max(value = 65535, message = "signServer.signPort must be <= 65535")
|
|
||||||
@Schema(description = "签名服务端口", example = "8088")
|
|
||||||
private Integer signPort;
|
|
||||||
|
|
||||||
@Pattern(regexp = "Infosec|CFCA", message = "signServer.signType must be Infosec/CFCA")
|
|
||||||
@Schema(description = "签名服务厂商类型", example = "CFCA")
|
|
||||||
private String signType;
|
|
||||||
|
|
||||||
@Size(max = 512, message = "signServer.signCertDn length must be <= 512")
|
|
||||||
private String signCertDn;
|
|
||||||
|
|
||||||
@Size(max = 128, message = "signServer.signCertSn length must be <= 128")
|
|
||||||
private String signCertSn;
|
|
||||||
|
|
||||||
@Size(max = 128, message = "signServer.signPassword length must be <= 128")
|
|
||||||
private String signPassword;
|
|
||||||
|
|
||||||
public String getSignHost() {
|
|
||||||
return signHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignHost(String signHost) {
|
|
||||||
this.signHost = signHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSignPort() {
|
|
||||||
return signPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignPort(Integer signPort) {
|
|
||||||
this.signPort = signPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignType() {
|
|
||||||
return signType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignType(String signType) {
|
|
||||||
this.signType = signType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignCertDn() {
|
|
||||||
return signCertDn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignCertDn(String signCertDn) {
|
|
||||||
this.signCertDn = signCertDn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignCertSn() {
|
|
||||||
return signCertSn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignCertSn(String signCertSn) {
|
|
||||||
this.signCertSn = signCertSn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignPassword() {
|
|
||||||
return signPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignPassword(String signPassword) {
|
|
||||||
this.signPassword = signPassword;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Schema(description = "直连 TLQ 配置")
|
@Schema(description = "直连 TLQ 配置")
|
||||||
public static class DirectTlqConfig {
|
public static class DirectTlqConfig {
|
||||||
|
|
||||||
|
|||||||
@ -77,8 +77,7 @@ class InternalAuthorizationInterceptorTest {
|
|||||||
public void openEndpoint() {
|
public void openEndpoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequireRole("KEY_ADMIN")
|
@RequireInternalAuth(role = com.cisd.tms.modules.auth.enums.RoleCode.KEY_ADMIN, authLevel = com.cisd.tms.modules.auth.enums.AuthLevel.FULL)
|
||||||
@RequireAuthLevel("FULL")
|
|
||||||
public void keyAdminFullEndpoint() {
|
public void keyAdminFullEndpoint() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user