@Exported public final class UserPrincipal extends Object implements Principal, Serializable
After successful authentication, a user Principal
can be associated with a particular Subject
to augment that Subject
with an additional identity.
Authorization decisions can then be based upon the
Principal
s that are associated with a Subject
.
This class is immutable.
Constructor | Description |
---|---|
UserPrincipal(String name) |
Creates a principal.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object object) |
Compares this principal to the specified object.
|
String |
getName() |
Returns the name of this principal.
|
int |
hashCode() |
Returns a hash code for this principal.
|
String |
toString() |
Returns a string representation of this principal.
|
public UserPrincipal(String name)
name
- The principal's string name.NullPointerException
- If the name
is
null
.public boolean equals(Object object)
public int hashCode()
hashCode
in interface Principal
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String getName()
Copyright © 1998, 2025, Oracle and/or its affiliates. All rights reserved.