hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Davids (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1732) Providing NTLM credentials for a http proxy via system properties never get read
Date Fri, 18 Mar 2016 16:44:33 GMT
Patrick Davids created HTTPCLIENT-1732:
------------------------------------------

             Summary: Providing NTLM credentials for a http proxy via system properties never
get read
                 Key: HTTPCLIENT-1732
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1732
             Project: HttpComponents HttpClient
          Issue Type: Bug
    Affects Versions: 4.5.1
            Reporter: Patrick Davids


Hi all,
when configuring the credentials via system properties.

{code}
-Dhttp.proxyHost=TheUrlToTheNtmlProxy
-Dhttp.proxyPort=8080
-Dhttp.proxyUser=TheUsersName
-Dhttp.proxyPassword=TheUsersPassword
-Dhttp.auth.ntlm.domain=TheDomain
{code}

they never get read...

Following code block seem wrong to me:

SystemDefaultCredentialsProvider:
{code}
@Override
    public Credentials getCredentials(final AuthScope authscope) {
        Args.notNull(authscope, "Auth scope");
        final Credentials localcreds = internal.getCredentials(authscope);
        if (localcreds != null) {
            return localcreds;
        }
        if (authscope.getHost() != null) {
            PasswordAuthentication systemcreds = getSystemCreds(
                    authscope, Authenticator.RequestorType.SERVER);
            if (systemcreds == null) {
                systemcreds = getSystemCreds(
                        authscope, Authenticator.RequestorType.PROXY);
            }

//*** systemcreds is always null ***

            if (systemcreds != null) {
                final String domain = System.getProperty("http.auth.ntlm.domain");
                if (domain != null) {
                    return new NTCredentials(
                            systemcreds.getUserName(),
                            new String(systemcreds.getPassword()),
                            null, domain);
                } else {
                    if (AuthSchemes.NTLM.equalsIgnoreCase(authscope.getScheme())) {
                        // Domian may be specified in a fully qualified user name
                        return new NTCredentials(
                                systemcreds.getUserName(),
                                new String(systemcreds.getPassword()),
                                null, null);
                    } else {
                        return new UsernamePasswordCredentials(
                                systemcreds.getUserName(),
                                new String(systemcreds.getPassword()));
                    }
                }
            }
        }
        return null;
    }
{code}

_systemcreds_ is always null, because the _Authenticator.requestPasswordAuthentication()_
returns null, when no system wide authenticator was set, by _setDefault(...)_.

So, the question is, or maybe the bug... why is it possible to fully configure the NTLM credentials,
but no authenticator is available, and due to that a programmatic way is always necessary
to get NTLM auth working.

The benefit of configuring (no programming) via system properties is lost.

kind regards
Patrick



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message