public class UserPrincipal extends Object implements 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(String pUserName)
This constructor accepts the user name.
|
UserPrincipal(String pUserName,
String pHostName)
This constructor accepts the user name and host name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object pOtherPrincipal)
The
equals method checks if the specified object is the same
principal as this object. |
String |
getHostName()
Return the host name associated with this principal.
|
String |
getName()
Return the name of this principal identity; that is, return the login
name.
|
String |
getUserName()
Return the principal's login user name.
|
int |
hashCode()
The
hashCode method returns an integer hash code to
represent this principal. |
String |
toString()
The
toString method returns a string representation of the
principal suitable for displaying in messages. |
public UserPrincipal(String pUserName) throws IllegalArgumentException
pUserName
- The user login name.IllegalArgumentException
- If the null
.public UserPrincipal(String pUserName, String pHostName) throws IllegalArgumentException
pUserName
- The user login name.pHostName
- The host name for this principal.IllegalArgumentException
- If the pUserName
is null
.public boolean equals(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.public String getHostName()
public String getName()
getName
in interface Principal
Principal.getName()
public 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.public 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.Copyright © 2005, 2012 IBM Corporation. All Rights Reserved.