diff --git a/src/main/java/neatlogic/framework/auth/label/NoAuth.java b/src/main/java/neatlogic/framework/auth/label/NoAuth.java new file mode 100644 index 0000000000000000000000000000000000000000..fcc9ee6160e8bed2b2c3adeefc91d211bc6eca77 --- /dev/null +++ b/src/main/java/neatlogic/framework/auth/label/NoAuth.java @@ -0,0 +1,25 @@ +package neatlogic.framework.auth.label; + +import neatlogic.framework.auth.core.AuthBase; + +public class NoAuth extends AuthBase { + @Override + public String getAuthDisplayName() { + return "无权限"; + } + + @Override + public String getAuthIntroduction() { + return "无权限"; + } + + @Override + public String getAuthGroup() { + return "framework"; + } + + @Override + public Integer getSort() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/neatlogic/framework/restful/core/ApiValidateAndHelpBase.java b/src/main/java/neatlogic/framework/restful/core/ApiValidateAndHelpBase.java index e5d53ee1103e3f9937bbfaac7e249d7ab3560f6a..863e101cb368a7f29fa28547613b11c2cd0c42b0 100644 --- a/src/main/java/neatlogic/framework/restful/core/ApiValidateAndHelpBase.java +++ b/src/main/java/neatlogic/framework/restful/core/ApiValidateAndHelpBase.java @@ -25,6 +25,7 @@ import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.auth.core.AuthActionChecker; import neatlogic.framework.auth.core.AuthBase; import neatlogic.framework.auth.core.AuthFactory; +import neatlogic.framework.auth.label.NoAuth; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.common.constvalue.IEnum; import neatlogic.framework.common.constvalue.systemuser.SystemUserFactory; @@ -244,6 +245,10 @@ public class ApiValidateAndHelpBase { private boolean isApiAuth(Class apiClass, List authNameList, AuthAction[] actions) { boolean isAuth = false; for (AuthAction action : actions) { + if (action.action() == NoAuth.class) { + isAuth = true; + break; + } if (StringUtils.isNotBlank(action.action().getSimpleName())) { String actionName = action.action().getSimpleName(); // 判断用户角色是否拥有接口权限