Browse Source

Apache HTTP: support proxy authentication

Add a credentials provider that forwards to the java.net.Authenticator.
Needed to support proxies requiring authentication.

Bug: 549832
Change-Id: I181ee27a6c9f1b3fa402ce58affdd5ff3f7c96c9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
next
Thomas Wolf 5 years ago
parent
commit
2abd3c43bd
  1. 3
      org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java

3
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java

@ -92,6 +92,7 @@ import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.SystemDefaultCredentialsProvider;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager; import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.eclipse.jgit.annotations.NonNull; import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.transport.http.HttpConnection; import org.eclipse.jgit.transport.http.HttpConnection;
@ -165,6 +166,8 @@ public class HttpClientConnection implements HttpConnection {
new BasicHttpClientConnectionManager(registry)); new BasicHttpClientConnectionManager(registry));
} }
clientBuilder.setDefaultRequestConfig(configBuilder.build()); clientBuilder.setDefaultRequestConfig(configBuilder.build());
clientBuilder.setDefaultCredentialsProvider(
new SystemDefaultCredentialsProvider());
client = clientBuilder.build(); client = clientBuilder.build();
} }

Loading…
Cancel
Save