com.sun.wbem.client
Class SolarisUserPrincipal

java.lang.Object
  |
  +--com.sun.wbem.security.UserPrincipal
        |
        +--com.sun.wbem.client.SolarisUserPrincipal

public class SolarisUserPrincipal
extends com.sun.wbem.security.UserPrincipal

This class implements a Java security Principal identity for a client user identity that authenticates with a Solaris username and login password. An optional Solaris role name may be specified.

Since:
WBEM 2.0
See Also:
Serialized Form

Constructor Summary
SolarisUserPrincipal()
          Empty constructor.
SolarisUserPrincipal(java.lang.String userName)
          This constructor accepts the Solaris user name.
SolarisUserPrincipal(java.lang.String userName, java.lang.String roleName)
          This constructor accepts the Solaris user name and the Solaris role name that the user will assume.
 
Method Summary
 boolean equals(java.lang.Object otherPrincipal)
          The equals method checks if the specified object is the same principal as this object.
 java.lang.String getName()
          Return the name of this principal identity.
 java.lang.String getRoleName()
          Return the Solaris role name this principal is assuming.
 int hashCode()
          The hashCode method returns an integer hash code to represent this principal.
 boolean isRoleAssumed()
          Returns true if a role has been assumed.
 void setRoleName(java.lang.String roleName)
          Set the Solaris role name this principal will assume when authenticated to a Solaris server.
 java.lang.String toString()
          The toString method returns a string representation of the principal suitable for displaying in messages.
 
Methods inherited from class com.sun.wbem.security.UserPrincipal
getHostName, getUserName, setHostName, setUserName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SolarisUserPrincipal

public SolarisUserPrincipal()
Empty constructor.

SolarisUserPrincipal

public SolarisUserPrincipal(java.lang.String userName)
This constructor accepts the Solaris user name.
Parameters:
userName - The Solaris user login name.

SolarisUserPrincipal

public SolarisUserPrincipal(java.lang.String userName,
                            java.lang.String roleName)
This constructor accepts the Solaris user name and the Solaris role name that the user will assume.
Parameters:
userName - The Solaris user login name.
roleName - The name of the Solaris role to be assumed.
Method Detail

getName

public java.lang.String getName()
Return the name of this principal identity. The user name is returned, even if a role name is being assumed.
Overrides:
getName in class com.sun.wbem.security.UserPrincipal
Returns:
The name of this principal identity.

equals

public boolean equals(java.lang.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 SolarisUserPrincipal and the user name, role name, and authentication host name are the same.
Overrides:
equals in class com.sun.wbem.security.UserPrincipal
Parameters:
otherPrincipal - Principal instance to compare for equality
Returns:
The name of this principal identity.

toString

public java.lang.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. The format of the returned string is "user (as role) @ host".
Overrides:
toString in class com.sun.wbem.security.UserPrincipal
Returns:
A printable string form of the principal identity.

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.
Overrides:
hashCode in class com.sun.wbem.security.UserPrincipal
Returns:
An integer hash code representing the principal.

getRoleName

public java.lang.String getRoleName()
Return the Solaris role name this principal is assuming.
Returns:
The Solaris role name.

isRoleAssumed

public boolean isRoleAssumed()
Returns true if a role has been assumed.

setRoleName

public void setRoleName(java.lang.String roleName)
Set the Solaris role name this principal will assume when authenticated to a Solaris server.
Parameters:
roleName - The Solaris role name.