|
|
|
@ -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<Void> 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|