APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.security.auth

public final Class LdapPrincipal

extends Object
implements Principal, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.security.Principal
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, java.security.Principal, javax.naming.InvalidNameException, javax.naming.ldap.LdapName

A principal identified by a distinguished name as specified by RFC 2253.

After successful authentication, a user java.security.Principal can be associated with a particular javax.security.auth.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.

Since
1.6

Field Summary

Modifier and TypeField and Description
private final LdapName
name

The principal's name

private final String
nameString

The principal's string name

private static final long

Constructor Summary

AccessConstructor and Description
public
LdapPrincipal(String
The principal's string distinguished name.
name
)

Creates an LDAP principal.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if they are equal; false otherwise.
equals
(Object
The object to compare this principal against.
object
)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Compares this principal to the specified object.

private LdapName
public String

Returns:

The principal's string name.
getName
()

Implements java.security.Principal.getName.

Returns the name originally used to create this principal.

public int

Returns:

The principal's hash code.
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Computes the hash code for this principal.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Restores the state of this object from the stream.

public String

Returns:

The principal's string name.
toString
()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Creates a string representation of this principal's name in the format defined by RFC 2253.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private final LdapName name

The principal's name

nameStringback to summary
private final String nameString

The principal's string name

serialVersionUIDback to summary
private static final long serialVersionUID
Annotations
@Serial

Constructor Detail

LdapPrincipalback to summary
public LdapPrincipal(String name) throws InvalidNameException

Creates an LDAP principal.

Parameters
name:String

The principal's string distinguished name.

Exceptions
InvalidNameException:
If a syntax violation is detected.
NullPointerException:
If the name is null.

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Compares this principal to the specified object.

Parameters
object:Object

The object to compare this principal against.

Returns:boolean

true if they are equal; false otherwise.

getLdapNameback to summary
private LdapName getLdapName(String name) throws InvalidNameException
getNameback to summary
public String getName()

Implements java.security.Principal.getName.

Returns the name originally used to create this principal.

Returns:String

The principal's string name.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Computes the hash code for this principal.

Returns:int

The principal's hash code.

readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Restores the state of this object from the stream.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Creates a string representation of this principal's name in the format defined by RFC 2253. If the name has zero components an empty string is returned.

Returns:String

The principal's string name.