weijianghai 1 год назад
Родитель
Сommit
9a0aa01bae

+ 5 - 4
src/main/java/com/nokia/financeapi/config/web/RequestLogHandlerInterceptor.java

@@ -16,7 +16,9 @@ import org.springframework.web.servlet.HandlerInterceptor;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.net.URLDecoder;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -73,11 +75,10 @@ public class RequestLogHandlerInterceptor implements HandlerInterceptor {
         if (!StringUtils.hasText(token)) {
             return forbidden(response);
         }
-        if ("test_hebei".equals(token)) {
-            return true;
-        }
         try {
-            String decodeToken = AESUtil.decrypt(token);
+            String urlDecodeToken = URLDecoder.decode(token, StandardCharsets.UTF_8);
+            log.info("urlDecodeToken: {}", urlDecodeToken);
+            String decodeToken = AESUtil.decrypt(urlDecodeToken);
             log.info("decodeToken: {}", decodeToken);
             Gson gson = new Gson();
             Map<String, String> map = gson.fromJson(decodeToken, new TypeToken<Map<String, String>>() {

+ 2 - 2
src/main/java/com/nokia/financeapi/utils/AESUtil.java

@@ -78,9 +78,9 @@ public class AESUtil {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         map.put("TIME_STAMP", sdf.format(new Date()));
         // 当前登录账号
-        map.put("LOGIN_ID", "loginId");
+        map.put("LOGIN_ID", "test");
         //请求的地址
-        map.put("REQUEST_URL","https://ip:port/aaa");
+        map.put("REQUEST_URL","");
 
         // 加密串
         String encrypt = AESUtil.encrypt(new Gson().toJson(map), "2na$$PdV9AW8b#CS");