Class SimpleGroup

java.lang.Object
org.gatein.sso.saml.plugin.SimplePrincipal
org.gatein.sso.saml.plugin.SimpleGroup
All Implemented Interfaces:
Serializable, Cloneable, Principal

public class SimpleGroup extends SimplePrincipal implements Cloneable
Forked class because this plugin can be used on both JBoss or Tomcat and we want to be independent on AS. An implementation of Group that manages a collection of Principal objects based on their hashCode() and equals() methods. This class is not thread safe.
Version:
$Revision$
Author:
Scott.Stark@jboss.org
See Also:
  • Constructor Details

    • SimpleGroup

      public SimpleGroup(String groupName)
  • Method Details

    • addMember

      public boolean addMember(Principal user)
      Adds the specified member to the group.
      Parameters:
      user - the principal to add to this group.
      Returns:
      true if the member was successfully added, false if the principal was already a member.
    • isMember

      public boolean isMember(Principal member)
      Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned. A special check is made to see if the member is an instance of org.jboss.security.AnybodyPrincipal or org.jboss.security.NobodyPrincipal since these classes do not hash to meaningful values.
      Parameters:
      member - the principal whose membership is to be checked.
      Returns:
      true if the principal is a member of this group, false otherwise.
    • members

      public Enumeration<Principal> members()
      Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subinterface of Principal).
      Returns:
      an enumeration of the group members.
    • removeMember

      public boolean removeMember(Principal user)
      Removes the specified member from the group.
      Parameters:
      user - the principal to remove from this group.
      Returns:
      true if the principal was removed, or false if the principal was not a member.
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class SimplePrincipal
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • equals

      public boolean equals(Object o)
      Description copied from class: SimplePrincipal
      Compare this SimplePrincipal's name against another Principal. If system property org.jboss.security.simpleprincipal.equals.override is set to true will only compare instances of SimplePrincipals.
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class SimplePrincipal
      Returns:
      true if name equals another.getName();
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class SimplePrincipal