Package javax.wbem.client
Class UserPrincipal
- java.lang.Object
-
- javax.wbem.client.UserPrincipal
-
- All Implemented Interfaces:
java.security.Principal
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 Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object pOtherPrincipal)
Theequals
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()
ThehashCode
method returns an integer hash code to represent this principal.java.lang.String
toString()
ThetoString
method returns a string representation of the principal suitable for displaying in messages.
-
-
-
Constructor Detail
-
UserPrincipal
public UserPrincipal(java.lang.String pUserName) throws java.lang.IllegalArgumentException
This constructor accepts the user name.- Parameters:
pUserName
- The user login name.- Throws:
java.lang.IllegalArgumentException
- If theis null
.
-
UserPrincipal
public UserPrincipal(java.lang.String pUserName, java.lang.String pHostName) throws java.lang.IllegalArgumentException
This constructor accepts the user name and host name.- Parameters:
pUserName
- The user login name.pHostName
- The host name for this principal.- Throws:
java.lang.IllegalArgumentException
- If thepUserName
isnull
.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object pOtherPrincipal)
Theequals
method checks if the specified object is the same principal as this object. The principals are equal if the specified object is an instance ofUserPrincipal
and the user name and authentication host name are the same.- Specified by:
equals
in interfacejava.security.Principal
- Overrides:
equals
in classjava.lang.Object
- Parameters:
pOtherPrincipal
-Principal
instance to compare for equality.- Returns:
true
if the object are equal;false
otherwise.
-
getHostName
public java.lang.String getHostName()
Return the host name associated with this principal.- Returns:
- The host name.
-
getName
public java.lang.String getName()
Return the name of this principal identity; that is, return the login name.- Specified by:
getName
in interfacejava.security.Principal
- Returns:
- The name of this principal identity.
- See Also:
Principal.getName()
-
getUserName
public java.lang.String getUserName()
Return the principal's login user name.- Returns:
- The user login name.
-
hashCode
public int hashCode()
ThehashCode
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.- Specified by:
hashCode
in interfacejava.security.Principal
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- An integer hash code representing the principal.
-
toString
public java.lang.String toString()
ThetoString
method returns a string representation of the principal suitable for displaying in messages. It should not be used for making authorization checks, however.- Specified by:
toString
in interfacejava.security.Principal
- Overrides:
toString
in classjava.lang.Object
- Returns:
- A printable string form of the principal identity.
-
-