From 2a5a73658de2163815121610a643d5a1f6b7221f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 5 Dec 2022 15:17:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=86=85=E7=BD=91?= =?UTF-8?q?=E9=89=B4=E6=9D=83Filter=20=E4=BC=98=E5=85=88=E7=BA=A7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E5=AF=BC=E8=87=B4websocket=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/gateway/filter/ForwardAuthFilter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ForwardAuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ForwardAuthFilter.java index 738d298a..e03a9b6d 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ForwardAuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ForwardAuthFilter.java @@ -3,6 +3,7 @@ package com.ruoyi.gateway.filter; import cn.dev33.satoken.same.SaSameUtil; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.web.server.ServerWebExchange; @@ -14,7 +15,7 @@ import reactor.core.publisher.Mono; * @author Lion Li */ @Component -public class ForwardAuthFilter implements GlobalFilter { +public class ForwardAuthFilter implements GlobalFilter, Ordered { @Override public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest newRequest = exchange @@ -26,5 +27,10 @@ public class ForwardAuthFilter implements GlobalFilter { ServerWebExchange newExchange = exchange.mutate().request(newRequest).build(); return chain.filter(newExchange); } + + @Override + public int getOrder() { + return -100; + } }