From 515fa1356c43e6f89ed2dab6174eacebcbc7b598 Mon Sep 17 00:00:00 2001 From: Yates <991335@qq.com> Date: Wed, 29 Jun 2022 14:03:35 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BD=91=E5=85=B3=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E4=B8=AD=E7=9A=84=E6=8E=A5=E5=8F=A3=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E4=B8=80=E6=97=A6=E8=A2=AB=E6=90=BA=E5=B8=A6=E6=AD=A3?= =?UTF-8?q?=E7=A1=AEtoken=E8=AE=BF=E9=97=AE=E6=97=B6=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E6=B6=89=E5=8F=8A=E5=A4=84=E7=90=86=E6=9C=89=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=9D=83=E9=99=90=E6=97=B6=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=9B=BA=E6=90=BA=E5=B8=A6token=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E8=B7=B3=E8=BF=87=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=9A=84=E8=B7=AF=E5=BE=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/gateway/filter/AuthFilter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java index 101de638..627ad6bc 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java @@ -45,13 +45,14 @@ public class AuthFilter implements GlobalFilter, Ordered ServerHttpRequest request = exchange.getRequest(); ServerHttpRequest.Builder mutate = request.mutate(); + String token = getToken(request); String url = request.getURI().getPath(); // 跳过不需要验证的路径 - if (StringUtils.matches(url, ignoreWhite.getWhites())) + if (StringUtils.matches(url, ignoreWhite.getWhites()) && StringUtils.isEmpty(token)) { return chain.filter(exchange); } - String token = getToken(request); + if (StringUtils.isEmpty(token)) { return unauthorizedResponse(exchange, "令牌不能为空");