Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
82f64b92
提交
82f64b92
编写于
3月 11, 2020
作者:
Chongwen.jiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
加解密接口提供方便测试,仅dev、test1环境可以正常使用
上级
6008524c
流水线
#22654
已失败 于阶段
in 0 second
变更
2
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
10 行删除
+31
-10
PropertiesConfiguration.java
...account/server/configuration/PropertiesConfiguration.java
+7
-0
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+24
-10
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/configuration/PropertiesConfiguration.java
浏览文件 @
82f64b92
...
@@ -13,6 +13,9 @@ public class PropertiesConfiguration {
...
@@ -13,6 +13,9 @@ public class PropertiesConfiguration {
@Value
(
"${pica.cloud.message.url}"
)
@Value
(
"${pica.cloud.message.url}"
)
private
String
messageUrl
;
private
String
messageUrl
;
@Value
(
"${environment.name}"
)
private
String
environment
;
public
String
getMessageUrl
()
{
public
String
getMessageUrl
()
{
return
messageUrl
;
return
messageUrl
;
...
@@ -22,4 +25,8 @@ public class PropertiesConfiguration {
...
@@ -22,4 +25,8 @@ public class PropertiesConfiguration {
this
.
messageUrl
=
messageUrl
;
this
.
messageUrl
=
messageUrl
;
}
}
public
String
getEnvironment
(){
return
environment
;
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
82f64b92
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.pica.cloud.account.account.server.configuration.PropertiesConfiguration
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.constants.Constants
;
import
com.pica.cloud.account.account.server.entity.AccountUnionEntity
;
import
com.pica.cloud.account.account.server.entity.AccountUnionEntity
;
import
com.pica.cloud.account.account.server.entity.EncryptEntity
;
import
com.pica.cloud.account.account.server.entity.EncryptEntity
;
...
@@ -55,27 +56,40 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -55,27 +56,40 @@ public class AutoCodeController extends AccountBaseController {
@Autowired
@Autowired
private
AuthCodeService
authCodeService
;
private
AuthCodeService
authCodeService
;
@Autowired
private
PropertiesConfiguration
propertiesConfiguration
;
@GetMapping
(
"/ip"
)
@GetMapping
(
"/ip"
)
public
PicaResponse
getIp
(
HttpServletRequest
request
){
public
PicaResponse
getIp
(
HttpServletRequest
request
)
{
return
PicaResponse
.
toResponse
(
IPUtil
.
getIpAdrress
(
request
));
return
PicaResponse
.
toResponse
(
IPUtil
.
getIpAdrress
(
request
));
}
}
@ApiOperation
(
"数据加密-方便测试"
)
@PostMapping
(
"/encryptedParams"
)
@PostMapping
(
"/encryptedParams"
)
public
String
getEncryptedParams
(
@RequestBody
BaseRequest
request
)
throws
Exception
{
public
String
getEncryptedParams
(
@RequestBody
BaseRequest
request
)
throws
Exception
{
String
publicKey
=
"1234567890123456"
;
if
(
"dev"
.
equals
(
propertiesConfiguration
.
getEnvironment
())
||
String
content
=
AESUtil
.
aesEncrypt
(
JSON
.
toJSONString
(
request
),
publicKey
);
"test1"
.
equals
(
propertiesConfiguration
.
getEnvironment
()))
{
String
encryptKey
=
RSAUtil
.
encrypt
(
publicKey
);
String
publicKey
=
"1234567890123456"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
String
content
=
AESUtil
.
aesEncrypt
(
JSON
.
toJSONString
(
request
),
publicKey
);
map
.
put
(
"key"
,
encryptKey
);
String
encryptKey
=
RSAUtil
.
encrypt
(
publicKey
);
map
.
put
(
"content"
,
content
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
return
JSON
.
toJSONString
(
map
);
map
.
put
(
"key"
,
encryptKey
);
map
.
put
(
"content"
,
content
);
return
JSON
.
toJSONString
(
map
);
}
return
null
;
}
}
@ApiOperation
(
"数据解密-方便测试"
)
@PostMapping
(
"/decryptedParams"
)
@PostMapping
(
"/decryptedParams"
)
public
String
getDecryptedParams
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
public
String
getDecryptedParams
(
@RequestBody
EncryptEntity
entity
)
throws
Exception
{
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
if
(
"dev"
.
equals
(
propertiesConfiguration
.
getEnvironment
())
||
return
JSON
.
toJSONString
(
request
);
"test1"
.
equals
(
propertiesConfiguration
.
getEnvironment
()))
{
BaseRequest
request
=
CryptoUtil
.
decrypt
(
entity
,
BaseRequest
.
class
);
return
JSON
.
toJSONString
(
request
);
}
return
null
;
}
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录