Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
estateplat-encrypt
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
狄熙卜
estateplat-encrypt
Commits
51e40f24
提交
51e40f24
authored
11月 28, 2023
作者:
狄熙卜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加方法,支持reload配置文件
上级
6769309d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
84 行增加
和
2 行删除
+84
-2
DbEncryptXmlConfig.java
.../java/cn/gtmap/bdcdj/core/encrypt/DbEncryptXmlConfig.java
+74
-1
EncryptInterceptor.java
.../java/cn/gtmap/bdcdj/core/encrypt/EncryptInterceptor.java
+10
-1
没有找到文件。
src/main/java/cn/gtmap/bdcdj/core/encrypt/DbEncryptXmlConfig.java
浏览文件 @
51e40f24
...
@@ -49,6 +49,63 @@ public class DbEncryptXmlConfig {
...
@@ -49,6 +49,63 @@ public class DbEncryptXmlConfig {
private
String
interfaceSm2DecodeKey
;
//接口加解密时,sm2解密的私钥
private
String
interfaceSm2DecodeKey
;
//接口加解密时,sm2解密的私钥
private
String
interfaceSm2EncodeKey
;
//接口加解密时,sm2加密的公钥
private
String
interfaceSm2EncodeKey
;
//接口加解密时,sm2加密的公钥
private
List
<
String
>
baseConfigOptions
;
private
List
<
String
>
baseConfigOptions
;
public
void
setBaseConfig
(
List
<
BaseConfig
>
baseConfig
)
{
this
.
baseConfig
=
baseConfig
;
}
public
void
setGlobalEnableFields
(
List
<
String
>
globalEnableFields
)
{
this
.
globalEnableFields
=
globalEnableFields
;
}
public
void
setGlobalDisableEntityFields
(
List
<
Map
>
globalDisableEntityFields
)
{
this
.
globalDisableEntityFields
=
globalDisableEntityFields
;
}
public
void
setGlobalDisableMapFields
(
List
<
Map
>
globalDisableMapFields
)
{
this
.
globalDisableMapFields
=
globalDisableMapFields
;
}
public
void
setSqlFileds
(
List
<
Map
>
sqlFileds
)
{
this
.
sqlFileds
=
sqlFileds
;
}
public
void
setSqlEncryptFileds
(
List
<
Map
>
sqlEncryptFileds
)
{
this
.
sqlEncryptFileds
=
sqlEncryptFileds
;
}
public
void
setSqlDecryptFileds
(
List
<
Map
>
sqlDecryptFileds
)
{
this
.
sqlDecryptFileds
=
sqlDecryptFileds
;
}
public
void
setEntityFileds
(
List
<
Map
>
entityFileds
)
{
this
.
entityFileds
=
entityFileds
;
}
public
void
setSqlSingleEncryptFileds
(
List
<
String
>
sqlSingleEncryptFileds
)
{
this
.
sqlSingleEncryptFileds
=
sqlSingleEncryptFileds
;
}
public
void
setSqlSingleDecryptFileds
(
List
<
String
>
sqlSingleDecryptFileds
)
{
this
.
sqlSingleDecryptFileds
=
sqlSingleDecryptFileds
;
}
public
void
setInterfaceEncryptList
(
List
<
String
>
interfaceEncryptList
)
{
this
.
interfaceEncryptList
=
interfaceEncryptList
;
}
public
void
setInterfaceSm2DecodeKey
(
String
interfaceSm2DecodeKey
)
{
this
.
interfaceSm2DecodeKey
=
interfaceSm2DecodeKey
;
}
public
void
setInterfaceSm2EncodeKey
(
String
interfaceSm2EncodeKey
)
{
this
.
interfaceSm2EncodeKey
=
interfaceSm2EncodeKey
;
}
public
void
setBaseConfigOptions
(
List
<
String
>
baseConfigOptions
)
{
this
.
baseConfigOptions
=
baseConfigOptions
;
}
public
List
<
String
>
getBaseConfigOptions
()
{
public
List
<
String
>
getBaseConfigOptions
()
{
if
(
CollectionUtils
.
isNotEmpty
(
this
.
baseConfigOptions
)){
if
(
CollectionUtils
.
isNotEmpty
(
this
.
baseConfigOptions
)){
return
this
.
baseConfigOptions
;
return
this
.
baseConfigOptions
;
...
@@ -57,6 +114,22 @@ public class DbEncryptXmlConfig {
...
@@ -57,6 +114,22 @@ public class DbEncryptXmlConfig {
return
this
.
baseConfigOptions
;
return
this
.
baseConfigOptions
;
}
}
}
}
public
void
cleanConfig
(){
setGlobalEnableFields
(
null
);
setGlobalDisableEntityFields
(
null
);
setGlobalDisableMapFields
(
null
);
setSqlFileds
(
null
);
setSqlEncryptFileds
(
null
);
setSqlDecryptFileds
(
null
);
setEntityFileds
(
null
);
setSqlSingleEncryptFileds
(
null
);
setSqlSingleDecryptFileds
(
null
);
setInterfaceEncryptList
(
null
);
setInterfaceSm2DecodeKey
(
null
);
setInterfaceSm2EncodeKey
(
null
);
setBaseConfigOptions
(
null
);
}
public
String
getInterfaceSm2DecodeKey
(){
public
String
getInterfaceSm2DecodeKey
(){
if
(!
StringUtils
.
isBlank
(
this
.
interfaceSm2DecodeKey
)){
if
(!
StringUtils
.
isBlank
(
this
.
interfaceSm2DecodeKey
)){
return
this
.
interfaceSm2DecodeKey
;
return
this
.
interfaceSm2DecodeKey
;
...
@@ -344,7 +417,7 @@ public class DbEncryptXmlConfig {
...
@@ -344,7 +417,7 @@ public class DbEncryptXmlConfig {
/**
/**
* 从java文件中读取预置的加解密字段
* 从java文件中读取预置的加解密字段
*/
*/
public
void
set
BaseConfigFileds
()
{
public
void
add
BaseConfigFileds
()
{
List
<
String
>
baseConfigOptions
=
this
.
getBaseConfigOptions
();
List
<
String
>
baseConfigOptions
=
this
.
getBaseConfigOptions
();
if
(
CollectionUtils
.
isNotEmpty
(
baseConfig
)){
if
(
CollectionUtils
.
isNotEmpty
(
baseConfig
)){
for
(
BaseConfig
config
:
baseConfig
)
{
for
(
BaseConfig
config
:
baseConfig
)
{
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/EncryptInterceptor.java
浏览文件 @
51e40f24
...
@@ -33,6 +33,15 @@ public class EncryptInterceptor implements Interceptor {
...
@@ -33,6 +33,15 @@ public class EncryptInterceptor implements Interceptor {
@Resource
(
name
=
"dbEncryptXmlConfig"
)
@Resource
(
name
=
"dbEncryptXmlConfig"
)
private
DbEncryptXmlConfig
dbEncryptXmlConfig
;
private
DbEncryptXmlConfig
dbEncryptXmlConfig
;
public
static
final
ConcurrentHashMap
<
String
,
CryptAdapterMatadata
>
METHOD_ENCRYPT_MAP
=
new
ConcurrentHashMap
();
public
static
final
ConcurrentHashMap
<
String
,
CryptAdapterMatadata
>
METHOD_ENCRYPT_MAP
=
new
ConcurrentHashMap
();
public
CryptProperties
getCryptProperties
()
{
return
cryptProperties
;
}
public
void
setCryptProperties
(
CryptProperties
cryptProperties
)
{
this
.
cryptProperties
=
cryptProperties
;
}
@Override
@Override
public
Object
intercept
(
Invocation
invocation
)
throws
Throwable
{
public
Object
intercept
(
Invocation
invocation
)
throws
Throwable
{
if
(
this
.
cryptEnable
)
{
if
(
this
.
cryptEnable
)
{
...
@@ -117,7 +126,7 @@ public class EncryptInterceptor implements Interceptor {
...
@@ -117,7 +126,7 @@ public class EncryptInterceptor implements Interceptor {
dbEncryptXmlConfig
.
getSqlSingleEncryptFileds
();
dbEncryptXmlConfig
.
getSqlSingleEncryptFileds
();
dbEncryptXmlConfig
.
getSqlSingleDecryptFileds
();
dbEncryptXmlConfig
.
getSqlSingleDecryptFileds
();
//添加预置的字段
//添加预置的字段
dbEncryptXmlConfig
.
set
BaseConfigFileds
();
dbEncryptXmlConfig
.
add
BaseConfigFileds
();
this
.
cryptProperties
.
setGlobalEnableFields
(
dbEncryptXmlConfig
.
getGlobalEnableFields
());
this
.
cryptProperties
.
setGlobalEnableFields
(
dbEncryptXmlConfig
.
getGlobalEnableFields
());
this
.
cryptProperties
.
setGlobalDisableMapFields
(
dbEncryptXmlConfig
.
getGlobalDisableMapFields
());
this
.
cryptProperties
.
setGlobalDisableMapFields
(
dbEncryptXmlConfig
.
getGlobalDisableMapFields
());
this
.
cryptProperties
.
setGlobalDisableEntityFields
(
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
());
this
.
cryptProperties
.
setGlobalDisableEntityFields
(
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论