HttpAuthenticator to re-use the logger of its parent

This commit is contained in:
Oleg Kalnichevski 2018-10-16 16:18:25 +02:00
parent ac90342039
commit 447e276fb6
5 changed files with 6 additions and 4 deletions

View File

@ -90,7 +90,7 @@ public final class AsyncConnectExec implements AsyncExecChainHandler {
Args.notNull(proxyAuthStrategy, "Proxy authentication strategy"); Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
this.proxyHttpProcessor = proxyHttpProcessor; this.proxyHttpProcessor = proxyHttpProcessor;
this.proxyAuthStrategy = proxyAuthStrategy; this.proxyAuthStrategy = proxyAuthStrategy;
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator(log);
this.routeDirector = new BasicRouteDirector(); this.routeDirector = new BasicRouteDirector();
} }

View File

@ -94,7 +94,7 @@ class AsyncProtocolExec implements AsyncExecChainHandler {
this.httpProcessor = Args.notNull(httpProcessor, "HTTP protocol processor"); this.httpProcessor = Args.notNull(httpProcessor, "HTTP protocol processor");
this.targetAuthStrategy = Args.notNull(targetAuthStrategy, "Target authentication strategy"); this.targetAuthStrategy = Args.notNull(targetAuthStrategy, "Target authentication strategy");
this.proxyAuthStrategy = Args.notNull(proxyAuthStrategy, "Proxy authentication strategy"); this.proxyAuthStrategy = Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator(log);
} }
@Override @Override

View File

@ -45,6 +45,7 @@ import org.apache.hc.client5.http.auth.ChallengeType;
import org.apache.hc.client5.http.auth.CredentialsProvider; import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.auth.MalformedChallengeException; import org.apache.hc.client5.http.auth.MalformedChallengeException;
import org.apache.hc.client5.http.protocol.HttpClientContext; import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.annotation.Internal;
import org.apache.hc.core5.http.FormattedHeader; import org.apache.hc.core5.http.FormattedHeader;
import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHeaders; import org.apache.hc.core5.http.HttpHeaders;
@ -69,6 +70,7 @@ public class HttpAuthenticator {
private final Logger log; private final Logger log;
private final AuthChallengeParser parser; private final AuthChallengeParser parser;
@Internal
public HttpAuthenticator(final Logger log) { public HttpAuthenticator(final Logger log) {
super(); super();
this.log = log != null ? log : LoggerFactory.getLogger(getClass()); this.log = log != null ? log : LoggerFactory.getLogger(getClass());

View File

@ -91,7 +91,7 @@ public final class ConnectExec implements ExecChainHandler {
this.reuseStrategy = reuseStrategy; this.reuseStrategy = reuseStrategy;
this.proxyHttpProcessor = proxyHttpProcessor; this.proxyHttpProcessor = proxyHttpProcessor;
this.proxyAuthStrategy = proxyAuthStrategy; this.proxyAuthStrategy = proxyAuthStrategy;
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator(log);
this.routeDirector = new BasicRouteDirector(); this.routeDirector = new BasicRouteDirector();
} }

View File

@ -94,7 +94,7 @@ final class ProtocolExec implements ExecChainHandler {
this.httpProcessor = Args.notNull(httpProcessor, "HTTP protocol processor"); this.httpProcessor = Args.notNull(httpProcessor, "HTTP protocol processor");
this.targetAuthStrategy = Args.notNull(targetAuthStrategy, "Target authentication strategy"); this.targetAuthStrategy = Args.notNull(targetAuthStrategy, "Target authentication strategy");
this.proxyAuthStrategy = Args.notNull(proxyAuthStrategy, "Proxy authentication strategy"); this.proxyAuthStrategy = Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
this.authenticator = new HttpAuthenticator(); this.authenticator = new HttpAuthenticator(log);
} }
@Override @Override