com.ibm.security.auth
Class UsernamePrincipal

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

public class UsernamePrincipal
extends JAASPrincipal

This class extends the JAASPrincipal class and represents the username provided when logging onto a system or server.

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 upon the Principals associated with a Subject.

Author:
D. Kent Soper, Andrew Gotte
See Also:
Principal, Subject, Serialized Form

Constructor Summary
UsernamePrincipal(java.lang.String name)
          Create an UsernamePrincipal with a provided username.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified Object with this UsernamePrincipal for equality.
 java.lang.String toString()
          Return a string representation of this UsernamePrincipal.
 
Methods inherited from class com.ibm.security.auth.JAASPrincipal
getName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UsernamePrincipal

public UsernamePrincipal(java.lang.String name)
Create an UsernamePrincipal with a provided username.

Parameters:
name - the provided username for this user.
Throws:
java.lang.NullPointerException - if the name is null.
java.lang.IllegalArgumentException - if the name has zero length.
Method Detail

toString

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

Specified by:
toString in interface java.security.Principal
Overrides:
toString in class JAASPrincipal
Returns:
a string representation of this UsernamePrincipal.

equals

public boolean equals(java.lang.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 java.security.Principal
Overrides:
equals in class JAASPrincipal
Parameters:
o - Object to be compared for equality with this UsernamePrincipal.
Returns:
true if the specified Object is equal to this UsernamePrincipal.