-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
987 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
.../home-web/src/main/java/io/holoinsight/server/home/web/security/CheckTargetCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
import org.aopalliance.intercept.MethodInvocation; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-02 10:45:00 | ||
*/ | ||
public interface CheckTargetCollector { | ||
|
||
/** | ||
* 提供给业务自定义使用的通用待校验目标获取方法 获取单个待校验的目标 | ||
* | ||
* @param paramters | ||
* @param methodInvocation | ||
* @return | ||
*/ | ||
public String getCheckTarget(List<String> paramters, MethodInvocation methodInvocation); | ||
|
||
/** | ||
* 提供给业务自定义使用的通用待校验目标获取方法 获取待校验目标的list | ||
* | ||
* @param paramters | ||
* @param methodInvocation | ||
* @return | ||
*/ | ||
public List<String> getCheckTargetList(List<String> paramters, MethodInvocation methodInvocation); | ||
} |
26 changes: 26 additions & 0 deletions
26
...er/home/home-web/src/main/java/io/holoinsight/server/home/web/security/CheckTypeEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-02 10:44:00 | ||
*/ | ||
public class CheckTypeEnum { | ||
|
||
/** | ||
* 参数校验 | ||
*/ | ||
public static final String PARAMETERCHECK = "ParameterCheck"; | ||
|
||
/** | ||
* 目标对象校验 | ||
*/ | ||
public static final String TARGETCHECK = "TargetCheck"; | ||
|
||
/** | ||
* 自定义校验 | ||
*/ | ||
public static final String CUSTOMCHECK = "CustomCheck"; | ||
} |
34 changes: 34 additions & 0 deletions
34
...ome-web/src/main/java/io/holoinsight/server/home/web/security/ContentTargetCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
import org.aopalliance.intercept.MethodInvocation; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-02 10:34:00 | ||
*/ | ||
public interface ContentTargetCollector { | ||
|
||
/** | ||
* 提供给业务自定义使用的通用上下文目标获取方法 获取单个待校验的目标 | ||
* | ||
* @param parameters | ||
* @param methodInvocation | ||
* @return | ||
*/ | ||
public String getContentTarget(List<String> parameters, MethodInvocation methodInvocation); | ||
|
||
/** | ||
* 提供给业务自定义使用的通用上下文目标获取方法 获取待校验目标的list | ||
* | ||
* @param parameters | ||
* @param methodInvocation | ||
* @return | ||
*/ | ||
public List<String> getContentTargetList(List<String> parameters, | ||
MethodInvocation methodInvocation); | ||
} |
18 changes: 18 additions & 0 deletions
18
...e/home-web/src/main/java/io/holoinsight/server/home/web/security/LevelAuthContentGet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2023-12-28 20:35:00 | ||
*/ | ||
@Target({ElementType.METHOD, ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface LevelAuthContentGet { | ||
} |
88 changes: 88 additions & 0 deletions
88
...e-web/src/main/java/io/holoinsight/server/home/web/security/LevelAuthorizationAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2023-12-28 18:06:00 | ||
*/ | ||
@Target({ElementType.METHOD, ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface LevelAuthorizationAccess { | ||
|
||
/** | ||
* 待校验参数配置信息 | ||
* | ||
* @return | ||
*/ | ||
public String[] paramConfigs() default ""; | ||
|
||
/** | ||
* 获取上下文的容器,默认值是CUSTOM | ||
* | ||
* @return | ||
*/ | ||
public String contentContainer() default "CUSTOM"; | ||
|
||
/** | ||
* 获取上下文的key,默认值是空白,配套CUSTOM | ||
* | ||
* @return | ||
*/ | ||
public String contentKey() default ""; | ||
|
||
/** | ||
* 校验方式,目前支持equal、contains | ||
* | ||
* @return | ||
*/ | ||
public String checkMode() default "Equal"; | ||
|
||
/** | ||
* 获取用户自定义校验目标的类名 | ||
* | ||
* @return | ||
*/ | ||
public String checkTargetCollectClass() default ""; | ||
|
||
/** | ||
* 获取用户自定义上下文目标的类名 | ||
* | ||
* @return | ||
*/ | ||
public String contentTargetCollectClass() default ""; | ||
|
||
/** | ||
* 校验类型,目前支持3种 ParameterCheck,参数校验 TargetCheck,目标对象校验 CustomCheck,自定义校验模式,默认设置 | ||
* | ||
* @return | ||
*/ | ||
public String checkType() default "CustomCheck"; | ||
|
||
/** | ||
* 决策模式,目前支持2种 ALLMATCH,全部匹配模式,默认设置 EACHMATCH,任意一条匹配模式 | ||
* | ||
* @return | ||
*/ | ||
public String decisionMode() default "ALLMATCH"; | ||
|
||
/** | ||
* 用户自定义的水平权限校验方法的类名 | ||
* | ||
* @return | ||
*/ | ||
public String levelAuthorizationCheckeClass() default ""; | ||
|
||
/** | ||
* 拦截器所属位置,目前支持2种 Before,前置拦截,默认设置 After,后置拦截 | ||
* | ||
* @return | ||
*/ | ||
public String interceptorSeat() default "Before"; | ||
} |
32 changes: 32 additions & 0 deletions
32
...me-web/src/main/java/io/holoinsight/server/home/web/security/LevelAuthorizationCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.web.security; | ||
|
||
import io.holoinsight.server.home.facade.utils.ParaCheckUtil; | ||
import org.aopalliance.intercept.MethodInvocation; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2023-12-28 19:06:00 | ||
*/ | ||
public interface LevelAuthorizationCheck { | ||
|
||
public boolean check(LevelAuthorizationMetaData levelAuthMetaData, | ||
MethodInvocation methodInvocation); | ||
|
||
default boolean checkSqlField(String sqlField) { | ||
if (StringUtils.isNotEmpty(sqlField)) { | ||
return ParaCheckUtil.sqlFieldCheck(sqlField); | ||
} | ||
return true; | ||
} | ||
|
||
default boolean checkSqlName(String sqlName) { | ||
if (StringUtils.isNotEmpty(sqlName)) { | ||
return ParaCheckUtil.sqlNameCheck(sqlName); | ||
} | ||
return true; | ||
} | ||
} |
Oops, something went wrong.