From 9cd111ca58a69e57f2fb709a8899bec6ee92ddde Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Sun, 20 Sep 2020 18:28:06 +0800 Subject: [PATCH] =?UTF-8?q?fegin=20token=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/config/FeignConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jeecg-boot/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java b/jeecg-boot/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java index dddf9f4f..63207d0d 100644 --- a/jeecg-boot/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java +++ b/jeecg-boot/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java @@ -36,7 +36,12 @@ public class FeignConfig { HttpServletRequest request = attributes.getRequest(); log.info("Feign request: {}", request.getRequestURI()); // 将token信息放入header中 - requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, request.getHeader(CommonConstant.X_ACCESS_TOKEN)); + String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN); + if(token==null){ + token = request.getParameter("token"); + } + log.info("Feign request token: {}", token); + requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token); } }; } -- GitLab