public final class

UserPrincipal

extends Object
implements Serializable Principal
java.lang.Object
   ↳ com.sun.security.auth.UserPrincipal

Class Overview

A user principal identified by a username or account name.

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 Principals that are associated with a Subject.

This class is immutable.

Summary

Public Constructors
UserPrincipal(String name)
Creates a principal.
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.security.Principal

Public Constructors

public UserPrincipal (String name)

Creates a principal.

Parameters
name The principal's string name.
Throws
NullPointerException If the name is null.

Public Methods

public boolean equals (Object object)

Compares this principal to the specified object.

Parameters
object The object to compare this principal against.
Returns
  • true if they are equal; false otherwise.

public String getName ()

Returns the name of this principal.

Returns
  • The principal's name.

public int hashCode ()

Returns a hash code for this principal.

Returns
  • The principal's hash code.

public String toString ()

Returns a string representation of this principal.

Returns
  • The principal's name.