@Filter(value="${micronaut.security.token.propagation.path:/**}") @Requires(beans={TokenWriter.class,TokenPropagationConfiguration.class}) @Requires(property="micronaut.security.token.propagation.enabled") public class TokenPropagationHttpClientFilter extends Object implements HttpClientFilter
HttpClientFilter
to enable Token propagation.Modifier and Type | Field and Description |
---|---|
protected OutgoingHttpRequestProcessor |
outgoingHttpRequestProcessor |
protected TokenPropagationConfiguration |
tokenPropagationConfiguration |
protected TokenWriter |
tokenWriter |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
TokenPropagationHttpClientFilter(TokenWriter tokenWriter,
TokenPropagationConfiguration tokenPropagationConfiguration,
OutgoingHttpRequestProcessor outgoingHttpRequestProcessor) |
Modifier and Type | Method and Description |
---|---|
Publisher<? extends HttpResponse<?>> |
doFilter(MutableHttpRequest<?> targetRequest,
ClientFilterChain chain)
A variation of
HttpFilter.doFilter(HttpRequest, FilterChain) that receives a MutableHttpRequest
allowing the request to be modified. |
Publisher<? extends HttpResponse<?>> |
doFilter(MutableHttpRequest<?> targetRequest,
ClientFilterChain chain,
HttpRequest<Object> currentRequest) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doFilter
protected final TokenPropagationConfiguration tokenPropagationConfiguration
protected final TokenWriter tokenWriter
protected final OutgoingHttpRequestProcessor outgoingHttpRequestProcessor
public TokenPropagationHttpClientFilter(TokenWriter tokenWriter, TokenPropagationConfiguration tokenPropagationConfiguration, OutgoingHttpRequestProcessor outgoingHttpRequestProcessor)
tokenWriter
- bean responsible of writing the token to the target requesttokenPropagationConfiguration
- JWT Propagation configurationoutgoingHttpRequestProcessor
- Utility to decide whether to process the requestpublic Publisher<? extends HttpResponse<?>> doFilter(MutableHttpRequest<?> targetRequest, ClientFilterChain chain)
HttpClientFilter
HttpFilter.doFilter(HttpRequest, FilterChain)
that receives a MutableHttpRequest
allowing the request to be modified.doFilter
in interface HttpClientFilter
targetRequest
- The target requestchain
- The filter chainHttpFilter
public Publisher<? extends HttpResponse<?>> doFilter(MutableHttpRequest<?> targetRequest, ClientFilterChain chain, HttpRequest<Object> currentRequest)
targetRequest
- The target request of this HttpClientFilterchain
- The filter chaincurrentRequest
- The original request which triggered during its execution the invocation of this HttpClientFilter