8255584: HttpPrincipal::getName
returns incorrect name
Reviewed-by: dfuchs
This commit is contained in:
parent
a6ce6a5d80
commit
2b78a43f77
@ -75,7 +75,7 @@ public class HttpPrincipal implements Principal {
|
||||
* @return the contents of this principal in the form realm:username
|
||||
*/
|
||||
public String getName() {
|
||||
return username;
|
||||
return String.format("%s:%s", realm, username);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,9 +36,13 @@ import static org.testng.Assert.assertEquals;
|
||||
public class HttpPrincipalTest {
|
||||
|
||||
@Test
|
||||
public void TestGetters() {
|
||||
public void testGetters() {
|
||||
var principal = new HttpPrincipal("test", "123");
|
||||
|
||||
assertEquals(principal.getUsername(), "test");
|
||||
assertEquals(principal.getRealm(), "123");
|
||||
assertEquals(principal.getName(), "123:test");
|
||||
assertEquals(principal.toString(), principal.getName());
|
||||
assertEquals(("test"+"123").hashCode(), principal.hashCode());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user