protected boolean matchGroupPrincipal(List<Principal> groupPrincipals, String userRole) { boolean res = false; { if (groupPrincipals != null) { if (userRole != null) { for (Principal groupPrincipal : groupPrincipals) { if (groupPrincipal instanceof DistinguishedNamePrincipal) { DistinguishedNamePrincipal p = (DistinguishedNamePrincipal) groupPrincipal; res = matchGroupPrincipal(p, userRole); } else { if (groupPrincipal instanceof CommonNamePrincipal) { CommonNamePrincipal p = (CommonNamePrincipal) groupPrincipal; res = matchGroupPrincipal(p, userRole); } else { String name = groupPrincipal.getName(); if (name.equals(userRole)) { res = true; } } } if (res) // if a match has been found... { break; // stop loop } } } } } return res; }
public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof MockX509Certificate) return subject.equals(((MockX509Certificate) obj).subject) && issuer.equals(((MockX509Certificate) obj).issuer); return false; }
public String toString() { return subject.toString(); }
public int hashCode() { return subject.hashCode() + issuer.hashCode(); }