Commit e83834079e874a9ff27cbdbc574c9d063e85b109

Authored by YunaiV
1 parent e91fc70f

fix:【framework 框架】TenantSecurityWebFilter 支持 context-path 校验无需租户 URL

https://github.com/YunaiV/ruoyi-vue-pro/issues/905
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 { @@ -101,13 +101,14 @@ public class TenantSecurityWebFilter extends ApiRequestFilter {
101 } 101 }
102 102
103 private boolean isIgnoreUrl(HttpServletRequest request) { 103 private boolean isIgnoreUrl(HttpServletRequest request) {
  104 + String apiUri = request.getRequestURI().substring(request.getContextPath().length());
104 // 快速匹配,保证性能 105 // 快速匹配,保证性能
105 - if (CollUtil.contains(tenantProperties.getIgnoreUrls(), request.getRequestURI())) { 106 + if (CollUtil.contains(tenantProperties.getIgnoreUrls(), apiUri)) {
106 return true; 107 return true;
107 } 108 }
108 // 逐个 Ant 路径匹配 109 // 逐个 Ant 路径匹配
109 for (String url : tenantProperties.getIgnoreUrls()) { 110 for (String url : tenantProperties.getIgnoreUrls()) {
110 - if (pathMatcher.match(url, request.getRequestURI())) { 111 + if (pathMatcher.match(url, apiUri)) {
111 return true; 112 return true;
112 } 113 }
113 } 114 }