hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1565714 - in /httpcomponents/httpclient/branches/4.3.x: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
Date Fri, 07 Feb 2014 16:26:32 GMT
Author: olegk
Date: Fri Feb  7 16:26:32 2014
New Revision: 1565714

URL: http://svn.apache.org/r1565714
Log:
HTTPCLIENT-1457: Incorrect handling of Windows (NT) credentials by SystemDefaultCredentialsProvider

Modified:
    httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java

Modified: httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt?rev=1565714&r1=1565713&r2=1565714&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt Fri Feb  7 16:26:32 2014
@@ -4,6 +4,10 @@ Changes since 4.3.2
 Changelog:
 -------------------
 
+* [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by
+  SystemDefaultCredentialsProvider.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-1456] Request retrial after status 503 causes ClientProtocolException.
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java?rev=1565714&r1=1565713&r2=1565714&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
(original)
+++ httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
Fri Feb  7 16:26:32 2014
@@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHa
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
+import org.apache.http.auth.NTCredentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.config.AuthSchemes;
@@ -110,8 +111,25 @@ public class SystemDefaultCredentialsPro
                         authscope, Authenticator.RequestorType.PROXY);
             }
             if (systemcreds != null) {
-                return new UsernamePasswordCredentials(
-                        systemcreds.getUserName(), new String(systemcreds.getPassword()));
+                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;



Mime
View raw message