Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
6ff1a3a5
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6ff1a3a5
编写于
9月 17, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix datasource password
上级
f3862efc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
16 deletion
+36
-16
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java
...va/com/x/base/core/project/config/ExternalDataSource.java
+8
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalStorageSource.java
...com/x/base/core/project/config/ExternalStorageSource.java
+9
-1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Token.java
...t/src/main/java/com/x/base/core/project/config/Token.java
+2
-2
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/Crypto.java
...t/src/main/java/com/x/base/core/project/tools/Crypto.java
+17
-12
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalDataSource.java
浏览文件 @
6ff1a3a5
...
...
@@ -9,9 +9,13 @@ import org.apache.commons.lang3.StringUtils;
import
com.x.base.core.container.LogLevel
;
import
com.x.base.core.container.factory.SlicePropertiesBuilder
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.tools.Crypto
;
public
class
ExternalDataSource
extends
ConfigObject
{
// 无需保存
private
transient
String
_password
;
public
ExternalDataSource
()
{
this
.
enable
=
false
;
this
.
url
=
""
;
...
...
@@ -136,7 +140,10 @@ public class ExternalDataSource extends ConfigObject {
}
public
String
getPassword
()
{
return
password
;
if
(
StringUtils
.
isEmpty
(
this
.
_password
))
{
this
.
_password
=
Crypto
.
plainText
(
this
.
password
);
}
return
this
.
_password
;
}
public
void
setPassword
(
String
password
)
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ExternalStorageSource.java
浏览文件 @
6ff1a3a5
package
com.x.base.core.project.config
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.entity.StorageProtocol
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.tools.Crypto
;
public
class
ExternalStorageSource
extends
ConfigObject
{
// 无需保存
private
transient
String
_password
;
public
ExternalStorageSource
()
{
this
.
protocol
=
default_protocol
;
this
.
username
=
default_username
;
...
...
@@ -66,7 +71,10 @@ public class ExternalStorageSource extends ConfigObject {
}
public
String
getPassword
()
{
return
password
;
if
(
StringUtils
.
isEmpty
(
this
.
_password
))
{
this
.
_password
=
Crypto
.
plainText
(
this
.
password
);
}
return
this
.
_password
;
}
public
String
getHost
()
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Token.java
浏览文件 @
6ff1a3a5
...
...
@@ -95,7 +95,7 @@ public class Token extends ConfigObject {
}
}
public
String
getCipher
()
throws
Exception
{
public
String
getCipher
()
{
if
(
StringUtils
.
isEmpty
(
this
.
_cipher
))
{
this
.
_cipher
=
DigestUtils
.
md5Hex
(
this
.
getPassword
());
}
...
...
@@ -103,7 +103,7 @@ public class Token extends ConfigObject {
// return this.getPassword() + surfix;
}
public
String
getPassword
()
throws
Exception
{
public
String
getPassword
()
{
if
(
StringUtils
.
isEmpty
(
this
.
_password
))
{
this
.
_password
=
StringUtils
.
isEmpty
(
this
.
password
)
?
initPassword
:
Crypto
.
plainText
(
this
.
password
);
}
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/Crypto.java
浏览文件 @
6ff1a3a5
...
...
@@ -126,24 +126,29 @@ public class Crypto {
public
static
final
String
TEST_PUBLIC_KEY
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWcVZIS57VeOUzi8c01WKvwJK9uRe6hrGTUYmF6J/pI6/UvCbdBWCoErbzsBZOElOH8Sqal3vsNMVLjPYClfoDyYDaUlakP3ldfnXJzAFJVVubF53KadG+fwnh9ZMvxdh7VXVqRL3IQBDwGgzX4rmSK+qkUJjc3OkrNJPB7LLD8QIDAQAB"
;
public
static
final
String
TEST_PRIVATE_KEY
=
"MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJZxVkhLntV45TOLxzTVYq/Akr25F7qGsZNRiYXon+kjr9S8Jt0FYKgStvOwFk4SU4fxKpqXe+w0xUuM9gKV+gPJgNpSVqQ/eV1+dcnMAUlVW5sXncpp0b5/CeH1ky/F2HtVdWpEvchAEPAaDNfiuZIr6qRQmNzc6Ss0k8HsssPxAgMBAAECgYAWtRy05NUgm5Lc6Og0jVDL/mEnydxPBy2ectwzHh2k7wIHNi8XhUxFki2TMqzrM9Dv3/LySpMl4AE3mhs34LNPy6F+MwyF5X7j+2Y6MflJyeb9HNyT++viysQneoOEiOk3ghxF2/GPjpiEF79wSp+1YKTxRAyq7ypV3t35fGOOEQJBANLDPWl8b5c3lrcz/dTamMjHbVamEyX43yzQOphzkhYsz4pruATzTxU+z8/zPdEqHcWWV39CP3xu3EYNcAhxJW8CQQC2u7PF5Xb1xYRCsmIPssFxil64vvdUadSxl7GLAgjQ9ULyYWB24KObCEzLnPcT8Pf2Q0YQOixxa/78FuzmgbyfAkA7ZFFV/H7lugB6t+f7p24OhkRFep9CwBMD6dnZRBgSr6X8d8ZvfrD2Z7DgBMeSva+OEoOtlNmXExZ3lynO9zN5AkAVczEmIMp3DSl6XtAuAZC9kD2QODJ2QToLYsAfjiyUwsWKCC43piTuVOoW2KUUPSwOR1VZIEsJQWEcHGDQqhgHAkAeZ7a6dVRZFdBwKA0ADjYCufAW2cIYiVDQBJpgB+kiLQflusNOCBK0FT3lg8BdUSy2D253Ih6l3lbaM/4M7DFQ"
;
public
static
String
plainText
(
String
text
)
throws
Exception
{
public
static
String
plainText
(
String
text
)
{
if
(
StringUtils
.
isEmpty
(
text
))
{
return
text
;
}
Matcher
matcher
=
StringTools
.
SCRIPTTEXT_REGEX
.
matcher
(
text
);
if
(
matcher
.
matches
())
{
String
value
=
StringEscapeUtils
.
unescapeJson
(
matcher
.
group
(
1
));
if
(
StringUtils
.
startsWithIgnoreCase
(
value
,
"ENCRYPT:"
))
{
String
de
=
StringUtils
.
substringAfter
(
value
,
":"
);
return
decrypt
(
de
,
NEVERCHANGEKEY
);
try
{
Matcher
matcher
=
StringTools
.
SCRIPTTEXT_REGEX
.
matcher
(
text
);
if
(
matcher
.
matches
())
{
String
value
=
StringEscapeUtils
.
unescapeJson
(
matcher
.
group
(
1
));
if
(
StringUtils
.
startsWithIgnoreCase
(
value
,
"ENCRYPT:"
))
{
String
de
=
StringUtils
.
substringAfter
(
value
,
":"
);
return
decrypt
(
de
,
NEVERCHANGEKEY
);
}
else
{
String
eval
=
ScriptFactory
.
functionalization
(
StringEscapeUtils
.
unescapeJson
(
value
));
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
return
Objects
.
toString
(
ScriptFactory
.
scriptEngine
.
eval
(
eval
,
scriptContext
));
}
}
else
{
String
eval
=
ScriptFactory
.
functionalization
(
StringEscapeUtils
.
unescapeJson
(
value
));
ScriptContext
scriptContext
=
new
SimpleScriptContext
();
return
Objects
.
toString
(
ScriptFactory
.
scriptEngine
.
eval
(
eval
,
scriptContext
));
return
text
;
}
}
else
{
return
text
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
()
;
}
return
null
;
}
public
static
String
defaultEncrypt
(
String
data
)
throws
Exception
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录