|
@@ -38,7 +38,7 @@ public class ApiSignInterceptor implements HandlerInterceptor {
|
|
}
|
|
}
|
|
if (!this.property.getEnableSign()) {
|
|
if (!this.property.getEnableSign()) {
|
|
if (logger.isDebugEnabled()) {
|
|
if (logger.isDebugEnabled()) {
|
|
- logger.debug("所有接口不需要签名验证!");
|
|
|
|
|
|
+ logger.debug("接口不需要签名验证!");
|
|
}
|
|
}
|
|
return HandlerInterceptor.super.preHandle(request, response, handler);
|
|
return HandlerInterceptor.super.preHandle(request, response, handler);
|
|
}
|
|
}
|
|
@@ -53,7 +53,8 @@ public class ApiSignInterceptor implements HandlerInterceptor {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
String appKey = request.getParameter("appKey");
|
|
String appKey = request.getParameter("appKey");
|
|
- AnalysisProperty.AppSign appSign = this.property.getAppSigns().stream().filter(e -> appKey.equals(e.getAppKey())).findFirst().orElse(null);
|
|
|
|
|
|
+ AnalysisProperty.AppSign appSign = this.property.getAppSigns().stream()
|
|
|
|
+ .filter(e -> appKey.equals(e.getAppKey())).findFirst().orElse(null);
|
|
if (appSign == null) {
|
|
if (appSign == null) {
|
|
this.writeFailJson(response, "appKey非法");
|
|
this.writeFailJson(response, "appKey非法");
|
|
return false;
|
|
return false;
|
|
@@ -68,7 +69,8 @@ public class ApiSignInterceptor implements HandlerInterceptor {
|
|
}
|
|
}
|
|
String appSecret = appSign.getAppSecret();
|
|
String appSecret = appSign.getAppSecret();
|
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
|
Map<String, String[]> parameterMap = request.getParameterMap();
|
|
- String paramsSign = SignUtil.signParamsMd5(parameterMap, appSecret, timestamp);
|
|
|
|
|
|
+ parameterMap.entrySet().removeIf(next -> "appKey".equalsIgnoreCase(next.getKey()));
|
|
|
|
+ String paramsSign = SignUtil.signParamsMd5(parameterMap, appSecret);
|
|
if (!sign.equalsIgnoreCase(paramsSign)) {
|
|
if (!sign.equalsIgnoreCase(paramsSign)) {
|
|
this.writeFailJson(response, "签名验证失败");
|
|
this.writeFailJson(response, "签名验证失败");
|
|
return false;
|
|
return false;
|