Hi,
I try to do a request using a proxy with digest authentication but the
authentication fails, here is the code :
// Proxy credentials
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope("80.1.2.3", 3128),
new UsernamePasswordCredentials("proxy_user", "proxy_pass"));
HttpHost proxy = new HttpHost("80.1.2.3", 3128);
CloseableHttpClient httpclient = HttpClients.custom()
.setSSLSocketFactory(sslsf)
.setDefaultCredentialsProvider(credsProvider)
.setProxy(proxy)
.build();
HttpGet httpget = new HttpGet("https://myhost.com:8443");
HttpClientContext context = HttpClientContext.create();
CloseableHttpResponse resp = httpclient.execute(httpget, context);
Log.d("TST", String.valueOf(resp.getStatusLine()));
Log.d("TST", EntityUtils.toString(resp.getEntity()));
AuthState proxyAuthState = context.getProxyAuthState();
Log.d("TST", "Proxy auth state: " + proxyAuthState.getState());
Log.d("TST", "Proxy auth scheme: " + proxyAuthState.getAuthScheme());
Log.d("TST", "Proxy auth credentials: " + proxyAuthState.getCredentials());
AuthState targetAuthState = context.getTargetAuthState();
Log.d("TST", "Target auth state: " + targetAuthState.getState());
Log.d("TST", "Target auth scheme: " + targetAuthState.getAuthScheme());
Log.d("TST", "Target auth credentials: " + targetAuthState.getCredentials());
Any idea, please ?
Thanks,
Stéphane