Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e31d820e0 | ||
|
|
92353d859a | ||
|
|
bef8d69e59 | ||
|
|
b3ab78e063 | ||
|
|
95d2c6cb65 | ||
|
|
7017c7502b | ||
|
|
c14055ba8c | ||
|
|
04aa6c9680 | ||
|
|
397bbb2657 | ||
|
|
9a68282127 | ||
|
|
dcd02acc61 | ||
|
|
1025688e9b | ||
|
|
26eeb26a75 | ||
|
|
7f76325284 | ||
|
|
de9a921c49 | ||
|
|
a9ac9d0f79 | ||
|
|
a14b28de6a | ||
|
|
ccd7430b8f | ||
|
|
6791ea5770 | ||
|
|
2d5835b150 | ||
|
|
cec11ce8c3 | ||
|
|
972103841c | ||
|
|
89f6d2cd1c | ||
|
|
d13008ce0c | ||
|
|
abf384dd3c | ||
|
|
0abd4a893b | ||
|
|
d0710fb52b | ||
|
|
534fe83ac2 | ||
|
|
d95d958de0 | ||
|
|
4e5730f31f | ||
|
|
81b9bacb96 | ||
|
|
dc42a31711 | ||
|
|
27e3e65ea1 | ||
|
|
a001ab3f16 | ||
|
|
aeb161a482 | ||
|
|
5ecb476be5 | ||
|
|
5389334304 | ||
|
|
56ece9c854 | ||
|
|
a217b95783 | ||
|
|
ffcdd80996 | ||
|
|
f804dc0338 | ||
|
|
25359f0f66 | ||
|
|
932bdb86ad | ||
|
|
0e14e55c5a | ||
|
|
e2a645d1e1 | ||
|
|
51392e09e2 | ||
|
|
8d71d64d49 | ||
|
|
956c34176d | ||
|
|
f65aa89421 | ||
|
|
c481cb0ae4 | ||
|
|
a734ec40ec | ||
|
|
2a5bda3d00 | ||
|
|
72579c7e83 | ||
|
|
41797e41d2 | ||
|
|
35733e80eb | ||
|
|
4119dbad6a | ||
|
|
c0122079c1 |
10
README.md
10
README.md
@@ -86,11 +86,11 @@ docker compose up -d
|
||||
|
||||
## 技术栈
|
||||
|
||||
* SpringBoot 2.7.+
|
||||
* Mysql 8.0.+
|
||||
* Redis 6.0.+
|
||||
* Vue3 3.2.+
|
||||
* Arco Design 2.55.+
|
||||
* SpringBoot 2.7+
|
||||
* Mysql 8+
|
||||
* Redis 6+
|
||||
* Vue3 3+
|
||||
* Arco Design 2+
|
||||
|
||||
## 主要功能预览
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.2.3
|
||||
version=2.3.4
|
||||
docker build -t orion-visor-adminer:${version} .
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
|
||||
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.2.3
|
||||
version=2.3.4
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.2.3
|
||||
version=2.3.4
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.2.3
|
||||
version=2.3.4
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#/bin/bash
|
||||
version=2.2.3
|
||||
version=2.3.4
|
||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
docker build --no-cache -t orion-visor-service:${version} .
|
||||
docker build -t orion-visor-service:${version} .
|
||||
rm -rf ./orion-visor-launch.jar
|
||||
rm -rf ./dist
|
||||
docker tag orion-visor-service:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:${version}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework</artifactId>
|
||||
<artifactId>orion-visor</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -20,66 +20,61 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.exec.command.model;
|
||||
package org.dromara.visor.common.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 批量执行启动对象
|
||||
* 配置引用
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/3/11 15:46
|
||||
* @since 2025/1/6 18:01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ExecCommandDTO {
|
||||
@Slf4j
|
||||
public abstract class ConfigRef<T> {
|
||||
|
||||
public final String key;
|
||||
|
||||
public T value;
|
||||
|
||||
protected final Function<String, T> convert;
|
||||
|
||||
public ConfigRef(String key, Function<String, T> convert) {
|
||||
this.key = key;
|
||||
this.convert = convert;
|
||||
}
|
||||
|
||||
/**
|
||||
* logId
|
||||
* 覆盖配置
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
private Long logId;
|
||||
public abstract void override(String value);
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
* 修改配置
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
private Long userId;
|
||||
public abstract void set(T value);
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
* 获取配置
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
private String username;
|
||||
public abstract T get();
|
||||
|
||||
/**
|
||||
* 执行描述
|
||||
* 修改回调
|
||||
*
|
||||
* @param changeEvent changeEvent
|
||||
* @return this
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 执行序列
|
||||
*/
|
||||
private Integer execSeq;
|
||||
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
private Integer timeout;
|
||||
|
||||
/**
|
||||
* 是否使用脚本执行
|
||||
*/
|
||||
private Boolean scriptExec;
|
||||
|
||||
/**
|
||||
* 执行主机
|
||||
*/
|
||||
private List<ExecCommandHostDTO> hosts;
|
||||
public abstract ConfigRef<T> onChange(BiConsumer<T, T> changeEvent);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.common.config;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 配置中心
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/5 21:30
|
||||
*/
|
||||
public interface ConfigStore {
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
String getString(String key);
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
String getString(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
Integer getInteger(String key);
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
Integer getInteger(String key, Integer defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
Long getLong(String key);
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
Long getLong(String key, Long defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
Double getDouble(String key);
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
Double getDouble(String key, Double defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
Boolean getBoolean(String key);
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
Boolean getBoolean(String key, Boolean defaultValue);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @return conf
|
||||
*/
|
||||
String getConfig(String key);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return conf
|
||||
*/
|
||||
String getConfig(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param <T> T
|
||||
* @return conf
|
||||
*/
|
||||
<T> T getConfig(String key, Function<String, T> convert);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param defaultValue defaultValue
|
||||
* @param <T> T
|
||||
* @return conf
|
||||
*/
|
||||
<T> T getConfig(String key, Function<String, T> convert, T defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<String> string(String key);
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<String> string(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Integer> int32(String key);
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Integer> int32(String key, Integer defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Long> int64(String key);
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Long> int64(String key, Long defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Double> float64(String key);
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Double> float64(String key, Double defaultValue);
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Boolean> bool(String key);
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
ConfigRef<Boolean> bool(String key, Boolean defaultValue);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param <T> T
|
||||
* @return ref
|
||||
*/
|
||||
<T> ConfigRef<T> ref(String key, Function<String, T> convert);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param defaultValue defaultValue
|
||||
* @param <T> T
|
||||
* @return ref
|
||||
*/
|
||||
<T> ConfigRef<T> ref(String key, Function<String, T> convert, T defaultValue);
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
import cn.orionsec.kit.lang.constant.OrionConst;
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.2.3";
|
||||
String VERSION = "2.3.4";
|
||||
|
||||
/**
|
||||
* 同 ${spring.application.name}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 自动装配排序常量
|
||||
@@ -33,14 +33,10 @@ package org.dromara.visor.framework.common.constant;
|
||||
*/
|
||||
public interface AutoConfigureOrderConst {
|
||||
|
||||
int FRAMEWORK_COMMON = Integer.MIN_VALUE + 1000;
|
||||
|
||||
int FRAMEWORK_WEB = Integer.MIN_VALUE + 1100;
|
||||
|
||||
int FRAMEWORK_SECURITY = Integer.MIN_VALUE + 1200;
|
||||
|
||||
int FRAMEWORK_SECURITY_CRYPTO = Integer.MIN_VALUE + 1250;
|
||||
|
||||
int FRAMEWORK_WEBSOCKET = Integer.MIN_VALUE + 1300;
|
||||
|
||||
int FRAMEWORK_DESENSITIZE = Integer.MIN_VALUE + 1400;
|
||||
@@ -55,17 +51,23 @@ public interface AutoConfigureOrderConst {
|
||||
|
||||
int FRAMEWORK_REDIS = Integer.MIN_VALUE + 1900;
|
||||
|
||||
int FRAMEWORK_REDIS_CACHE = Integer.MIN_VALUE + 1950;
|
||||
int FRAMEWORK_REDIS_CACHE = Integer.MIN_VALUE + 2000;
|
||||
|
||||
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2000;
|
||||
int FRAMEWORK_CONFIG = Integer.MIN_VALUE + 2100;
|
||||
|
||||
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2100;
|
||||
int FRAMEWORK_ENCRYPT = Integer.MIN_VALUE + 2200;
|
||||
|
||||
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2150;
|
||||
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2300;
|
||||
|
||||
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2200;
|
||||
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2400;
|
||||
|
||||
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 3000;
|
||||
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2500;
|
||||
|
||||
int FRAMEWORK_JOB_ASYNC = Integer.MIN_VALUE + 2600;
|
||||
|
||||
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2700;
|
||||
|
||||
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 2800;
|
||||
|
||||
int FRAMEWORK_BANNER = Integer.MIN_VALUE + 10000;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* bean 排序常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 常量 - 中文
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 配置项常量
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/14 16:15
|
||||
*/
|
||||
public interface ConfigKeys {
|
||||
|
||||
/**
|
||||
* SFTP 文件预览大小
|
||||
*/
|
||||
String SFTP_PREVIEW_SIZE = "sftp_previewSize";
|
||||
|
||||
/**
|
||||
* SFTP 重复文件备份
|
||||
*/
|
||||
String SFTP_UPLOAD_PRESENT_BACKUP = "sftp_uploadPresentBackup";
|
||||
|
||||
/**
|
||||
* SFTP 备份文件名称
|
||||
*/
|
||||
String SFTP_UPLOAD_BACKUP_FILE_NAME = "sftp_uploadBackupFileName";
|
||||
|
||||
/**
|
||||
* 加密公钥
|
||||
*/
|
||||
String ENCRYPT_PUBLIC_KEY = "encrypt_publicKey";
|
||||
|
||||
/**
|
||||
* 加密私钥
|
||||
*/
|
||||
String ENCRYPT_PRIVATE_KEY = "encrypt_privateKey";
|
||||
|
||||
/**
|
||||
* 日志前端显示行数
|
||||
*/
|
||||
String LOG_WEB_SCROLL_LINES = "log_webScrollLines";
|
||||
|
||||
/**
|
||||
* 日志加载偏移行
|
||||
*/
|
||||
String LOG_TRACKER_LOAD_LINES = "log_trackerLoadLines";
|
||||
|
||||
/**
|
||||
* 日志加载间隔毫秒
|
||||
*/
|
||||
String LOG_TRACKER_LOAD_INTERVAL = "log_trackerLoadInterval";
|
||||
|
||||
/**
|
||||
* 是否生成详细的执行日志
|
||||
*/
|
||||
String LOG_EXEC_DETAIL_LOG = "log_execDetailLog";
|
||||
|
||||
/**
|
||||
* 凭证有效期分
|
||||
*/
|
||||
String LOGIN_LOGIN_SESSION_TIME = "login_loginSessionTime";
|
||||
|
||||
/**
|
||||
* 允许多端登录
|
||||
*/
|
||||
String LOGIN_ALLOW_MULTI_DEVICE = "login_allowMultiDevice";
|
||||
|
||||
/**
|
||||
* 允许凭证续签
|
||||
*/
|
||||
String LOGIN_ALLOW_REFRESH = "login_allowRefresh";
|
||||
|
||||
/**
|
||||
* 凭证续签最大次数
|
||||
*/
|
||||
String LOGIN_MAX_REFRESH_COUNT = "login_maxRefreshCount";
|
||||
|
||||
/**
|
||||
* 凭证续签间隔分
|
||||
*/
|
||||
String LOGIN_REFRESH_INTERVAL = "login_refreshInterval";
|
||||
|
||||
/**
|
||||
* 登录失败锁定
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK = "login_loginFailedLock";
|
||||
|
||||
/**
|
||||
* 登录失败锁定阈值分
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK_THRESHOLD = "login_loginFailedLockThreshold";
|
||||
|
||||
/**
|
||||
* 登录失败锁定时间分
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_LOCK_TIME = "login_loginFailedLockTime";
|
||||
|
||||
/**
|
||||
* 登录失败发信
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_SEND = "login_loginFailedSend";
|
||||
|
||||
/**
|
||||
* 登录失败发信阈值
|
||||
*/
|
||||
String LOGIN_LOGIN_FAILED_SEND_THRESHOLD = "login_loginFailedSendThreshold";
|
||||
|
||||
/**
|
||||
* 是否开启自动清理命令记录
|
||||
*/
|
||||
String AUTO_CLEAR_EXEC_LOG_ENABLED = "autoClear_execLogEnabled";
|
||||
|
||||
/**
|
||||
* 自动清理命令记录保留天数
|
||||
*/
|
||||
String AUTO_CLEAR_EXEC_LOG_KEEP_DAYS = "autoClear_execLogKeepDays";
|
||||
|
||||
/**
|
||||
* 是否开启自动清理终端连接记录
|
||||
*/
|
||||
String AUTO_CLEAR_TERMINAL_LOG_ENABLED = "autoClear_terminalLogEnabled";
|
||||
|
||||
/**
|
||||
* 自动清理终端连接记录保留天数
|
||||
*/
|
||||
String AUTO_CLEAR_TERMINAL_LOG_KEEP_DAYS = "autoClear_terminalLogKeepDays";
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
import cn.orionsec.kit.lang.define.wrapper.CodeInfo;
|
||||
import cn.orionsec.kit.lang.define.wrapper.HttpWrapper;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
import cn.orionsec.kit.lang.exception.ApplicationException;
|
||||
import cn.orionsec.kit.lang.exception.argument.InvalidArgumentException;
|
||||
@@ -94,6 +94,8 @@ public interface ErrorMessage {
|
||||
|
||||
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
|
||||
|
||||
String DECRYPT_ERROR = "数据解密失败";
|
||||
|
||||
String PASSWORD_MISSING = "请输入密码";
|
||||
|
||||
String BEFORE_PASSWORD_ERROR = "原密码错误";
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 额外字段常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 字段常量
|
||||
@@ -105,4 +105,6 @@ public interface FieldConst {
|
||||
|
||||
String ALL = "all";
|
||||
|
||||
String CONFIG = "config";
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 文件常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 过滤器排序常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.constant;
|
||||
package org.dromara.visor.common.constant;
|
||||
|
||||
/**
|
||||
* 验证常量
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
/**
|
||||
* 数据清理请求 定义
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.dromara.visor.framework.common.validator.group.Page;
|
||||
import org.dromara.visor.common.validator.group.Page;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import cn.orionsec.kit.lang.utils.time.DateStream;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity;
|
||||
package org.dromara.visor.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity.chart;
|
||||
package org.dromara.visor.common.entity.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity.chart;
|
||||
package org.dromara.visor.common.entity.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity.chart;
|
||||
package org.dromara.visor.common.entity.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.entity.chart;
|
||||
package org.dromara.visor.common.entity.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.enums;
|
||||
package org.dromara.visor.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.enums;
|
||||
package org.dromara.visor.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.enums;
|
||||
package org.dromara.visor.common.enums;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.enums;
|
||||
package org.dromara.visor.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.handler.data;
|
||||
package org.dromara.visor.common.handler.data;
|
||||
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import org.dromara.visor.framework.common.handler.data.strategy.GenericsDataStrategy;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
import org.dromara.visor.common.handler.data.strategy.GenericsDataStrategy;
|
||||
|
||||
/**
|
||||
* 标准数据定义
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.handler.data.model;
|
||||
package org.dromara.visor.common.handler.data.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.handler.data.strategy;
|
||||
package org.dromara.visor.common.handler.data.strategy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
|
||||
/**
|
||||
* 标准数据处理策略 基类
|
||||
@@ -20,9 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.handler.data.strategy;
|
||||
package org.dromara.visor.common.handler.data.strategy;
|
||||
|
||||
import org.dromara.visor.framework.common.handler.data.model.GenericsDataModel;
|
||||
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
|
||||
|
||||
/**
|
||||
* 标准数据处理策略
|
||||
@@ -20,24 +20,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.crypto;
|
||||
package org.dromara.visor.common.interfaces;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.codec.Base62s;
|
||||
import cn.orionsec.kit.lang.utils.crypto.symmetric.SymmetricCrypto;
|
||||
|
||||
/**
|
||||
* 数据加密器
|
||||
* aes 加密器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/8 0:20
|
||||
*/
|
||||
public interface ValueCrypto extends SymmetricCrypto {
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
void init();
|
||||
public interface AesEncryptor extends SymmetricCrypto {
|
||||
|
||||
/**
|
||||
* 加密后 base62 编码
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.file;
|
||||
package org.dromara.visor.common.interfaces;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -114,6 +114,25 @@ public interface FileClient {
|
||||
*/
|
||||
byte[] getContent(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param path path
|
||||
* @return content
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String getContentAsString(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param path path
|
||||
* @param charset charset
|
||||
* @return content
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
String getContentAsString(String path, String charset) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取文件输入流
|
||||
*
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.lock;
|
||||
package org.dromara.visor.common.interfaces;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,28 +20,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.security.core.crypto;
|
||||
|
||||
import lombok.Data;
|
||||
package org.dromara.visor.common.interfaces;
|
||||
|
||||
/**
|
||||
* 加密配置
|
||||
* rsa 解密器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/8 0:14
|
||||
* @since 2025/1/5 20:58
|
||||
*/
|
||||
@Data
|
||||
public class CryptoConfig {
|
||||
public interface RsaDecryptor {
|
||||
|
||||
/**
|
||||
* 是否为默认加密器
|
||||
* 解密
|
||||
*
|
||||
* @param value value
|
||||
* @return value
|
||||
*/
|
||||
protected boolean primary;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
protected boolean enabled;
|
||||
String decrypt(String value);
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.json.filter;
|
||||
package org.dromara.visor.common.json;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Desensitizes;
|
||||
import cn.orionsec.kit.lang.utils.Objects1;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.json.filter;
|
||||
package org.dromara.visor.common.json;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.security;
|
||||
package org.dromara.visor.common.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.security;
|
||||
package org.dromara.visor.common.security;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Booleans;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.framework.common.utils.CryptoUtils;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||
|
||||
/**
|
||||
* 密码修改器
|
||||
@@ -52,7 +52,7 @@ public class PasswordModifier {
|
||||
if (Strings.isBlank(password)) {
|
||||
return Const.EMPTY;
|
||||
} else {
|
||||
return CryptoUtils.encryptAsString(password);
|
||||
return AesEncryptUtils.encryptAsString(password);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.security;
|
||||
package org.dromara.visor.common.security;
|
||||
|
||||
/**
|
||||
* SecurityUtils 的 bean 对象
|
||||
@@ -45,4 +45,11 @@ public interface SecurityHolder {
|
||||
*/
|
||||
Long getLoginUserId();
|
||||
|
||||
/**
|
||||
* 获取当前用户名
|
||||
*
|
||||
* @return username
|
||||
*/
|
||||
String getLoginUsername();
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.security;
|
||||
package org.dromara.visor.common.security;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.security;
|
||||
package org.dromara.visor.common.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@@ -20,9 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.thread;
|
||||
package org.dromara.visor.common.thread;
|
||||
|
||||
import org.dromara.visor.framework.common.utils.ThreadMdcUtils;
|
||||
import org.dromara.visor.common.utils.ThreadMdcUtils;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.meta;
|
||||
package org.dromara.visor.common.trace;
|
||||
|
||||
import cn.orionsec.kit.lang.id.UUIds;
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
@@ -20,25 +20,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.framework.common.crypto.ValueCrypto;
|
||||
import org.dromara.visor.common.interfaces.AesEncryptor;
|
||||
|
||||
/**
|
||||
* 加密工具类
|
||||
* <p>
|
||||
* PrimaryValueCrypto 代理类工具
|
||||
* aes 数据加密工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/8 0:05
|
||||
*/
|
||||
public class CryptoUtils {
|
||||
public class AesEncryptUtils {
|
||||
|
||||
private static ValueCrypto delegate;
|
||||
private static AesEncryptor delegate;
|
||||
|
||||
private CryptoUtils() {
|
||||
private AesEncryptUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,12 +161,12 @@ public class CryptoUtils {
|
||||
return delegate.decryptBase62(text);
|
||||
}
|
||||
|
||||
public static void setDelegate(ValueCrypto delegate) {
|
||||
if (CryptoUtils.delegate != null) {
|
||||
public static void setDelegate(AesEncryptor delegate) {
|
||||
if (AesEncryptUtils.delegate != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
}
|
||||
CryptoUtils.delegate = delegate;
|
||||
AesEncryptUtils.delegate = delegate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.constant.Const;
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.ext.location.Region;
|
||||
import cn.orionsec.kit.ext.location.region.LocationRegions;
|
||||
import cn.orionsec.kit.web.servlet.web.Servlets;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.framework.common.lock.Locker;
|
||||
import org.dromara.visor.common.interfaces.Locker;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Objects1;
|
||||
import cn.orionsec.kit.lang.utils.Systems;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import org.dromara.visor.framework.common.constant.AppConst;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.AppConst;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
/**
|
||||
* 路径工具类
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.web.servlet.web.Servlets;
|
||||
import org.dromara.visor.framework.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.framework.common.entity.RequestIdentityModel;
|
||||
import org.dromara.visor.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.common.entity.RequestIdentityModel;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@@ -20,42 +20,41 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.security.core.crypto;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.framework.common.crypto.ValueCrypto;
|
||||
import org.dromara.visor.common.interfaces.RsaDecryptor;
|
||||
|
||||
/**
|
||||
* 默认加密器
|
||||
* rsa 参数解密工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/21 12:11
|
||||
* @since 2025/1/5 21:13
|
||||
*/
|
||||
public class PrimaryValueCrypto implements ValueCrypto {
|
||||
public class RsaParamDecryptUtils {
|
||||
|
||||
private static ValueCrypto delegate;
|
||||
private static RsaDecryptor delegate;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
private RsaParamDecryptUtils() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encrypt(byte[] plain) {
|
||||
return delegate.encrypt(plain);
|
||||
/**
|
||||
* 解密
|
||||
*
|
||||
* @param value value
|
||||
* @return value
|
||||
*/
|
||||
public static String decrypt(String value) {
|
||||
return delegate.decrypt(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] decrypt(byte[] text) {
|
||||
return delegate.decrypt(text);
|
||||
}
|
||||
|
||||
protected static void setDelegate(ValueCrypto delegate) {
|
||||
if (PrimaryValueCrypto.delegate != null) {
|
||||
public static void setDelegate(RsaDecryptor delegate) {
|
||||
if (RsaParamDecryptUtils.delegate != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
}
|
||||
PrimaryValueCrypto.delegate = delegate;
|
||||
RsaParamDecryptUtils.delegate = delegate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,9 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
/**
|
||||
* sql 工具类
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import cn.orionsec.kit.lang.utils.reflect.Annotations;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
@@ -20,9 +20,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import org.dromara.visor.framework.common.meta.TraceIdHolder;
|
||||
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -20,11 +20,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import org.dromara.visor.framework.common.constant.Const;
|
||||
import org.dromara.visor.framework.common.entity.TreeNode;
|
||||
import org.dromara.visor.common.constant.Const;
|
||||
import org.dromara.visor.common.entity.TreeNode;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -20,12 +20,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Arrays1;
|
||||
import cn.orionsec.kit.lang.utils.io.Files1;
|
||||
import cn.orionsec.kit.spring.SpringHolder;
|
||||
import org.dromara.visor.framework.common.constant.ErrorMessage;
|
||||
import org.dromara.visor.common.constant.ErrorMessage;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 批量验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 清理验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 导出验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.validator.group;
|
||||
package org.dromara.visor.common.validator.group;
|
||||
|
||||
/**
|
||||
* 分页验证分组
|
||||
@@ -20,7 +20,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.web.filter;
|
||||
package org.dromara.visor.common.web;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
|
||||
@@ -33,9 +33,9 @@ import javax.servlet.Filter;
|
||||
* @version 1.0.0
|
||||
* @since 2023/6/25 15:05
|
||||
*/
|
||||
public class FilterCreator {
|
||||
public class WebFilterCreator {
|
||||
|
||||
private FilterCreator() {
|
||||
private WebFilterCreator() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.2.3</revision>
|
||||
<revision>2.3.4</revision>
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
@@ -62,7 +62,7 @@
|
||||
<!-- orion-visor-starter -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -75,6 +75,11 @@
|
||||
<artifactId>orion-visor-spring-boot-starter-web</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-config</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-swagger</artifactId>
|
||||
@@ -110,6 +115,11 @@
|
||||
<artifactId>orion-visor-spring-boot-starter-desensitize</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-encrypt</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-spring-boot-starter-log</artifactId>
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.framework.common.file.FileClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 文件客户端工具
|
||||
* <p>
|
||||
* PrimaryFileClient 代理类工具
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/21 12:05
|
||||
*/
|
||||
public class FileClientUtils {
|
||||
|
||||
private static FileClient delegate;
|
||||
|
||||
private FileClientUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, byte[] content) throws Exception {
|
||||
return delegate.upload(path, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, byte[] content, boolean overrideIfExist) throws Exception {
|
||||
return delegate.upload(path, content, overrideIfExist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in) throws Exception {
|
||||
return delegate.upload(path, in);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in, boolean autoClose) throws Exception {
|
||||
return delegate.upload(path, in, autoClose);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param in in
|
||||
* @param autoClose autoClose
|
||||
* @param overrideIfExist 文件存在是否覆盖
|
||||
* @return 路径
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static String upload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception {
|
||||
return delegate.upload(path, in, autoClose, overrideIfExist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
*
|
||||
* @param path path
|
||||
* @return 是否存在
|
||||
*/
|
||||
public static boolean isExists(String path) {
|
||||
return delegate.isExists(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param path 路径
|
||||
* @return 是否删除
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static boolean delete(String path) throws Exception {
|
||||
return delegate.delete(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
*
|
||||
* @param path path
|
||||
* @return bytes
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static byte[] getContent(String path) throws Exception {
|
||||
return delegate.getContent(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输入流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static InputStream getContentInputStream(String path) throws Exception {
|
||||
return delegate.getContentInputStream(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static OutputStream getContentOutputStream(String path) throws Exception {
|
||||
return delegate.getContentOutputStream(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件输出流
|
||||
*
|
||||
* @param path path
|
||||
* @param append append
|
||||
* @return stream
|
||||
* @throws Exception Exception
|
||||
*/
|
||||
public static OutputStream getContentOutputStream(String path, boolean append) throws Exception {
|
||||
return delegate.getContentOutputStream(path, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取返回路径 用于客户端返回
|
||||
*
|
||||
* @param path path
|
||||
* @return returnPath
|
||||
*/
|
||||
public static String getReturnPath(String path) {
|
||||
return delegate.getReturnPath(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实际存储路径 用于服务端的存储
|
||||
*
|
||||
* @param returnPath returnPath
|
||||
* @return absolutePath
|
||||
*/
|
||||
public static String getAbsolutePath(String returnPath) {
|
||||
return delegate.getAbsolutePath(returnPath);
|
||||
}
|
||||
|
||||
public static void setDelegate(FileClient delegate) {
|
||||
if (FileClientUtils.delegate != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
}
|
||||
FileClientUtils.delegate = delegate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
org.dromara.visor.framework.common.configuration.OrionCommonAutoConfiguration
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
package org.dromara.visor.framework.banner.configuration;
|
||||
|
||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.framework.banner.core.runner.BannerApplicationRunner;
|
||||
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -24,15 +24,15 @@ package org.dromara.visor.framework.biz.operator.log.configuration;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.common.json.FieldDesensitizeFilter;
|
||||
import org.dromara.visor.common.json.FieldIgnoreFilter;
|
||||
import org.dromara.visor.framework.biz.operator.log.configuration.config.OperatorLogConfig;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.aspect.OperatorLogAspect;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkServiceDelegate;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogFiller;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.framework.common.json.filter.FieldDesensitizeFilter;
|
||||
import org.dromara.visor.framework.common.json.filter.FieldIgnoreFilter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.biz.operator.log.configuration.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.visor.framework.common.utils.ConfigUtils;
|
||||
import org.dromara.visor.common.utils.ConfigUtils;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,6 +30,9 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.dromara.visor.common.constant.BeanOrderConst;
|
||||
import org.dromara.visor.common.security.LoginUser;
|
||||
import org.dromara.visor.common.security.SecurityHolder;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.IgnoreParameter;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.OperatorTypeHolder;
|
||||
@@ -38,9 +41,6 @@ import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.service.OperatorLogFrameworkService;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogFiller;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import org.dromara.visor.framework.common.constant.BeanOrderConst;
|
||||
import org.dromara.visor.framework.common.security.LoginUser;
|
||||
import org.dromara.visor.framework.common.security.SecurityHolder;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.biz.operator.log.core.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.visor.framework.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.common.entity.RequestIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@@ -29,16 +29,16 @@ import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.json.matcher.ReplacementFormatters;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import org.dromara.visor.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.common.enums.BooleanBit;
|
||||
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||
import org.dromara.visor.common.security.LoginUser;
|
||||
import org.dromara.visor.common.utils.Requests;
|
||||
import org.dromara.visor.framework.biz.operator.log.configuration.config.OperatorLogConfig;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.enums.ReturnType;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.factory.OperatorTypeHolder;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import org.dromara.visor.framework.biz.operator.log.core.model.OperatorType;
|
||||
import org.dromara.visor.framework.common.entity.RequestIdentity;
|
||||
import org.dromara.visor.framework.common.enums.BooleanBit;
|
||||
import org.dromara.visor.framework.common.meta.TraceIdHolder;
|
||||
import org.dromara.visor.framework.common.security.LoginUser;
|
||||
import org.dromara.visor.framework.common.utils.Requests;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
package org.dromara.visor.framework.biz.operator.log.core.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import org.dromara.visor.framework.common.constant.ExtraFieldConst;
|
||||
import org.dromara.visor.framework.common.security.LoginUser;
|
||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||
import org.dromara.visor.common.security.LoginUser;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -74,7 +76,7 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
* @param value value
|
||||
*/
|
||||
public static void addJson(String key, Object value) {
|
||||
EXTRA_HOLDER.get().put(key, JSON.parseObject(JSON.toJSONString(value, serializeFilters)));
|
||||
EXTRA_HOLDER.get().put(key, JSON.parseObject(toJsonString(value)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,13 +98,25 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
if (obj instanceof Map) {
|
||||
if (obj instanceof JSONObject || obj instanceof com.alibaba.fastjson2.JSONObject) {
|
||||
EXTRA_HOLDER.get().putAll(JSON.parseObject(toJsonString(obj)));
|
||||
} else if (obj instanceof Map) {
|
||||
EXTRA_HOLDER.get().putAll((Map<String, ?>) obj);
|
||||
} else {
|
||||
EXTRA_HOLDER.get().putAll(JSON.parseObject(JSON.toJSONString(obj, serializeFilters)));
|
||||
EXTRA_HOLDER.get().putAll(JSON.parseObject(toJsonString(obj)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 json
|
||||
*
|
||||
* @param value value
|
||||
* @return json
|
||||
*/
|
||||
public static String toJsonString(Object value) {
|
||||
return JSON.toJSONString(value, serializeFilters);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置不保存
|
||||
*/
|
||||
@@ -167,6 +181,29 @@ public class OperatorLogs implements ExtraFieldConst {
|
||||
USER_HOLDER.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空 html tag
|
||||
*
|
||||
* @param log log
|
||||
* @return cleared
|
||||
*/
|
||||
public static String clearHtmlTag(String log) {
|
||||
if (Strings.isBlank(log)) {
|
||||
return log;
|
||||
}
|
||||
return log.replaceAll("<sb 0>", "")
|
||||
.replaceAll("<sb 2>", "")
|
||||
.replaceAll("<sb>", "")
|
||||
.replaceAll("</sb>", "")
|
||||
.replaceAll("<sr 0>", "")
|
||||
.replaceAll("<sr 2>", "")
|
||||
.replaceAll("<sr>", "")
|
||||
.replaceAll("</sr>", "")
|
||||
.replaceAll("<b>", "")
|
||||
.replaceAll("</b>", "")
|
||||
.replaceAll("<br/>", "\n");
|
||||
}
|
||||
|
||||
public static void setSerializeFilters(SerializeFilter[] serializeFilters) {
|
||||
if (OperatorLogs.serializeFilters != null) {
|
||||
// unmodified
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>orion-visor-spring-boot-starter-config</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>项目配置中心</description>
|
||||
<url>https://github.com/dromara/orion-visor</url>
|
||||
|
||||
<dependencies>
|
||||
<!-- common -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring boot starter -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.configuration;
|
||||
|
||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.framework.config.core.listener.ConfigUpdateListener;
|
||||
import org.dromara.visor.framework.config.core.service.ConfigFrameworkService;
|
||||
import org.dromara.visor.framework.config.core.service.ConfigFrameworkServiceDelegate;
|
||||
import org.dromara.visor.framework.config.core.store.ManagementConfigStore;
|
||||
import org.dromara.visor.framework.config.core.store.ManagementConfigStoreImpl;
|
||||
import org.dromara.visor.framework.config.core.utils.ConfigStores;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* 配置中心 自动配置类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 15:44
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_CONFIG)
|
||||
public class OrionConfigAutoConfiguration {
|
||||
|
||||
/**
|
||||
* @param impl impl
|
||||
* @return 配置框架服务
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public ConfigFrameworkServiceDelegate configFrameworkService(ConfigFrameworkService impl) {
|
||||
return new ConfigFrameworkServiceDelegate(impl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param delegate delegate
|
||||
* @return 配置修改监听器
|
||||
*/
|
||||
@Bean
|
||||
public ManagementConfigStore configStore(ConfigFrameworkServiceDelegate delegate) {
|
||||
// 初始化
|
||||
ManagementConfigStoreImpl configStore = new ManagementConfigStoreImpl(delegate);
|
||||
// 加载全部配置
|
||||
configStore.loadAllConfig();
|
||||
// 设置 ConfigStores
|
||||
ConfigStores.setDelegate(configStore);
|
||||
return configStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configStore configStore
|
||||
* @return 配置更新监听器
|
||||
*/
|
||||
@Bean
|
||||
public ConfigUpdateListener configUpdateListener(ManagementConfigStore configStore) {
|
||||
return new ConfigUpdateListener(configStore);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.event;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Maps;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 配置更新事件
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 17:24
|
||||
*/
|
||||
public class ConfigUpdateEvent extends ApplicationEvent {
|
||||
|
||||
private ConfigUpdateEvent(Map<String, String> configs) {
|
||||
super(configs);
|
||||
}
|
||||
|
||||
public static ConfigUpdateEvent of(Map<String, String> configs) {
|
||||
return new ConfigUpdateEvent(configs);
|
||||
}
|
||||
|
||||
public static ConfigUpdateEvent of(String key, String value) {
|
||||
return new ConfigUpdateEvent(Maps.of(key, value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,37 +20,35 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.infra.handler.setting.strategy;
|
||||
package org.dromara.visor.framework.config.core.listener;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.framework.common.handler.data.strategy.AbstractGenericsDataStrategy;
|
||||
import org.dromara.visor.module.infra.handler.setting.model.SftpSystemSettingModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.dromara.visor.framework.config.core.event.ConfigUpdateEvent;
|
||||
import org.dromara.visor.framework.config.core.store.ManagementConfigStore;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SFTP 系统配置策略
|
||||
* 配置修改监听器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/10/9 11:44
|
||||
* @since 2025/1/6 16:01
|
||||
*/
|
||||
@Component
|
||||
public class SftpSystemSettingStrategy extends AbstractGenericsDataStrategy<SftpSystemSettingModel> {
|
||||
public class ConfigUpdateListener implements ApplicationListener<ConfigUpdateEvent> {
|
||||
|
||||
public SftpSystemSettingStrategy() {
|
||||
super(SftpSystemSettingModel.class);
|
||||
private final ManagementConfigStore configStore;
|
||||
|
||||
public ConfigUpdateListener(ManagementConfigStore configStore) {
|
||||
this.configStore = configStore;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public SftpSystemSettingModel getDefault() {
|
||||
return SftpSystemSettingModel.builder()
|
||||
.previewSize(2)
|
||||
.build();
|
||||
public void onApplicationEvent(ConfigUpdateEvent event) {
|
||||
// 获取修改的配置并且覆盖
|
||||
Map<String, String> configs = (Map<String, String>) event.getSource();
|
||||
configs.forEach(configStore::override);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SftpSystemSettingModel parse(String serialModel) {
|
||||
throw Exceptions.unsupported();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.ref;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Objects1;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 配置引用实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/14 16:10
|
||||
*/
|
||||
@Slf4j
|
||||
public class ConfigRefImpl<T> extends ConfigRef<T> {
|
||||
|
||||
protected BiConsumer<T, T> changeEvent;
|
||||
|
||||
public ConfigRefImpl(String key, Function<String, T> convert) {
|
||||
super(key, convert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void override(String value) {
|
||||
try {
|
||||
this.set(convert.apply(value));
|
||||
} catch (Exception e) {
|
||||
log.error("ConfigRef trigger override error key: {}, value: {}", key, value, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(T value) {
|
||||
T before = this.value;
|
||||
this.value = value;
|
||||
// 被修改
|
||||
if (!Objects1.eq(before, value)) {
|
||||
log.info("ConfigRef changed key: {}, value: {}", key, value);
|
||||
// 触发事件
|
||||
if (changeEvent != null) {
|
||||
changeEvent.accept(value, before);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<T> onChange(BiConsumer<T, T> changeEvent) {
|
||||
this.changeEvent = changeEvent;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,25 +20,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.module.asset.define.config;
|
||||
package org.dromara.visor.framework.config.core.service;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.visor.framework.common.entity.AutoClearConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 批量执行日志自动清理配置
|
||||
* 配置框架服务
|
||||
* <p>
|
||||
* 在业务层定义 bean
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/24 15:01
|
||||
* @since 2025/1/6 17:08
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ConfigurationProperties(prefix = "app.auto-clear.exec-log")
|
||||
public class AppExecLogAutoClearConfig extends AutoClearConfig {
|
||||
public interface ConfigFrameworkService {
|
||||
|
||||
/**
|
||||
* 获取全部配置
|
||||
*
|
||||
* @return config
|
||||
*/
|
||||
Map<String, String> getAllConfig();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 配置框架服务代理
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 17:08
|
||||
*/
|
||||
public class ConfigFrameworkServiceDelegate implements ConfigFrameworkService {
|
||||
|
||||
private final ConfigFrameworkService configFrameworkService;
|
||||
|
||||
public ConfigFrameworkServiceDelegate(ConfigFrameworkService configFrameworkService) {
|
||||
this.configFrameworkService = configFrameworkService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAllConfig() {
|
||||
return configFrameworkService.getAllConfig();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.store;
|
||||
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
|
||||
/**
|
||||
* 可控配置中心
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 23:00
|
||||
*/
|
||||
public interface ManagementConfigStore extends ConfigStore {
|
||||
|
||||
/**
|
||||
* 加载全部配置
|
||||
*/
|
||||
void loadAllConfig();
|
||||
|
||||
/**
|
||||
* 覆盖配置
|
||||
*
|
||||
* @param key key
|
||||
* @param value value
|
||||
*/
|
||||
void override(String key, String value);
|
||||
|
||||
/**
|
||||
* 注册 ref
|
||||
*
|
||||
* @param ref ref
|
||||
*/
|
||||
void register(ConfigRef<?> ref);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.store;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.framework.config.core.ref.ConfigRefImpl;
|
||||
import org.dromara.visor.framework.config.core.service.ConfigFrameworkService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 配置中心实现
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 17:20
|
||||
*/
|
||||
@Slf4j
|
||||
public class ManagementConfigStoreImpl implements ManagementConfigStore {
|
||||
|
||||
private final ConcurrentHashMap<String, String> configMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final ConcurrentHashMap<String, List<ConfigRef<?>>> configRefs = new ConcurrentHashMap<>();
|
||||
|
||||
private final ConfigFrameworkService service;
|
||||
|
||||
public ManagementConfigStoreImpl(ConfigFrameworkService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllConfig() {
|
||||
configMap.putAll(service.getAllConfig());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void override(String key, String value) {
|
||||
log.info("ConfigStore.override key: {}, value: {}", key, value);
|
||||
// 修改配置
|
||||
configMap.put(key, value);
|
||||
// 修改引用
|
||||
List<ConfigRef<?>> refs = configRefs.get(key);
|
||||
if (!Lists.isEmpty(refs)) {
|
||||
refs.forEach(s -> s.override(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(ConfigRef<?> ref) {
|
||||
String key = ref.key;
|
||||
log.info("ConfigStore.register ref key: {}", key);
|
||||
// 注册引用
|
||||
configRefs.computeIfAbsent(key, k -> new ArrayList<>()).add(ref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String key) {
|
||||
return this.getConfig(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String key, String defaultValue) {
|
||||
return this.getConfig(key, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getInteger(String key) {
|
||||
return this.getConfig(key, Integer::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getInteger(String key, Integer defaultValue) {
|
||||
return this.getConfig(key, Integer::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getLong(String key) {
|
||||
return this.getConfig(key, Long::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getLong(String key, Long defaultValue) {
|
||||
return this.getConfig(key, Long::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDouble(String key) {
|
||||
return this.getConfig(key, Double::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDouble(String key, Double defaultValue) {
|
||||
return this.getConfig(key, Double::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getBoolean(String key) {
|
||||
return this.getConfig(key, Boolean::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getBoolean(String key, Boolean defaultValue) {
|
||||
return this.getConfig(key, Boolean::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfig(String key) {
|
||||
return this.getConfig(key, Function.identity(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfig(String key, String defaultValue) {
|
||||
return this.getConfig(key, Function.identity(), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getConfig(String key, Function<String, T> convert) {
|
||||
return this.getConfig(key, convert, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getConfig(String key, Function<String, T> convert, T defaultValue) {
|
||||
// 获取配置
|
||||
String conf = configMap.get(key);
|
||||
// 默认值
|
||||
if (conf == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
// 转换
|
||||
return convert.apply(conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<String> string(String key) {
|
||||
return this.ref(key, Function.identity(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<String> string(String key, String defaultValue) {
|
||||
return this.ref(key, Function.identity(), defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Integer> int32(String key) {
|
||||
return this.ref(key, Integer::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Integer> int32(String key, Integer defaultValue) {
|
||||
return this.ref(key, Integer::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Long> int64(String key) {
|
||||
return this.ref(key, Long::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Long> int64(String key, Long defaultValue) {
|
||||
return this.ref(key, Long::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Double> float64(String key) {
|
||||
return this.ref(key, Double::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Double> float64(String key, Double defaultValue) {
|
||||
return this.ref(key, Double::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Boolean> bool(String key) {
|
||||
return this.ref(key, Boolean::valueOf, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigRef<Boolean> bool(String key, Boolean defaultValue) {
|
||||
return this.ref(key, Boolean::valueOf, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ConfigRef<T> ref(String key, Function<String, T> convert) {
|
||||
return this.ref(key, convert, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ConfigRef<T> ref(String key, Function<String, T> convert, T defaultValue) {
|
||||
// 创建引用
|
||||
ConfigRef<T> ref = new ConfigRefImpl<>(key, convert);
|
||||
// 设置值
|
||||
String value = configMap.get(key);
|
||||
if (value != null) {
|
||||
ref.override(value);
|
||||
} else {
|
||||
ref.set(defaultValue);
|
||||
}
|
||||
// 注册引用
|
||||
this.register(ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* Copyright (c) 2023 - present Dromara, All rights reserved.
|
||||
*
|
||||
* https://visor.dromara.org
|
||||
* https://visor.dromara.org.cn
|
||||
* https://visor.orionsec.cn
|
||||
*
|
||||
* Members:
|
||||
* Jiahang Li - ljh1553488six@139.com - author
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.visor.framework.config.core.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.common.config.ConfigRef;
|
||||
import org.dromara.visor.common.config.ConfigStore;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 配置中心
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/6 17:20
|
||||
*/
|
||||
public class ConfigStores {
|
||||
|
||||
private static ConfigStore delegate;
|
||||
|
||||
private ConfigStores() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
public String getString(String key) {
|
||||
return delegate.getString(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
public String getString(String key, String defaultValue) {
|
||||
return delegate.getString(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
public Integer getInteger(String key) {
|
||||
return delegate.getInteger(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
public Integer getInteger(String key, Integer defaultValue) {
|
||||
return delegate.getInteger(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
public Long getLong(String key) {
|
||||
return delegate.getLong(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
public Long getLong(String key, Long defaultValue) {
|
||||
return delegate.getLong(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
public Double getDouble(String key) {
|
||||
return delegate.getDouble(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
public Double getDouble(String key, Double defaultValue) {
|
||||
return delegate.getDouble(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return config
|
||||
*/
|
||||
public Boolean getBoolean(String key) {
|
||||
return delegate.getBoolean(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return config
|
||||
*/
|
||||
public Boolean getBoolean(String key, Boolean defaultValue) {
|
||||
return delegate.getBoolean(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @return conf
|
||||
*/
|
||||
public static String getConfig(String key) {
|
||||
return delegate.getConfig(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return conf
|
||||
*/
|
||||
public static String getConfig(String key, String defaultValue) {
|
||||
return delegate.getConfig(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param <T> T
|
||||
* @return conf
|
||||
*/
|
||||
public static <T> T getConfig(String key, Function<String, T> convert) {
|
||||
return delegate.getConfig(key, convert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @param <T> T
|
||||
* @return conf
|
||||
*/
|
||||
public static <T> T getConfig(String key, Function<String, T> convert, T defaultValue) {
|
||||
return delegate.getConfig(key, convert, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<String> string(String key) {
|
||||
return delegate.string(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 string 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<String> string(String key, String defaultValue) {
|
||||
return delegate.string(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Integer> int32(String key) {
|
||||
return delegate.int32(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 int 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Integer> int32(String key, Integer defaultValue) {
|
||||
return delegate.int32(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Long> int64(String key) {
|
||||
return delegate.int64(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 long 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Long> int64(String key, Long defaultValue) {
|
||||
return delegate.int64(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Double> float64(String key) {
|
||||
return delegate.float64(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 double 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Double> float64(String key, Double defaultValue) {
|
||||
return delegate.float64(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Boolean> bool(String key) {
|
||||
return delegate.bool(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 boolean 配置
|
||||
*
|
||||
* @param key key
|
||||
* @param defaultValue defaultValue
|
||||
* @return ref
|
||||
*/
|
||||
public static ConfigRef<Boolean> bool(String key, Boolean defaultValue) {
|
||||
return delegate.bool(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param <T> T
|
||||
* @return ref
|
||||
*/
|
||||
public static <T> ConfigRef<T> ref(String key, Function<String, T> convert) {
|
||||
return delegate.ref(key, convert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*
|
||||
* @param key key
|
||||
* @param convert convert
|
||||
* @param defaultValue defaultValue
|
||||
* @param <T> T
|
||||
* @return ref
|
||||
*/
|
||||
public static <T> ConfigRef<T> ref(String key, Function<String, T> convert, T defaultValue) {
|
||||
return delegate.ref(key, convert, defaultValue);
|
||||
}
|
||||
|
||||
public static void setDelegate(ConfigStore configStore) {
|
||||
if (ConfigStores.delegate != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
}
|
||||
ConfigStores.delegate = configStore;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.dromara.visor.framework.config.configuration.OrionConfigAutoConfiguration
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mysql -->
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package org.dromara.visor.framework.datasource.configuration;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||
import org.dromara.visor.framework.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||
import org.dromara.visor.framework.datasource.core.filter.DruidAdRemoveFilter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.visor</groupId>
|
||||
<artifactId>orion-visor-framework-common</artifactId>
|
||||
<artifactId>orion-visor-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- web -->
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user