Просмотр исходного кода

fix:【framework 框架】TenantSecurityWebFilter 支持 context-path 校验无需租户 URL
https://github.com/YunaiV/ruoyi-vue-pro/issues/905

YunaiV месяцев назад: 10
Родитель
Сommit
e83834079e

+ 3 - 2
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java

@@ -101,13 +101,14 @@ public class TenantSecurityWebFilter extends ApiRequestFilter {
     }
 
     private boolean isIgnoreUrl(HttpServletRequest request) {
+        String apiUri = request.getRequestURI().substring(request.getContextPath().length());
         // 快速匹配,保证性能
-        if (CollUtil.contains(tenantProperties.getIgnoreUrls(), request.getRequestURI())) {
+        if (CollUtil.contains(tenantProperties.getIgnoreUrls(), apiUri)) {
             return true;
         }
         // 逐个 Ant 路径匹配
         for (String url : tenantProperties.getIgnoreUrls()) {
-            if (pathMatcher.match(url, request.getRequestURI())) {
+            if (pathMatcher.match(url, apiUri)) {
                 return true;
             }
         }