I want every time when I make a request through feign client, to set a specific header with my authenticated user.
This is my filter from which I get the authentication
You don't really need your own implementation of the FeignRequestInterceptor
as there is already BasicAuthRequestInterceptor in the feign.auth
package that does exactly the same.
With this said, you basically have almost everything set up already. All is left to do is to define the basicAuthRequestInterceptor
bean with specific username and password:
@Bean
public RequestInterceptor basicAuthRequestInterceptor() {
return new BasicAuthRequestInterceptor("username", "password");
}