@Filter(value="${micronaut.multitenancy.propagation.path:/**}") @Requires(beans={TenantWriter.class,TenantResolver.class,TenantPropagationConfiguration.class,OutgoingHttpRequestProcessor.class}) @Requires(property="micronaut.multitenancy.propagation.enabled") public class TenantPropagationHttpClientFilter extends Object implements HttpClientFilter
HttpClientFilter
to enable Token propagation.Modifier and Type | Field and Description |
---|---|
protected OutgoingHttpRequestProcessor |
outgoingHttpRequestProcessor |
protected TenantPropagationConfiguration |
tenantPropagationConfiguration |
protected TenantResolver |
tenantResolver |
protected TenantWriter |
tokenWriter |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
TenantPropagationHttpClientFilter(TenantResolver tenantResolver,
TenantWriter tokenWriter,
TenantPropagationConfiguration tenantPropagationConfiguration,
OutgoingHttpRequestProcessor outgoingHttpRequestProcessor) |
Modifier and Type | Method and Description |
---|---|
Publisher<? extends HttpResponse<?>> |
doFilter(MutableHttpRequest<?> targetRequest,
ClientFilterChain chain)
If the request should be processed and the tenant id is resolved, the tenant is written to the targeted request with a
TenantWriter . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doFilter
protected final TenantPropagationConfiguration tenantPropagationConfiguration
protected final TenantWriter tokenWriter
protected final TenantResolver tenantResolver
protected final OutgoingHttpRequestProcessor outgoingHttpRequestProcessor
public TenantPropagationHttpClientFilter(TenantResolver tenantResolver, TenantWriter tokenWriter, TenantPropagationConfiguration tenantPropagationConfiguration, OutgoingHttpRequestProcessor outgoingHttpRequestProcessor)
tenantResolver
- bean responsible of resolving the tenanttokenWriter
- bean responsible of writing the token to the target requesttenantPropagationConfiguration
- Tenant Propagation configurationoutgoingHttpRequestProcessor
- Utility to decide whether to process the requestpublic Publisher<? extends HttpResponse<?>> doFilter(MutableHttpRequest<?> targetRequest, ClientFilterChain chain)
TenantWriter
.doFilter
in interface HttpClientFilter
targetRequest
- The target requestchain
- The filter chainHttpFilter