- java.lang.Object
-
- com.ibm.security.auth.UsernamePrincipal
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.Principal
public class UsernamePrincipal extends java.lang.Object implements java.security.Principal, java.io.Serializable
This class implements the
Principal
interface and represents an OS/390 user.Principals such as this
UsernamePrincipal
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 on the Principals associated with aSubject
.- See Also:
Principal
,Subject
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UsernamePrincipal(java.lang.String name)
Create anUsernamePrincipal
with an OS/390 username.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Compares the specified Object with thisUsernamePrincipal
for equality.java.lang.String
getName()
Return the OS/390 username for thisUsernamePrincipal
.int
hashCode()
Return a hash code for thisUsernamePrincipal
.java.lang.String
toString()
Return a string representation of thisUsernamePrincipal
.
-
-
-
Constructor Detail
-
UsernamePrincipal
public UsernamePrincipal(java.lang.String name)
Create anUsernamePrincipal
with an OS/390 username.- Parameters:
name
- the OS/390 username for this user.- Throws:
java.lang.NullPointerException
- if thename
isnull
.java.lang.RuntimeException
- if thename
has zero length.
-
-
Method Detail
-
getName
public java.lang.String getName()
Return the OS/390 username for thisUsernamePrincipal
.- Specified by:
getName
in interfacejava.security.Principal
- Returns:
- the OS/390 username for this
UsernamePrincipal
.
-
toString
public java.lang.String toString()
Return a string representation of thisUsernamePrincipal
.- Specified by:
toString
in interfacejava.security.Principal
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
UsernamePrincipal
.
-
equals
public boolean equals(java.lang.Object o)
Compares the specified Object with thisUsernamePrincipal
for equality. Returns true if the given object is also aUsernamePrincipal
and the two UsernamePrincipals have the same name.- Specified by:
equals
in interfacejava.security.Principal
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- Object to be compared for equality with thisUsernamePrincipal
.- Returns:
- true if the specified Object is equal equal to this
UsernamePrincipal
.
-
hashCode
public int hashCode()
Return a hash code for thisUsernamePrincipal
.- Specified by:
hashCode
in interfacejava.security.Principal
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this
UsernamePrincipal
.
-
-