HTTPCLIENT-1457: Incorrect handling of Windows (NT) credentials by SystemDefaultCredentialsProvider
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1565783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
860578ca5f
commit
580a72d2cd
|
@ -4,6 +4,10 @@ Changes for 4.4-alpha1
|
|||
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>
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
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;
|
||||
|
@ -112,8 +113,25 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue