HTTPCLIENT-2147: fixed broken preemptive auth in HC Fluent

This commit is contained in:
rrodewald 2021-04-06 18:12:49 +02:00 committed by Oleg Kalnichevski
parent 935abae04e
commit 8f31e6339d

View File

@ -127,7 +127,7 @@ public Executor auth(final String host, final Credentials credentials) {
public Executor authPreemptive(final HttpHost host) {
if (this.credentialsStore != null) {
final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(host), null);
if (credentials == null) {
if (credentials != null) {
final BasicScheme basicScheme = new BasicScheme();
basicScheme.initPreemptive(credentials);
this.authCache.put(host, basicScheme);
@ -152,7 +152,7 @@ public Executor authPreemptive(final String host) {
public Executor authPreemptiveProxy(final HttpHost proxy) {
if (this.credentialsStore != null) {
final Credentials credentials = this.credentialsStore.getCredentials(new AuthScope(proxy), null);
if (credentials == null) {
if (credentials != null) {
final BasicScheme basicScheme = new BasicScheme();
basicScheme.initPreemptive(credentials);
this.authCache.put(proxy, basicScheme);