From 92d8234fcba3fc21bbb7b07bc61591e4f9e93cee Mon Sep 17 00:00:00 2001 From: zhangjf Date: Sun, 22 Feb 2026 22:35:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E7=BD=91=E5=85=B3Filt?= =?UTF-8?q?er=E7=99=BD=E5=90=8D=E5=8D=95=E8=B7=AF=E5=BE=84=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D/fund=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改文件: - TenantGatewayFilter.java: 白名单路径添加/fund前缀 - TokenAuthFilter.java: 白名单路径添加/fund前缀 白名单路径变更: - 旧: /sys/api/v1/auth/login - 新: /fund/sys/auth/login 说明: - Filter在网关层执行,使用原始请求路径(含/fund前缀) - StripPrefix在Filter之后执行,转发时才剥离前缀 --- .../gateway/filter/TenantGatewayFilter.java | 23 ++++++++++--------- .../gateway/filter/TokenAuthFilter.java | 14 +++++++---- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TenantGatewayFilter.java b/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TenantGatewayFilter.java index 4091475..c61181c 100644 --- a/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TenantGatewayFilter.java +++ b/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TenantGatewayFilter.java @@ -38,18 +38,19 @@ public class TenantGatewayFilter implements GlobalFilter, Ordered { public static final String HEADER_USERNAME = "X-Username"; // 白名单路径(不需要X-Tenant-Id) + // 注意:路径是网关接收的原始请求路径(含/fund前缀) private static final List TENANT_ID_WHITE_LIST = Arrays.asList( - "/sys/api/v1/auth/login", // 登录接口 - "/sys/api/v1/auth/logout", // 登出接口 - "/actuator/health", // 健康检查 - "/sys/api/v1/sys/health", // 系统服务健康检查 - "/cust/api/v1/cust/health", // 客户服务健康检查 - "/proj/api/v1/proj/health", // 项目服务健康检查 - "/exp/api/v1/exp/health", // 支出服务健康检查 - "/receipt/api/v1/receipt/health", // 收款服务健康检查 - "/report/api/v1/report/health", // 报表服务健康检查 - "/req/api/v1/req/health", // 请求服务健康检查 - "/file/api/v1/file/health" // 文件服务健康检查 + "/fund/sys/auth/login", // 登录接口 + "/fund/sys/auth/logout", // 登出接口 + "/actuator/health", // 网关健康检查(无/fund前缀) + "/fund/sys/health", // 系统服务健康检查 + "/fund/cust/health", // 客户服务健康检查 + "/fund/proj/health", // 项目服务健康检查 + "/fund/exp/health", // 支出服务健康检查 + "/fund/receipt/health", // 收款服务健康检查 + "/fund/report/health", // 报表服务健康检查 + "/fund/req/health", // 请求服务健康检查 + "/fund/file/health" // 文件服务健康检查 ); private final ObjectMapper objectMapper = new ObjectMapper(); diff --git a/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TokenAuthFilter.java b/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TokenAuthFilter.java index a8ea472..79a192f 100644 --- a/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TokenAuthFilter.java +++ b/fund-gateway/src/main/java/com/fundplatform/gateway/filter/TokenAuthFilter.java @@ -39,11 +39,17 @@ public class TokenAuthFilter implements GlobalFilter, Ordered { private static final String TENANT_ID_HEADER = "X-Tenant-Id"; // 白名单路径(不需要token验证) + // 注意:路径是网关接收的原始请求路径(含/fund前缀) private static final List WHITE_LIST = Arrays.asList( - "/sys/api/v1/auth/login", - "/sys/api/v1/sys/health", - "/cust/api/v1/cust/health", - "/proj/api/v1/proj/health" + "/fund/sys/auth/login", + "/fund/sys/health", + "/fund/cust/health", + "/fund/proj/health", + "/fund/exp/health", + "/fund/receipt/health", + "/fund/report/health", + "/fund/req/health", + "/fund/file/health" ); private final ReactiveTokenService reactiveTokenService;