소스 검색

circle

release_toaliyun_real
xhxu 5 년 전
부모
커밋
c9e89ee946
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. +6
    -6
      mallinkPublicApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java

+ 6
- 6
mallinkPublicApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java 파일 보기

@@ -67,7 +67,6 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少加密串"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少加密串");
} }



String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); String body = ((BodyReaderHttpServletRequestWrapper) request).getBody();
if(StringUtils.isBlank(body)){ if(StringUtils.isBlank(body)){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少参数"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少参数");
@@ -87,29 +86,30 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请求过期"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请求过期");
} }


logger.info("sign={}"+signature);

for (String key:notKeys) { for (String key:notKeys) {
if(parameterMap.containsKey(key)){ if(parameterMap.containsKey(key)){
parameterMap.remove(key); parameterMap.remove(key);
} }
} }
logger.info("parameterMap={}"+parameterMap.toString());


String newSignature = SignUtils.getSign(apiConfig.getSignKey(), parameterMap, "MD5"); String newSignature = SignUtils.getSign(apiConfig.getSignKey(), parameterMap, "MD5");
logger.info("newSignature={}"+newSignature);
//加密串不匹配 //加密串不匹配
if (!signature.equals(newSignature)) { if (!signature.equals(newSignature)) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"加密串校验失败"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"加密串校验失败");
} }
Integer cache = RedisCacheUtils.getCacheInteger(redisTemplate, Constant.publicApiNonce+signature); Integer cache = RedisCacheUtils.getCacheInteger(redisTemplate, Constant.publicApiNonce+signature);
logger.info("cache={}"+cache.toString());
if (null != cache) { if (null != cache) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"重复调用"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"重复调用");
} }
RedisCacheUtils.cache(redisTemplate, Constant.publicApiNonce+signature, 1, 300); RedisCacheUtils.cache(redisTemplate, Constant.publicApiNonce+signature, 1, 300);
return true; return true;


}catch(Exception e){
}catch(MallinkException e){
throw e;
}
catch(Exception e){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确"); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确");
} }




불러오는 중...
취소
저장