记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
10f97724
Commit
10f97724
authored
Jul 09, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
快递 test
parent
2e700756
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
ShunfengSignUtils.java
...m/liquidnet/service/platform/utils/ShunfengSignUtils.java
+13
-6
No files found.
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/utils/ShunfengSignUtils.java
View file @
10f97724
...
...
@@ -59,38 +59,45 @@ public class ShunfengSignUtils {
* @return
*/
public
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
log
.
error
(
"params {}"
,
params
);
log
.
debug
(
"params {}"
,
params
);
log
.
info
(
"params {}"
,
params
);
// 请求方APPID
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
log
.
error
(
"sendAppId {}"
,
sendAppId
);
// 请求方时间戳
String
timestamp
=
request
.
getHeader
(
"timestamp"
);
log
.
error
(
"timestamp {}"
,
timestamp
);
// 请求方签名
String
sign
=
request
.
getHeader
(
"sign"
);
log
.
error
(
"sign {}"
,
sign
);
if
(
StringUtils
.
isBlank
(
sendAppId
))
{
System
.
out
.
println
(
"参数sendAppId不能为空"
);
log
.
error
(
"参数sendAppId不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
timestamp
))
{
log
.
error
(
"参数timestamp不能为空 {}"
,
""
);
System
.
out
.
println
(
"参数timestamp不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
sign
))
{
System
.
out
.
println
(
"参数sign不能为空"
);
log
.
error
(
"参数sign不能为空"
);
return
false
;
}
// 校验签名是否过期
long
requestTime
=
Long
.
parseLong
(
timestamp
);
long
now
=
System
.
currentTimeMillis
();
if
(
Math
.
abs
(
now
-
requestTime
)
>
CHECK_TIME
)
{
System
.
out
.
println
(
"签名过期!
"
);
log
.
error
(
"签名过期
"
);
return
false
;
}
// 请求方参数+请求方时间戳+SK 生成签名
String
thisSign
=
genSign
(
timestamp
,
params
);
System
.
out
.
println
(
params
);
System
.
out
.
println
(
thisSign
);
log
.
error
(
"thisSign {}"
,
thisSign
);
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
log
.
error
(
"签名错误"
);
return
false
;
}
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment