Merge pull request #10140 from kwoyke/BAEL-4657

BAEL-4657: Add BasicAuthRequestInterceptor example
This commit is contained in:
Loredana Crusoveanu 2020-10-16 19:10:39 +03:00 committed by GitHub
commit dc8fe72bb5
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.baeldung.cloud.openfeign.config;
import feign.Logger;
import feign.RequestInterceptor;
import feign.auth.BasicAuthRequestInterceptor;
import feign.codec.ErrorDecoder;
import feign.okhttp.OkHttpClient;
import org.apache.http.entity.ContentType;
@ -34,4 +35,9 @@ public class ClientConfiguration {
requestTemplate.header("Accept", ContentType.APPLICATION_JSON.getMimeType());
};
}
// @Bean - uncomment to use this interceptor and remove @Bean from the requestInterceptor()
public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
return new BasicAuthRequestInterceptor("ajeje", "brazof");
}
}