public class UserPrincipal
extends java.lang.Object
implements java.security.Principal
UserPrincipal implements a Principal identity for a client user
identity that authenticates with a username and password. In other words, it
represents the user's login identity on the remote system.
UserPrincipal includes the username and optionally the host
information for which the username is used to authenticate.| Constructor and Description |
|---|
UserPrincipal(java.lang.String pUserName)
This constructor accepts the user name.
|
UserPrincipal(java.lang.String pUserName,
java.lang.String pHostName)
This constructor accepts the user name and host name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object pOtherPrincipal)
The
equals method checks if the specified object is the same
principal as this object. |
java.lang.String |
getHostName()
Return the host name associated with this principal.
|
java.lang.String |
getName()
Return the name of this principal identity; that is, return the login
name.
|
java.lang.String |
getUserName()
Return the principal's login user name.
|
int |
hashCode()
The
hashCode method returns an integer hash code to
represent this principal. |
java.lang.String |
toString()
The
toString method returns a string representation of the
principal suitable for displaying in messages. |
public UserPrincipal(java.lang.String pUserName)
throws java.lang.IllegalArgumentException
pUserName - The user login name.java.lang.IllegalArgumentException - If the null.public UserPrincipal(java.lang.String pUserName,
java.lang.String pHostName)
throws java.lang.IllegalArgumentException
pUserName - The user login name.pHostName - The host name for this principal.java.lang.IllegalArgumentException - If the pUserName is null.public boolean equals(java.lang.Object pOtherPrincipal)
equals method checks if the specified object is the same
principal as this object. The principals are equal if the specified
object is an instance of UserPrincipal and the user name and
authentication host name are the same.equals in interface java.security.Principalequals in class java.lang.ObjectpOtherPrincipal - Principal instance to compare for equality.true if the object are equal; false
otherwise.public java.lang.String getHostName()
public java.lang.String getName()
getName in interface java.security.PrincipalPrincipal.getName()public java.lang.String getUserName()
public int hashCode()
hashCode method returns an integer hash code to
represent this principal. It can be used to test for non-equality, or as
an index key in a hash table.hashCode in interface java.security.PrincipalhashCode in class java.lang.Objectpublic java.lang.String toString()
toString method returns a string representation of the
principal suitable for displaying in messages. It should not be used for
making authorization checks, however.toString in interface java.security.PrincipaltoString in class java.lang.ObjectCopyright © 2005, 2013 IBM Corporation. All Rights Reserved.