Enhance equals() method to detect key variances.
This commit is contained in:
parent
6eb0a47632
commit
83d871cd5d
|
@ -154,6 +154,10 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getKeyHash() != test.getKeyHash()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,28 @@ public class CasAuthenticationTokenTests extends TestCase {
|
||||||
assertTrue(!token1.equals(token2));
|
assertTrue(!token1.equals(token2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testNotEqualsDueToKey() {
|
||||||
|
List proxyList1 = new Vector();
|
||||||
|
proxyList1.add("https://localhost/newPortal/j_acegi_cas_security_check");
|
||||||
|
|
||||||
|
CasAuthenticationToken token1 = new CasAuthenticationToken("key",
|
||||||
|
"Test", "Password",
|
||||||
|
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
|
||||||
|
"ROLE_TWO")}, proxyList1,
|
||||||
|
"PGTIOU-0-R0zlgrl4pdAQwBvJWO3vnNpevwqStbSGcq3vKB2SqSFFRnjPHt");
|
||||||
|
|
||||||
|
List proxyList2 = new Vector();
|
||||||
|
proxyList2.add("https://localhost/newPortal/j_acegi_cas_security_check");
|
||||||
|
|
||||||
|
CasAuthenticationToken token2 = new CasAuthenticationToken("DIFFERENT_KEY",
|
||||||
|
"Test", "Password",
|
||||||
|
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl(
|
||||||
|
"ROLE_TWO")}, proxyList2,
|
||||||
|
"PGTIOU-0-R0zlgrl4pdAQwBvJWO3vnNpevwqStbSGcq3vKB2SqSFFRnjPHt");
|
||||||
|
|
||||||
|
assertTrue(!token1.equals(token2));
|
||||||
|
}
|
||||||
|
|
||||||
public void testNotEqualsDueToProxyGrantingTicket() {
|
public void testNotEqualsDueToProxyGrantingTicket() {
|
||||||
List proxyList1 = new Vector();
|
List proxyList1 = new Vector();
|
||||||
proxyList1.add("https://localhost/newPortal/j_acegi_cas_security_check");
|
proxyList1.add("https://localhost/newPortal/j_acegi_cas_security_check");
|
||||||
|
|
Loading…
Reference in New Issue