diff --git a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java index 29baed4..1293fed 100644 --- a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java +++ b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java @@ -19,7 +19,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import com.egridcloud.udf.core.RestResponse; -import com.egridcloud.udf.core.exception.SystemRuntimeException; +import com.egridcloud.udf.core.exception.PermissionException; import com.egridcloud.udf.rms.mate.AuthMate; import com.egridcloud.udf.rms.mate.PathMate; @@ -123,15 +123,13 @@ public class Rms { //获取路径元数据 PathMate pathMate = rmsProperties.getService().get(springApplicationName); //判断路径访问权限 - if (authMate.getPurview() != null) { + if (!authMate.getAll()) { if (authMate.getDisabled()) { - throw new SystemRuntimeException(springApplicationName + " is disabled"); + throw new PermissionException(springApplicationName + " is disabled"); } - if (!authMate.getAll() && authMate.getPurview().indexOf(serviceCode) == -1) { - throw new SystemRuntimeException(serviceCode + " no access"); + if (authMate.getPurview().indexOf(serviceCode) == -1) { + throw new PermissionException("no access to this servoceCode : " + serviceCode); } - } else { - throw new SystemRuntimeException(springApplicationName + " purview is null"); } StringBuilder url = new StringBuilder(Constant.HTTP); url.append(rmsProperties.getService().get(pathMate.getApplicationName())); diff --git a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/RmsAuthHandlerInterceptor.java b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/RmsAuthHandlerInterceptor.java index 9f4e0e4..ce23be4 100644 --- a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/RmsAuthHandlerInterceptor.java +++ b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/RmsAuthHandlerInterceptor.java @@ -87,7 +87,7 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor { if (!authMate.getAll()) { //判断是否禁止调用所有服务权限 if (authMate.getDisabled()) { - throw new PermissionException("all services are disabled"); + throw new PermissionException(rmsApplicationName + " is disabled"); } //判断是否有调用该服务的权限 if (authMate.getPurview().indexOf(rmsServiceCode) != -1) { @@ -103,7 +103,7 @@ public class RmsAuthHandlerInterceptor implements HandlerInterceptor { throw new AuthException("service code not exist"); } } else { - throw new PermissionException("no access to this url : " + url + ", method : " + method); + throw new PermissionException("no access to this servoceCode : " + rmsServiceCode); } } } else {