1.This is how I set org.apache.http.auth.NTCredentials in my test program.( Similar to what is done in gradle )
NTCredentials credentials = new NTCredentials("MY_USER_NAME", "MY_PASSWORD", "MY_WORKSTATION", "MY_DOMAIN");
"MY_PROXY", MY_PROXY_PORT, AuthScope.ANY_REALM, AuthPolicy.NTLM), credentials);
Since the above values are not getting printed when i test the default http client , I am not
able to verify what are the values actually getting used by httpclient. I verified manually and they are same.
Below are the values that get printed when i use gradle
09:37:55.720 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpClientConfigurer]
Using Credentials [username: MY_DOMAIN/MY_USER_NAME]
and NTLM Credentials [user: MY_USER_NAME, domain: MY_DOMAIN, workstation: MY_WORKSTATION] for authenticating against 'MY_PROXY:MY_PROXY_PORT'
- You are right. When I provide wrong NT Credentials to httpclient , it fails and does not try for other authentication mechanisms.
Looks like the values passed from gradle are different from the ones used by httpclient.I tried specifying the http.auth.ntlm.workstation in gradle.properties but did
Few differences which I observed were gradle uses org.apache.http.impl.client.SystemDefaultHttpClient and in the
test program I have used org.apache.http.impl.client.DefaultHttpClient.
From the logs , I observed the below
Gradle - > First attempt for Negotiate Fails
Second attempt results in “HTTP/1.1 407 Proxy Authentication Required”
Third attmept results again in “HTTP/1.1 407 Proxy Authentication Required”
Test Client -> First attempt for Negotiate Fails
Second attempt for NTLM results in “HTTP/1.1 407 Proxy Authentication Required” .
Third attempt results in “HTTP/1.1 302 Found”