You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2016/04/02 12:29:25 UTC

[jira] [Resolved] (HTTPCLIENT-1732) Providing NTLM credentials for a http proxy via system properties never get read

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1732.
-------------------------------------------
       Resolution: Fixed
    Fix Version/s: 5.0 Alpha2

Committed to SVN trunk and 4.5.x branch.

Oleg

> 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
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.5.3, 5.0 Alpha2
>
>
> 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