Class MembershipPrincipal

  • All Implemented Interfaces:
    Serializable, Principal

    public class MembershipPrincipal
    extends Object
    implements Principal, Serializable
    This class implements the Principal interface and represents an Membership user.

    Principals such as this MembershipPrincipal may be associated with a particular Subject to augment that Subject with an additional identity. Refer to the Subject class for more information on how to achieve this. Authorization decisions can then be based upon the Principals associated with a Subject.

    See Also:
    Serialized Form
    • Constructor Detail

      • MembershipPrincipal

        public MembershipPrincipal​(String name)
        Creates a MembershipPrincipal with a Membership user name.
        Parameters:
        name - the Membership user name for this user.
        Throws:
        NullPointerException - if the name is null.
    • Method Detail

      • getName

        public String getName()
        Returns the Membership user name for this MembershipPrincipal.
        Specified by:
        getName in interface Principal
        Returns:
        the Membership user name for this MembershipPrincipal
      • toString

        public String toString()
        Returns a string representation of this MembershipPrincipal.
        Specified by:
        toString in interface Principal
        Overrides:
        toString in class Object
        Returns:
        a string representation of this MembershipPrincipal.
      • equals

        public boolean equals​(Object o)
        Compares the specified Object with this MembershipPrincipal for equality. Returns true if the given object is also a MembershipPrincipal and the two MembershipPrincipals have the same user name.
        Specified by:
        equals in interface Principal
        Overrides:
        equals in class Object
        Parameters:
        o - Object to be compared for equality with this MembershipPrincipal.
        Returns:
        true if the specified Object is equal equal to this MembershipPrincipal.
      • hashCode

        public int hashCode()
        Returns a hash code for this MembershipPrincipal.
        Specified by:
        hashCode in interface Principal
        Overrides:
        hashCode in class Object
        Returns:
        a hash code for this MembershipPrincipal.