Commit efb209226176aadabe943ee1293d8c31103dadb6

Authored by YunaiV
1 parent f0402f69

feat:【framework 框架】@PermitAll、@TenantIgnore 支持接口级

yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java
@@ -137,7 +137,8 @@ public class YudaoTenantAutoConfiguration { @@ -137,7 +137,8 @@ public class YudaoTenantAutoConfiguration {
137 // 获得有 @TenantIgnore 注解的接口 137 // 获得有 @TenantIgnore 注解的接口
138 for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) { 138 for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) {
139 HandlerMethod handlerMethod = entry.getValue(); 139 HandlerMethod handlerMethod = entry.getValue();
140 - if (!handlerMethod.hasMethodAnnotation(TenantIgnore.class)) { 140 + if (!handlerMethod.hasMethodAnnotation(TenantIgnore.class) // 方法级
  141 + && !handlerMethod.getBeanType().isAnnotationPresent(TenantIgnore.class)) { // 接口级
141 continue; 142 continue;
142 } 143 }
143 // 添加到忽略的 URL 中 144 // 添加到忽略的 URL 中
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
@@ -165,7 +165,8 @@ public class YudaoWebSecurityConfigurerAdapter { @@ -165,7 +165,8 @@ public class YudaoWebSecurityConfigurerAdapter {
165 // 获得有 @PermitAll 注解的接口 165 // 获得有 @PermitAll 注解的接口
166 for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) { 166 for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) {
167 HandlerMethod handlerMethod = entry.getValue(); 167 HandlerMethod handlerMethod = entry.getValue();
168 - if (!handlerMethod.hasMethodAnnotation(PermitAll.class)) { 168 + if (!handlerMethod.hasMethodAnnotation(PermitAll.class) // 方法级
  169 + && !handlerMethod.getBeanType().isAnnotationPresent(PermitAll.class)) { // 接口级
169 continue; 170 continue;
170 } 171 }
171 Set<String> urls = new HashSet<>(); 172 Set<String> urls = new HashSet<>();