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>
This commit is contained in:
parent
7192d9aecd
commit
2abd3c43bd
|
@ -92,6 +92,7 @@
|
|||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.client.SystemDefaultCredentialsProvider;
|
||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
||||
import org.eclipse.jgit.annotations.NonNull;
|
||||
import org.eclipse.jgit.transport.http.HttpConnection;
|
||||
|
@ -165,6 +166,8 @@ private HttpClient getClient() {
|
|||
new BasicHttpClientConnectionManager(registry));
|
||||
}
|
||||
clientBuilder.setDefaultRequestConfig(configBuilder.build());
|
||||
clientBuilder.setDefaultCredentialsProvider(
|
||||
new SystemDefaultCredentialsProvider());
|
||||
client = clientBuilder.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue