🎨 优化项目模块.
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
package org.dromara.visor.common.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置引用
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2025/1/6 18:01
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class ConfigRef<T> {
|
||||||
|
|
||||||
|
public final String key;
|
||||||
|
|
||||||
|
private final Function<String, T> convert;
|
||||||
|
|
||||||
|
public T value;
|
||||||
|
|
||||||
|
public ConfigRef(String key, Function<String, T> convert) {
|
||||||
|
this.key = key;
|
||||||
|
this.convert = convert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 覆盖配置
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
*/
|
||||||
|
public void override(String value) {
|
||||||
|
try {
|
||||||
|
this.value = convert.apply(value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("ConfigRef trigger override error key: {}, value: {}", key, value, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置值
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
*/
|
||||||
|
public void set(T value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置
|
||||||
|
*
|
||||||
|
* @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 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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,8 +37,6 @@ public interface AutoConfigureOrderConst {
|
|||||||
|
|
||||||
int FRAMEWORK_SECURITY = Integer.MIN_VALUE + 1200;
|
int FRAMEWORK_SECURITY = Integer.MIN_VALUE + 1200;
|
||||||
|
|
||||||
int FRAMEWORK_SECURITY_CRYPTO = Integer.MIN_VALUE + 1250;
|
|
||||||
|
|
||||||
int FRAMEWORK_WEBSOCKET = Integer.MIN_VALUE + 1300;
|
int FRAMEWORK_WEBSOCKET = Integer.MIN_VALUE + 1300;
|
||||||
|
|
||||||
int FRAMEWORK_DESENSITIZE = Integer.MIN_VALUE + 1400;
|
int FRAMEWORK_DESENSITIZE = Integer.MIN_VALUE + 1400;
|
||||||
@@ -53,19 +51,23 @@ public interface AutoConfigureOrderConst {
|
|||||||
|
|
||||||
int FRAMEWORK_REDIS = Integer.MIN_VALUE + 1900;
|
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 + 2130;
|
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2300;
|
||||||
|
|
||||||
int FRAMEWORK_JOB_ASYNC = Integer.MIN_VALUE + 2160;
|
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2400;
|
||||||
|
|
||||||
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2200;
|
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2500;
|
||||||
|
|
||||||
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 3000;
|
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;
|
int FRAMEWORK_BANNER = Integer.MIN_VALUE + 10000;
|
||||||
|
|
||||||
|
|||||||
@@ -20,24 +20,19 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.crypto;
|
package org.dromara.visor.common.interfaces;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.codec.Base62s;
|
import cn.orionsec.kit.lang.utils.codec.Base62s;
|
||||||
import cn.orionsec.kit.lang.utils.crypto.symmetric.SymmetricCrypto;
|
import cn.orionsec.kit.lang.utils.crypto.symmetric.SymmetricCrypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据加密器
|
* aes 加密器
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/7/8 0:20
|
* @since 2023/7/8 0:20
|
||||||
*/
|
*/
|
||||||
public interface ValueCrypto extends SymmetricCrypto {
|
public interface AesEncryptor extends SymmetricCrypto {
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化
|
|
||||||
*/
|
|
||||||
void init();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加密后 base62 编码
|
* 加密后 base62 编码
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.file;
|
package org.dromara.visor.common.interfaces;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.lock;
|
package org.dromara.visor.common.interfaces;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.visor.common.interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rsa 加密器
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2025/1/5 20:58
|
||||||
|
*/
|
||||||
|
public interface RsaEncryptor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
String encrypt(String value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
String decrypt(String value);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.json.filter;
|
package org.dromara.visor.common.json;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Desensitizes;
|
import cn.orionsec.kit.lang.utils.Desensitizes;
|
||||||
import cn.orionsec.kit.lang.utils.Objects1;
|
import cn.orionsec.kit.lang.utils.Objects1;
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.json.filter;
|
package org.dromara.visor.common.json;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.common.security;
|
|||||||
import cn.orionsec.kit.lang.utils.Booleans;
|
import cn.orionsec.kit.lang.utils.Booleans;
|
||||||
import cn.orionsec.kit.lang.utils.Strings;
|
import cn.orionsec.kit.lang.utils.Strings;
|
||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码修改器
|
* 密码修改器
|
||||||
@@ -52,7 +52,7 @@ public class PasswordModifier {
|
|||||||
if (Strings.isBlank(password)) {
|
if (Strings.isBlank(password)) {
|
||||||
return Const.EMPTY;
|
return Const.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
return CryptoUtils.encryptAsString(password);
|
return AesEncryptUtils.encryptAsString(password);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.meta;
|
package org.dromara.visor.common.trace;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.id.UUIds;
|
import cn.orionsec.kit.lang.id.UUIds;
|
||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
@@ -23,22 +23,20 @@
|
|||||||
package org.dromara.visor.common.utils;
|
package org.dromara.visor.common.utils;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import org.dromara.visor.common.crypto.ValueCrypto;
|
import org.dromara.visor.common.interfaces.AesEncryptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加密工具类
|
* aes 数据加密工具类
|
||||||
* <p>
|
|
||||||
* PrimaryValueCrypto 代理类工具
|
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/7/8 0:05
|
* @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);
|
return delegate.decryptBase62(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDelegate(ValueCrypto delegate) {
|
public static void setDelegate(AesEncryptor delegate) {
|
||||||
if (CryptoUtils.delegate != null) {
|
if (AesEncryptUtils.delegate != null) {
|
||||||
// unmodified
|
// unmodified
|
||||||
throw Exceptions.state();
|
throw Exceptions.state();
|
||||||
}
|
}
|
||||||
CryptoUtils.delegate = delegate;
|
AesEncryptUtils.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ package org.dromara.visor.common.utils;
|
|||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.lock.Locker;
|
import org.dromara.visor.common.interfaces.Locker;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package org.dromara.visor.common.utils;
|
||||||
|
|
||||||
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
|
import org.dromara.visor.common.interfaces.RsaEncryptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rsa 加密工具类
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2025/1/5 21:13
|
||||||
|
*/
|
||||||
|
public class RsaEncryptorUtils {
|
||||||
|
|
||||||
|
private static RsaEncryptor delegate;
|
||||||
|
|
||||||
|
private RsaEncryptorUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
public static String encrypt(String value) {
|
||||||
|
return delegate.encrypt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密
|
||||||
|
*
|
||||||
|
* @param value value
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
public static String decrypt(String value) {
|
||||||
|
return delegate.decrypt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDelegate(RsaEncryptor delegate) {
|
||||||
|
if (RsaEncryptorUtils.delegate != null) {
|
||||||
|
// unmodified
|
||||||
|
throw Exceptions.state();
|
||||||
|
}
|
||||||
|
RsaEncryptorUtils.delegate = delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.utils;
|
package org.dromara.visor.common.utils;
|
||||||
|
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.common.web.filter;
|
package org.dromara.visor.common.web;
|
||||||
|
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ import javax.servlet.Filter;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/6/25 15:05
|
* @since 2023/6/25 15:05
|
||||||
*/
|
*/
|
||||||
public class FilterCreator {
|
public class WebFilterCreator {
|
||||||
|
|
||||||
private FilterCreator() {
|
private WebFilterCreator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,8 +25,8 @@ package org.dromara.visor.framework.biz.operator.log.configuration;
|
|||||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||||
import org.dromara.visor.common.json.filter.FieldDesensitizeFilter;
|
import org.dromara.visor.common.json.FieldDesensitizeFilter;
|
||||||
import org.dromara.visor.common.json.filter.FieldIgnoreFilter;
|
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.configuration.config.OperatorLogConfig;
|
||||||
import org.dromara.visor.framework.biz.operator.log.core.aspect.OperatorLogAspect;
|
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.OperatorLogFrameworkService;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||||
import org.dromara.visor.common.entity.RequestIdentity;
|
import org.dromara.visor.common.entity.RequestIdentity;
|
||||||
import org.dromara.visor.common.enums.BooleanBit;
|
import org.dromara.visor.common.enums.BooleanBit;
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.dromara.visor.common.security.LoginUser;
|
import org.dromara.visor.common.security.LoginUser;
|
||||||
import org.dromara.visor.common.utils.Requests;
|
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.configuration.config.OperatorLogConfig;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||||
import com.alibaba.fastjson.serializer.ValueFilter;
|
import com.alibaba.fastjson.serializer.ValueFilter;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.dromara.visor.common.json.filter.FieldDesensitizeFilter;
|
import org.dromara.visor.common.json.FieldDesensitizeFilter;
|
||||||
import org.dromara.visor.common.json.filter.FieldIgnoreFilter;
|
import org.dromara.visor.common.json.FieldIgnoreFilter;
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.dromara.visor.common.security.SecurityHolder;
|
import org.dromara.visor.common.security.SecurityHolder;
|
||||||
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
|
import org.dromara.visor.framework.log.configuration.config.LogPrinterConfig;
|
||||||
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
import org.dromara.visor.framework.log.core.annotation.IgnoreLog;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.redis.configuration;
|
package org.dromara.visor.framework.redis.configuration;
|
||||||
|
|
||||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||||
import org.dromara.visor.common.lock.Locker;
|
import org.dromara.visor.common.interfaces.Locker;
|
||||||
import org.dromara.visor.common.utils.LockerUtils;
|
import org.dromara.visor.common.utils.LockerUtils;
|
||||||
import org.dromara.visor.framework.redis.configuration.config.RedissonConfig;
|
import org.dromara.visor.framework.redis.configuration.config.RedissonConfig;
|
||||||
import org.dromara.visor.framework.redis.core.lock.RedisLocker;
|
import org.dromara.visor.framework.redis.core.lock.RedisLocker;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ package org.dromara.visor.framework.redis.core.lock;
|
|||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.lock.Locker;
|
import org.dromara.visor.common.interfaces.Locker;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
package org.dromara.visor.framework.security.configuration;
|
package org.dromara.visor.framework.security.configuration;
|
||||||
|
|
||||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||||
import org.dromara.visor.common.crypto.ValueCrypto;
|
import org.dromara.visor.common.interfaces.AesEncryptor;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
import org.dromara.visor.framework.security.configuration.config.AesCryptoConfig;
|
import org.dromara.visor.framework.security.configuration.config.AesCryptoConfig;
|
||||||
import org.dromara.visor.framework.security.core.crypto.PrimaryValueCrypto;
|
import org.dromara.visor.framework.security.core.crypto.PrimaryAesEncryptor;
|
||||||
import org.dromara.visor.framework.security.core.crypto.processor.AesCryptoProcessor;
|
import org.dromara.visor.framework.security.core.crypto.processor.AesCryptoProcessor;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||||
@@ -52,11 +52,11 @@ public class OrionCryptoAutoConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean(name = "valueCrypto")
|
@Bean(name = "valueCrypto")
|
||||||
@Primary
|
@Primary
|
||||||
public ValueCrypto primaryValueCrypto() {
|
public AesEncryptor primaryValueCrypto() {
|
||||||
// 创建加密器
|
// 创建加密器
|
||||||
PrimaryValueCrypto valueCrypto = new PrimaryValueCrypto();
|
PrimaryAesEncryptor valueCrypto = new PrimaryAesEncryptor();
|
||||||
// 设置工具类
|
// 设置工具类
|
||||||
CryptoUtils.setDelegate(valueCrypto);
|
AesEncryptUtils.setDelegate(valueCrypto);
|
||||||
return valueCrypto;
|
return valueCrypto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public class OrionCryptoAutoConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean(initMethod = "init")
|
@Bean(initMethod = "init")
|
||||||
@ConditionalOnProperty(value = "orion.crypto.aes.enabled", havingValue = "true")
|
@ConditionalOnProperty(value = "orion.crypto.aes.enabled", havingValue = "true")
|
||||||
public ValueCrypto aesValueCrypto(AesCryptoConfig config) {
|
public AesEncryptor aesValueCrypto(AesCryptoConfig config) {
|
||||||
return new AesCryptoProcessor(config);
|
return new AesCryptoProcessor(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dromara.visor.framework.security.core.crypto;
|
package org.dromara.visor.framework.security.core.crypto;
|
||||||
|
|
||||||
import org.dromara.visor.common.crypto.ValueCrypto;
|
import org.dromara.visor.common.interfaces.AesEncryptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据加密器
|
* 数据加密器
|
||||||
@@ -31,7 +31,7 @@ import org.dromara.visor.common.crypto.ValueCrypto;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/7/7 22:48
|
* @since 2023/7/7 22:48
|
||||||
*/
|
*/
|
||||||
public abstract class CryptoProcessor<Config extends CryptoConfig> implements ValueCrypto {
|
public abstract class CryptoProcessor<Config extends CryptoConfig> implements AesEncryptor {
|
||||||
|
|
||||||
protected final Config config;
|
protected final Config config;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public abstract class CryptoProcessor<Config extends CryptoConfig> implements Va
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
// 设置为默认加密器
|
// 设置为默认加密器
|
||||||
if (config.isPrimary()) {
|
if (config.isPrimary()) {
|
||||||
PrimaryValueCrypto.setDelegate(this);
|
PrimaryAesEncryptor.setDelegate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.security.core.crypto;
|
package org.dromara.visor.framework.security.core.crypto;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import org.dromara.visor.common.crypto.ValueCrypto;
|
import org.dromara.visor.common.interfaces.AesEncryptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认加密器
|
* 默认加密器
|
||||||
@@ -32,9 +32,9 @@ import org.dromara.visor.common.crypto.ValueCrypto;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/7/21 12:11
|
* @since 2023/7/21 12:11
|
||||||
*/
|
*/
|
||||||
public class PrimaryValueCrypto implements ValueCrypto {
|
public class PrimaryAesEncryptor implements AesEncryptor {
|
||||||
|
|
||||||
private static ValueCrypto delegate;
|
private static AesEncryptor delegate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
@@ -50,12 +50,12 @@ public class PrimaryValueCrypto implements ValueCrypto {
|
|||||||
return delegate.decrypt(text);
|
return delegate.decrypt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void setDelegate(ValueCrypto delegate) {
|
protected static void setDelegate(AesEncryptor delegate) {
|
||||||
if (PrimaryValueCrypto.delegate != null) {
|
if (PrimaryAesEncryptor.delegate != null) {
|
||||||
// unmodified
|
// unmodified
|
||||||
throw Exceptions.state();
|
throw Exceptions.state();
|
||||||
}
|
}
|
||||||
PrimaryValueCrypto.delegate = delegate;
|
PrimaryAesEncryptor.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.storage.configuration;
|
package org.dromara.visor.framework.storage.configuration;
|
||||||
|
|
||||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.framework.storage.configuration.config.LocalStorageConfig;
|
import org.dromara.visor.framework.storage.configuration.config.LocalStorageConfig;
|
||||||
import org.dromara.visor.framework.storage.configuration.config.LogsStorageConfig;
|
import org.dromara.visor.framework.storage.configuration.config.LogsStorageConfig;
|
||||||
import org.dromara.visor.framework.storage.core.client.PrimaryFileClient;
|
import org.dromara.visor.framework.storage.core.client.PrimaryFileClient;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import cn.orionsec.kit.lang.utils.io.Files1;
|
|||||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.storage.core.client;
|
package org.dromara.visor.framework.storage.core.client;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.storage.core.utils;
|
package org.dromara.visor.framework.storage.core.utils;
|
||||||
|
|
||||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
package org.dromara.visor.framework.test.configuration;
|
package org.dromara.visor.framework.test.configuration;
|
||||||
|
|
||||||
import com.github.fppt.jedismock.RedisServer;
|
import com.github.fppt.jedismock.RedisServer;
|
||||||
import org.dromara.visor.common.lock.Locker;
|
import org.dromara.visor.common.interfaces.Locker;
|
||||||
import org.dromara.visor.common.utils.LockerUtils;
|
import org.dromara.visor.common.utils.LockerUtils;
|
||||||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
import org.dromara.visor.common.constant.AutoConfigureOrderConst;
|
||||||
import org.dromara.visor.common.constant.FilterOrderConst;
|
import org.dromara.visor.common.constant.FilterOrderConst;
|
||||||
import org.dromara.visor.common.web.filter.FilterCreator;
|
import org.dromara.visor.common.web.WebFilterCreator;
|
||||||
import org.dromara.visor.framework.web.core.aspect.DemoDisableApiAspect;
|
import org.dromara.visor.framework.web.core.aspect.DemoDisableApiAspect;
|
||||||
import org.dromara.visor.framework.web.core.filter.TraceIdFilter;
|
import org.dromara.visor.framework.web.core.filter.TraceIdFilter;
|
||||||
import org.dromara.visor.framework.web.core.handler.GlobalExceptionHandler;
|
import org.dromara.visor.framework.web.core.handler.GlobalExceptionHandler;
|
||||||
@@ -151,7 +151,7 @@ public class OrionWebAutoConfiguration implements WebMvcConfigurer {
|
|||||||
// 创建 UrlBasedCorsConfigurationSource 对象
|
// 创建 UrlBasedCorsConfigurationSource 对象
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
source.registerCorsConfiguration("/**", config);
|
source.registerCorsConfiguration("/**", config);
|
||||||
return FilterCreator.create(new CorsFilter(source), FilterOrderConst.CORS_FILTER);
|
return WebFilterCreator.create(new CorsFilter(source), FilterOrderConst.CORS_FILTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +159,7 @@ public class OrionWebAutoConfiguration implements WebMvcConfigurer {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public FilterRegistrationBean<TraceIdFilter> traceIdFilterBean() {
|
public FilterRegistrationBean<TraceIdFilter> traceIdFilterBean() {
|
||||||
return FilterCreator.create(new TraceIdFilter(), FilterOrderConst.TRICE_ID_FILTER);
|
return WebFilterCreator.create(new TraceIdFilter(), FilterOrderConst.TRICE_ID_FILTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.dromara.visor.framework.web.core.filter;
|
package org.dromara.visor.framework.web.core.filter;
|
||||||
|
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.common.utils.PathUtils;
|
import org.dromara.visor.common.utils.PathUtils;
|
||||||
import org.dromara.visor.module.asset.dao.ExecHostLogDAO;
|
import org.dromara.visor.module.asset.dao.ExecHostLogDAO;
|
||||||
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
import org.dromara.visor.module.asset.entity.domain.ExecHostLogDO;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.handler.host.exec.log;
|
|||||||
import cn.orionsec.kit.lang.annotation.Keep;
|
import cn.orionsec.kit.lang.annotation.Keep;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
||||||
import org.dromara.visor.module.asset.define.AssetThreadPools;
|
import org.dromara.visor.module.asset.define.AssetThreadPools;
|
||||||
import org.dromara.visor.module.asset.entity.dto.ExecHostLogTailDTO;
|
import org.dromara.visor.module.asset.entity.dto.ExecHostLogTailDTO;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import cn.orionsec.kit.net.host.SessionStore;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.AppConst;
|
import org.dromara.visor.common.constant.AppConst;
|
||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
|
import org.dromara.visor.module.asset.entity.dto.TerminalConnectDTO;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -94,13 +94,13 @@ public class SessionStores {
|
|||||||
if (useKey) {
|
if (useKey) {
|
||||||
// 加载密钥
|
// 加载密钥
|
||||||
String publicKey = Optional.ofNullable(conn.getPublicKey())
|
String publicKey = Optional.ofNullable(conn.getPublicKey())
|
||||||
.map(CryptoUtils::decryptAsString)
|
.map(AesEncryptUtils::decryptAsString)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
String privateKey = Optional.ofNullable(conn.getPrivateKey())
|
String privateKey = Optional.ofNullable(conn.getPrivateKey())
|
||||||
.map(CryptoUtils::decryptAsString)
|
.map(AesEncryptUtils::decryptAsString)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
String password = Optional.ofNullable(conn.getPrivateKeyPassword())
|
String password = Optional.ofNullable(conn.getPrivateKeyPassword())
|
||||||
.map(CryptoUtils::decryptAsString)
|
.map(AesEncryptUtils::decryptAsString)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
sessionHolder.addIdentityValue(String.valueOf(conn.getKeyId()),
|
sessionHolder.addIdentityValue(String.valueOf(conn.getKeyId()),
|
||||||
privateKey,
|
privateKey,
|
||||||
@@ -113,7 +113,7 @@ public class SessionStores {
|
|||||||
if (!useKey) {
|
if (!useKey) {
|
||||||
String password = conn.getPassword();
|
String password = conn.getPassword();
|
||||||
if (!Strings.isEmpty(password)) {
|
if (!Strings.isEmpty(password)) {
|
||||||
session.password(CryptoUtils.decryptAsString(password));
|
session.password(AesEncryptUtils.decryptAsString(password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 超时时间
|
// 超时时间
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import org.dromara.visor.common.constant.Const;
|
|||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.enums.EndpointDefine;
|
import org.dromara.visor.common.enums.EndpointDefine;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.common.utils.PathUtils;
|
import org.dromara.visor.common.utils.PathUtils;
|
||||||
import org.dromara.visor.module.asset.dao.UploadTaskFileDAO;
|
import org.dromara.visor.module.asset.dao.UploadTaskFileDAO;
|
||||||
import org.dromara.visor.module.asset.define.config.AppSftpConfig;
|
import org.dromara.visor.module.asset.define.config.AppSftpConfig;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.interceptor;
|
|||||||
import cn.orionsec.kit.lang.utils.Urls;
|
import cn.orionsec.kit.lang.utils.Urls;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.dromara.visor.common.utils.Requests;
|
import org.dromara.visor.common.utils.Requests;
|
||||||
import org.dromara.visor.module.asset.entity.dto.TerminalAccessDTO;
|
import org.dromara.visor.module.asset.entity.dto.TerminalAccessDTO;
|
||||||
import org.dromara.visor.module.asset.service.TerminalService;
|
import org.dromara.visor.module.asset.service.TerminalService;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.asset.interceptor;
|
|||||||
import cn.orionsec.kit.lang.utils.Urls;
|
import cn.orionsec.kit.lang.utils.Urls;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.meta.TraceIdHolder;
|
import org.dromara.visor.common.trace.TraceIdHolder;
|
||||||
import org.dromara.visor.common.utils.Requests;
|
import org.dromara.visor.common.utils.Requests;
|
||||||
import org.dromara.visor.module.asset.entity.dto.TerminalTransferDTO;
|
import org.dromara.visor.module.asset.entity.dto.TerminalTransferDTO;
|
||||||
import org.dromara.visor.module.asset.service.TerminalService;
|
import org.dromara.visor.module.asset.service.TerminalService;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import org.dromara.visor.common.constant.Const;
|
|||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.constant.FileConst;
|
import org.dromara.visor.common.constant.FileConst;
|
||||||
import org.dromara.visor.common.enums.EndpointDefine;
|
import org.dromara.visor.common.enums.EndpointDefine;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.common.security.LoginUser;
|
import org.dromara.visor.common.security.LoginUser;
|
||||||
import org.dromara.visor.common.utils.PathUtils;
|
import org.dromara.visor.common.utils.PathUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import org.dromara.visor.common.constant.Const;
|
|||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.constant.FileConst;
|
import org.dromara.visor.common.constant.FileConst;
|
||||||
import org.dromara.visor.common.enums.EndpointDefine;
|
import org.dromara.visor.common.enums.EndpointDefine;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.common.utils.SqlUtils;
|
import org.dromara.visor.common.utils.SqlUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
|
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
|||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.security.PasswordModifier;
|
import org.dromara.visor.common.security.PasswordModifier;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||||
@@ -104,7 +104,7 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
|||||||
// 加密密码
|
// 加密密码
|
||||||
String password = record.getPassword();
|
String password = record.getPassword();
|
||||||
if (!Strings.isBlank(password)) {
|
if (!Strings.isBlank(password)) {
|
||||||
record.setPassword(CryptoUtils.encryptAsString(password));
|
record.setPassword(AesEncryptUtils.encryptAsString(password));
|
||||||
}
|
}
|
||||||
// 插入
|
// 插入
|
||||||
int effect = hostIdentityDAO.insert(record);
|
int effect = hostIdentityDAO.insert(record);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
|||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.security.PasswordModifier;
|
import org.dromara.visor.common.security.PasswordModifier;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
import org.dromara.visor.framework.redis.core.utils.RedisMaps;
|
||||||
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
|
||||||
@@ -97,7 +97,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
|||||||
this.encryptKey(record);
|
this.encryptKey(record);
|
||||||
String password = record.getPassword();
|
String password = record.getPassword();
|
||||||
if (!Strings.isBlank(password)) {
|
if (!Strings.isBlank(password)) {
|
||||||
record.setPassword(CryptoUtils.encryptAsString(password));
|
record.setPassword(AesEncryptUtils.encryptAsString(password));
|
||||||
}
|
}
|
||||||
// 插入
|
// 插入
|
||||||
int effect = hostKeyDAO.insert(record);
|
int effect = hostKeyDAO.insert(record);
|
||||||
@@ -154,7 +154,7 @@ public class HostKeyServiceImpl implements HostKeyService {
|
|||||||
// 解密密码
|
// 解密密码
|
||||||
String password = record.getPassword();
|
String password = record.getPassword();
|
||||||
if (!Strings.isBlank(password)) {
|
if (!Strings.isBlank(password)) {
|
||||||
record.setPassword(CryptoUtils.decryptAsString(password));
|
record.setPassword(AesEncryptUtils.decryptAsString(password));
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
@@ -278,11 +278,11 @@ public class HostKeyServiceImpl implements HostKeyService {
|
|||||||
private void encryptKey(HostKeyDO record) {
|
private void encryptKey(HostKeyDO record) {
|
||||||
String publicKey = record.getPublicKey();
|
String publicKey = record.getPublicKey();
|
||||||
if (!Strings.isBlank(publicKey)) {
|
if (!Strings.isBlank(publicKey)) {
|
||||||
record.setPublicKey(CryptoUtils.encryptAsString(publicKey));
|
record.setPublicKey(AesEncryptUtils.encryptAsString(publicKey));
|
||||||
}
|
}
|
||||||
String privateKey = record.getPrivateKey();
|
String privateKey = record.getPrivateKey();
|
||||||
if (!Strings.isBlank(privateKey)) {
|
if (!Strings.isBlank(privateKey)) {
|
||||||
record.setPrivateKey(CryptoUtils.encryptAsString(privateKey));
|
record.setPrivateKey(AesEncryptUtils.encryptAsString(privateKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,11 +294,11 @@ public class HostKeyServiceImpl implements HostKeyService {
|
|||||||
private void decryptKey(HostKeyDO record) {
|
private void decryptKey(HostKeyDO record) {
|
||||||
String publicKey = record.getPublicKey();
|
String publicKey = record.getPublicKey();
|
||||||
if (!Strings.isBlank(publicKey)) {
|
if (!Strings.isBlank(publicKey)) {
|
||||||
record.setPublicKey(CryptoUtils.decryptAsString(publicKey));
|
record.setPublicKey(AesEncryptUtils.decryptAsString(publicKey));
|
||||||
}
|
}
|
||||||
String privateKey = record.getPrivateKey();
|
String privateKey = record.getPrivateKey();
|
||||||
if (!Strings.isBlank(privateKey)) {
|
if (!Strings.isBlank(privateKey)) {
|
||||||
record.setPrivateKey(CryptoUtils.decryptAsString(privateKey));
|
record.setPrivateKey(AesEncryptUtils.decryptAsString(privateKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
|||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.constant.ErrorMessage;
|
import org.dromara.visor.common.constant.ErrorMessage;
|
||||||
import org.dromara.visor.common.enums.EndpointDefine;
|
import org.dromara.visor.common.enums.EndpointDefine;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.common.security.LoginUser;
|
import org.dromara.visor.common.security.LoginUser;
|
||||||
import org.dromara.visor.common.utils.SqlUtils;
|
import org.dromara.visor.common.utils.SqlUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import cn.orionsec.kit.lang.utils.io.Streams;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
||||||
import org.dromara.visor.module.infra.entity.dto.FileUploadTokenDTO;
|
import org.dromara.visor.module.infra.entity.dto.FileUploadTokenDTO;
|
||||||
import org.dromara.visor.module.infra.handler.upload.enums.FileUploadOperatorType;
|
import org.dromara.visor.module.infra.handler.upload.enums.FileUploadOperatorType;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package org.dromara.visor.module.infra.handler.upload.handler;
|
|||||||
import cn.orionsec.kit.lang.utils.io.Streams;
|
import cn.orionsec.kit.lang.utils.io.Streams;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.dromara.visor.common.constant.Const;
|
import org.dromara.visor.common.constant.Const;
|
||||||
import org.dromara.visor.common.file.FileClient;
|
import org.dromara.visor.common.interfaces.FileClient;
|
||||||
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
import org.dromara.visor.framework.websocket.core.utils.WebSockets;
|
||||||
import org.dromara.visor.module.infra.handler.upload.enums.FileUploadReceiverType;
|
import org.dromara.visor.module.infra.handler.upload.enums.FileUploadReceiverType;
|
||||||
import org.dromara.visor.module.infra.handler.upload.model.FileUploadResponse;
|
import org.dromara.visor.module.infra.handler.upload.model.FileUploadResponse;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import org.dromara.visor.common.constant.ErrorMessage;
|
|||||||
import org.dromara.visor.common.constant.ExtraFieldConst;
|
import org.dromara.visor.common.constant.ExtraFieldConst;
|
||||||
import org.dromara.visor.common.security.LoginUser;
|
import org.dromara.visor.common.security.LoginUser;
|
||||||
import org.dromara.visor.common.security.UserRole;
|
import org.dromara.visor.common.security.UserRole;
|
||||||
import org.dromara.visor.common.utils.CryptoUtils;
|
import org.dromara.visor.common.utils.AesEncryptUtils;
|
||||||
import org.dromara.visor.common.utils.IpUtils;
|
import org.dromara.visor.common.utils.IpUtils;
|
||||||
import org.dromara.visor.common.utils.Valid;
|
import org.dromara.visor.common.utils.Valid;
|
||||||
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||||
@@ -329,7 +329,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String value = CryptoUtils.decryptBase62(loginToken);
|
String value = AesEncryptUtils.decryptBase62(loginToken);
|
||||||
String[] pair = value.split(":");
|
String[] pair = value.split(":");
|
||||||
return Pair.of(Long.valueOf(pair[0]), Long.valueOf(pair[1]));
|
return Pair.of(Long.valueOf(pair[0]), Long.valueOf(pair[1]));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -426,7 +426,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
|||||||
RedisStrings.setJson(refreshKey, UserCacheKeyDefine.LOGIN_REFRESH, loginValue);
|
RedisStrings.setJson(refreshKey, UserCacheKeyDefine.LOGIN_REFRESH, loginValue);
|
||||||
}
|
}
|
||||||
// 返回token
|
// 返回token
|
||||||
return CryptoUtils.encryptBase62(id + ":" + loginTime);
|
return AesEncryptUtils.encryptBase62(id + ":" + loginTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user