javax.wbem.client
Class UserPrincipal

java.lang.Object
  extended by javax.wbem.client.UserPrincipal
All Implemented Interfaces:
Principal

public class UserPrincipal
extends Object
implements Principal

This class implements a Java security Principal identity for a client user identity that authenticates with a Unix username and login password. That is, it represents the user's login identity on the remote server system which is running the CIMOM.


Constructor Summary
UserPrincipal(String userName)
          This constructor accepts the user name.
UserPrincipal(String userName, String hostName)
          This constructor accepts the user name and host name.
 
Method Summary
 boolean equals(Object otherPrincipal)
          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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserPrincipal

public UserPrincipal(String userName)
              throws IllegalArgumentException
This constructor accepts the user name.

Parameters:
userName - - The user login name.
Throws:
IllegalArgumentException - - If the userName is null.

UserPrincipal

public UserPrincipal(String userName,
                     String hostName)
              throws IllegalArgumentException
This constructor accepts the user name and host name.

Parameters:
userName - - The user login name.
hostName - - The host name.
Throws:
IllegalArgumentException - - If the userName is null.
Method Detail

equals

public boolean equals(Object otherPrincipal)
The 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.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
otherPrincipal - - Principal instance to compare for equality.
Returns:
true if the object are equal; false otherwise.
See Also:
Object.equals(java.lang.Object)

getHostName

public String getHostName()
Return the host name associated with this principal.

Returns:
The hostname.

getName

public String getName()
Return the name of this principal identity; that is, return the login name.

Specified by:
getName in interface Principal
Returns:
The name of this principal identity.
See Also:
Principal.getName()

getUserName

public String getUserName()
Return the principal's login user name.

Returns:
The user login name.

hashCode

public int hashCode()
The 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.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
An integer hash code representing the principal.
See Also:
Object.hashCode()

toString

public String toString()
The toString 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 interface Principal
Overrides:
toString in class Object
Returns:
A printable string form of the principal identity.
See Also:
Object.toString()


Copyright © 2005, 2009 IBM Corporation. All Rights Reserved.