Class Subject

  • All Implemented Interfaces:
    Serializable

    public class Subject
    extends Object
    implements Serializable
    A Subject represents a grouping of related information for a single entity, such as a person. Such information includes the Subject's identities as well as its security-related attributes (passwords and cryptographic keys, for example).

    Subjects may potentially have multiple identities. Each identity is represented as a Principal within the Subject. Principals simply bind names to a Subject. For example, a Subject that happens to be a person, Alice, might have two Principals:
    one which binds "Alice Bar", the name on her driver license, to the Subject, and another which binds, "999-99-9999", the number on her student identification card, to the Subject. Both Principals refer to the same Subject even though each has a different name.

    Version:
    1
    Author:
    Suneet Shah
    See Also:
    Serialized Form
    • Field Detail

      • readOnly

        public boolean readOnly
    • Constructor Detail

      • Subject

        public Subject​(String userId)
        Create an instance of a Subject The specified Sets must check whether this Subject has not been set to read-only before permitting subsequent modifications.
        Parameters:
        userId -
    • Method Detail

      • setUserId

        public void setUserId​(String userId)
        This method sets the user id.
        Parameters:
        userId - Sets the user id.
      • setExpirationTime

        public void setExpirationTime​(long expTime)
        This method sets the expitarion time for the user authentication token.
        Parameters:
        expTime - The expiration time is set.
      • hashCode

        public int hashCode()
        Returns hashcode for the user id.
        Overrides:
        hashCode in class Object
        Returns:
        int Gets the hash code.
      • equals

        public boolean equals​(Object object)
        This method compares objects of userId.
        Overrides:
        equals in class Object
        Parameters:
        object - The object to be compared .
        Returns:
        boolean Returns value as per equality of objects.