Commit 56051fe7 authored by huangxi's avatar huangxi

AbstractSignatureValidationInterceptor expireTime

parent 8800476f
...@@ -31,15 +31,15 @@ public abstract class AbstractSignatureValidationInterceptor<T extends Signature ...@@ -31,15 +31,15 @@ public abstract class AbstractSignatureValidationInterceptor<T extends Signature
String appKey = wrappedRequest.getHeader(SCH_APP_KEY); String appKey = wrappedRequest.getHeader(SCH_APP_KEY);
String timestamp = wrappedRequest.getHeader(SCH_TIMESTAMP); String timestamp = wrappedRequest.getHeader(SCH_TIMESTAMP);
String signature = wrappedRequest.getHeader(SCH_SIGNATURE); String signature = wrappedRequest.getHeader(SCH_SIGNATURE);
String expireTime = wrappedRequest.getHeader(SCH_EXPIRE_TIME);
// 空校验 // 空校验
if (StringUtils.isAnyBlank(appKey, timestamp, signature)) { if (StringUtils.isAnyBlank(appKey, timestamp, signature, expireTime)) {
throw new SignatureValidationException("签名参数为空!"); throw new SignatureValidationException("签名参数为空!");
} }
// 过期校验 // 过期校验
String expireTime = wrappedRequest.getHeader(SCH_EXPIRE_TIME); if (System.currentTimeMillis() > Long.parseLong(expireTime)) {
if (StringUtils.isNotBlank(expireTime) && System.currentTimeMillis() > Long.parseLong(expireTime)) {
throw new SignatureValidationException("请求信息已过期!"); throw new SignatureValidationException("请求信息已过期!");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment