RED-6686 - token based web request interceptor

This commit is contained in:
Timo Bejan 2023-06-27 22:49:01 +03:00
parent 2f92814657
commit 814dc15efb

View File

@ -0,0 +1,27 @@
package com.knecon.fforesight.keycloakcommons;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@ConditionalOnClass(WebMvcConfigurer.class)
public class MultiTenancyJwtBasedWebConfiguration implements WebMvcConfigurer {
private final JwtBasedTenantInterceptor jwtBasedTenantInterceptor;
public MultiTenancyJwtBasedWebConfiguration(JwtBasedTenantInterceptor jwtBasedTenantInterceptor) {
this.jwtBasedTenantInterceptor = jwtBasedTenantInterceptor;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addWebRequestInterceptor(jwtBasedTenantInterceptor);
}
}