From c9e89ee9461ff4a1cb39ec5b59fdc131440f92c4 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 15 Jun 2021 12:49:32 +0800 Subject: [PATCH] circle --- .../interceptor/AuthorizationInterceptor.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mallinkPublicApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java b/mallinkPublicApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java index d2869ca4c..aceb86e20 100644 --- a/mallinkPublicApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java +++ b/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(),"缺少加密串"); } - String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); if(StringUtils.isBlank(body)){ 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(),"请求过期"); } - logger.info("sign={}"+signature); - for (String key:notKeys) { if(parameterMap.containsKey(key)){ parameterMap.remove(key); } } - logger.info("parameterMap={}"+parameterMap.toString()); String newSignature = SignUtils.getSign(apiConfig.getSignKey(), parameterMap, "MD5"); + logger.info("newSignature={}"+newSignature); //加密串不匹配 if (!signature.equals(newSignature)) { throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"加密串校验失败"); } Integer cache = RedisCacheUtils.getCacheInteger(redisTemplate, Constant.publicApiNonce+signature); - logger.info("cache={}"+cache.toString()); + if (null != cache) { throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"重复调用"); } RedisCacheUtils.cache(redisTemplate, Constant.publicApiNonce+signature, 1, 300); return true; - }catch(Exception e){ + }catch(MallinkException e){ + throw e; + } + catch(Exception e){ throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确"); }