Ejemplo n.º 1
0
  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;
  }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public String toString() {
   return subject.toString();
 }
Ejemplo n.º 4
0
 public int hashCode() {
   return subject.hashCode() + issuer.hashCode();
 }