All,

I'm refering to Adam's comment here:

http://issues.gradle.org/browse/GRADLE-2233?focusedCommentId=18038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18038

Our problem is that JCIFS does not seem to be able to authenticate against
our corporate HTTP proxy (for reasons unknown to me). Basically, Apache
HTTP client goes into an infinite loop on NTLM, because it does this:

[DEBUG] [org.apache.http.headers] << Proxy-Authenticate: NTLM
[DEBUG] [org.apache.http.headers] << Proxy-Authenticate: Basic realm="the
Proxy server"
(...)
[DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy]
Authentication schemes in the order of preference: [NTLM, Basic]

In four words - Basic works, NTLM doesn't.

Seems that the simplest thing to do for us would be to extend the code to
enable it to change the authentication scheme priorities, using

http.auth.proxy-scheme-pref

param to instrument Apache HttpClient, as documented here:

http://hc.apache.org/httpcomponents-client-4.2.x/tutorial/html/authentication.html#d5e912

so that we can force it to use Basic before NTLM.

I hacked that quickly against Gradle v1.10, by adding the following
hardcoded settings to HttpClientConfigurer.java:83:

    List<String> authpref = new ArrayList<String>();
    authpref.add( AuthPolicy.BASIC );
    authpref.add( AuthPolicy.NTLM );
    httpClient.getParams().setParameter( "http.auth.target-scheme-pref",
authpref );
    httpClient.getParams().setParameter( "http.auth.proxy-scheme-pref",
authpref );


It works as expected, so the log shows

[DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy]
Authentication schemes in the order of preference: [Basic, NTLM]


As I stated on JIRA, I can submit a pull request - a solution could be to
pass it from systemProp properties to the client parameters, for example.

Let me know what's your preference.

cheers,
Adam

Reply via email to