- java.lang.Object
-
- com.sun.security.auth.UnixPrincipal
-
- All Implemented Interfaces:
Serializable
,Principal
public class UnixPrincipal extends Object implements Principal, Serializable
This class implements thePrincipal
interface and represents a Unix user.Principals such as this
UnixPrincipal
may be associated with a particularSubject
to augment thatSubject
with an additional identity. Refer to theSubject
class for more information on how to achieve this. Authorization decisions can then be based upon the Principals associated with aSubject
.- See Also:
Principal
,Subject
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UnixPrincipal(String name)
Create a UnixPrincipal with a Unix username.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Compares the specified Object with thisUnixPrincipal
for equality.String
getName()
Return the Unix username for thisUnixPrincipal
.int
hashCode()
Return a hash code for thisUnixPrincipal
.String
toString()
Return a string representation of thisUnixPrincipal
.
-
-
-
Constructor Detail
UnixPrincipal
public UnixPrincipal(String name)
Create a UnixPrincipal with a Unix username.- Parameters:
name
- the Unix username for this user.- Throws:
NullPointerException
- if thename
isnull
.
-
Method Detail
getName
public String getName()
Return the Unix username for thisUnixPrincipal
.
toString
public String toString()
Return a string representation of thisUnixPrincipal
.
equals
public boolean equals(Object o)
Compares the specified Object with thisUnixPrincipal
for equality. Returns true if the given object is also aUnixPrincipal
and the two UnixPrincipals have the same username.
hashCode
public int hashCode()
Return a hash code for thisUnixPrincipal
.- Specified by:
hashCode
in interfacePrincipal
- Overrides:
hashCode
in classObject
- Returns:
-
a hash code for this
UnixPrincipal
. - See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-