Class UsernamePrincipal

java.lang.Object
com.ibm.security.auth.UsernamePrincipal
All Implemented Interfaces:
Serializable, Principal

public class UsernamePrincipal extends Object implements Principal, Serializable

This class implements the Principal interface and represents an OS/390 user.

Principals such as this UsernamePrincipal 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 on the Principals associated with a Subject.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an UsernamePrincipal with an OS/390 username.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares the specified Object with this UsernamePrincipal for equality.
    Return the OS/390 username for this UsernamePrincipal.
    int
    Return a hash code for this UsernamePrincipal.
    Return a string representation of this UsernamePrincipal.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.security.Principal

    implies
  • Constructor Details

    • UsernamePrincipal

      public UsernamePrincipal(String name)
      Create an UsernamePrincipal with an OS/390 username.

      Parameters:
      name - the OS/390 username for this user.

      Throws:
      NullPointerException - if the name is null.
      RuntimeException - if the name has zero length.
  • Method Details

    • getName

      public String getName()
      Return the OS/390 username for this UsernamePrincipal.

      Specified by:
      getName in interface Principal
      Returns:
      the OS/390 username for this UsernamePrincipal.
    • toString

      public String toString()
      Return a string representation of this UsernamePrincipal.

      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
      Returns:
      a string representation of this UsernamePrincipal.
    • equals

      public boolean equals(Object o)
      Compares the specified Object with this UsernamePrincipal for equality. Returns true if the given object is also a UsernamePrincipal and the two UsernamePrincipals have the same name.

      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Parameters:
      o - Object to be compared for equality with this UsernamePrincipal.
      Returns:
      true if the specified Object is equal equal to this UsernamePrincipal.
    • hashCode

      public int hashCode()
      Return a hash code for this UsernamePrincipal.

      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this UsernamePrincipal.