From 9e5bbf90f8042d63200b3cfae100edca2fd0e630 Mon Sep 17 00:00:00 2001 From: Johannes Matt Date: Sun, 12 Nov 2023 16:48:39 +0100 Subject: [PATCH 1/2] Add HandlerInterceptor bean names to avoid conflicts with other libraries --- .../MultiTenantResourceServerWebMvcConfiguration.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/quantics/multitenant/oauth2/config/MultiTenantResourceServerWebMvcConfiguration.java b/src/main/java/io/quantics/multitenant/oauth2/config/MultiTenantResourceServerWebMvcConfiguration.java index ce89dd9..fdbe15b 100644 --- a/src/main/java/io/quantics/multitenant/oauth2/config/MultiTenantResourceServerWebMvcConfiguration.java +++ b/src/main/java/io/quantics/multitenant/oauth2/config/MultiTenantResourceServerWebMvcConfiguration.java @@ -6,6 +6,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; @@ -40,7 +41,7 @@ public class MultiTenantResourceServerWebMvcConfiguration { private static final Log logger = LogFactory.getLog(WebMvcConfigurer.class); - @Bean + @Bean({ "multiTenantHeaderInterceptor", "multiTenantInterceptor" }) @Conditional(HeaderCondition.class) HandlerInterceptor multiTenantHeaderInterceptor(MultiTenantResourceServerProperties properties, TenantDetailsService tenantService) { @@ -75,7 +76,7 @@ public void postHandle(@NonNull HttpServletRequest request, @NonNull HttpServlet }; } - @Bean + @Bean({ "multiTenantJwtInterceptor", "multiTenantInterceptor" }) @Conditional(JwtCondition.class) HandlerInterceptor multiTenantJwtInterceptor(TenantDetailsService tenantService) { return new HandlerInterceptor() { @@ -108,16 +109,16 @@ public void postHandle(@NonNull HttpServletRequest request, @NonNull HttpServlet } @Bean - @ConditionalOnBean(HandlerInterceptor.class) + @ConditionalOnBean(value = HandlerInterceptor.class, name = "multiTenantInterceptor") WebMvcConfigurer multiTenantWebMvcConfigurer() { return new WebMvcConfigurer() { @Autowired - private HandlerInterceptor interceptor; + private HandlerInterceptor multiTenantInterceptor; @Override public void addInterceptors(@NonNull InterceptorRegistry registry) { - registry.addInterceptor(interceptor); + registry.addInterceptor(multiTenantInterceptor); } }; } From 0e06996e180bb17febcb59646ca5bab36a262a89 Mon Sep 17 00:00:00 2001 From: Johannes Matt Date: Sun, 12 Nov 2023 16:49:19 +0100 Subject: [PATCH 2/2] Update version to 0.3.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 74fc833..74e8176 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ io.quantics multitenant-oauth2-spring-boot-starter - 0.3.1 + 0.3.2 Spring Boot starter library for multi-tenant OAuth2 resource servers