HTTPCLIENT-1377: User principal for non-NTLM authentication is incorrectly generated when using user credentials are specified as NTCredentials

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1494747 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-06-19 19:39:44 +00:00
parent c72ac38d2e
commit 2e72fffacf
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,12 @@
Changes since release 4.3 BETA2
-------------------
* [HTTPCLIENT-1377] User principal for non-NTLM authentication is incorrectly generated when using
user credentials are specified as NTCredentials
Contributed by Gary Gregory <ggregory at apache.org>
Release 4.3 BETA2
-------------------

View File

@ -62,7 +62,7 @@ public class NTUserPrincipal implements Principal, Serializable {
if (this.domain != null && this.domain.length() > 0) {
final StringBuilder buffer = new StringBuilder();
buffer.append(this.domain);
buffer.append('/');
buffer.append('\\');
buffer.append(this.username);
this.ntname = buffer.toString();
} else {

View File

@ -70,7 +70,7 @@ public class TestCredentials {
Assert.assertEquals(new NTUserPrincipal("DOMAIN", "name"),
creds1.getUserPrincipal());
Assert.assertEquals("pwd", creds1.getPassword());
Assert.assertEquals("[principal: DOMAIN/name][workstation: LOCALHOST]",
Assert.assertEquals("[principal: DOMAIN\\name][workstation: LOCALHOST]",
creds1.toString());
final NTCredentials creds2 = new NTCredentials(
"name", null, null, null);
@ -86,7 +86,7 @@ public class TestCredentials {
Assert.assertEquals(new NTUserPrincipal("DOMAIN", "name"),
creds3.getUserPrincipal());
Assert.assertEquals("pwd", creds3.getPassword());
Assert.assertEquals("[principal: DOMAIN/name][workstation: null]",
Assert.assertEquals("[principal: DOMAIN\\name][workstation: null]",
creds3.toString());
final NTCredentials creds4 = new NTCredentials(
"domain/name");
@ -94,7 +94,7 @@ public class TestCredentials {
Assert.assertEquals(new NTUserPrincipal("DOMAIN", "name"),
creds4.getUserPrincipal());
Assert.assertEquals(null, creds4.getPassword());
Assert.assertEquals("[principal: DOMAIN/name][workstation: null]",
Assert.assertEquals("[principal: DOMAIN\\name][workstation: null]",
creds4.toString());
final NTCredentials creds5 = new NTCredentials(
"name");