org.apache.directory.server.core
Class LdapPrincipal

java.lang.Object
  extended by org.apache.directory.server.core.LdapPrincipal
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.security.Principal

public final class LdapPrincipal
extends java.lang.Object
implements java.security.Principal, java.lang.Cloneable, java.io.Externalizable

An alternative X500 user implementation that has access to the distinguished name of the principal as well as the String representation.

Version:
$Rev: 918766 $
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
static LdapPrincipal ANONYMOUS
          the no name anonymous user whose DN is the empty String
 
Constructor Summary
LdapPrincipal()
          Creates a principal for the no name anonymous user whose DN is the empty String.
LdapPrincipal(org.apache.directory.shared.ldap.name.DN name, org.apache.directory.shared.ldap.constants.AuthenticationLevel authenticationLevel)
          Creates a new LDAP/X500 principal without any group associations.
LdapPrincipal(org.apache.directory.shared.ldap.name.DN name, org.apache.directory.shared.ldap.constants.AuthenticationLevel authenticationLevel, byte[] userPassword)
          Creates a new LDAP/X500 principal without any group associations.
 
Method Summary
 java.lang.Object clone()
          Clone the object.
 org.apache.directory.shared.ldap.constants.AuthenticationLevel getAuthenticationLevel()
          Gets the authentication level associated with this LDAP principle.
 org.apache.directory.shared.ldap.name.DN getClonedName()
          Gets a cloned copy of the normalized distinguished name of this principal as a DN.
 java.lang.String getName()
          Returns the normalized distinguished name of the principal as a String.
 byte[] getUserPassword()
           
 void readExternal(java.io.ObjectInput in)
           
 void setUserPassword(byte[] userPassword)
           
 java.lang.String toString()
          Returns string representation of the normalized distinguished name of this principal.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode
 

Field Detail

ANONYMOUS

public static final LdapPrincipal ANONYMOUS
the no name anonymous user whose DN is the empty String

Constructor Detail

LdapPrincipal

public LdapPrincipal(org.apache.directory.shared.ldap.name.DN name,
                     org.apache.directory.shared.ldap.constants.AuthenticationLevel authenticationLevel)
Creates a new LDAP/X500 principal without any group associations. Keep this package friendly so only code in the package can create a trusted principal.

Parameters:
name - the normalized distinguished name of the principal
authenticationLevel - the authentication level for this principal

LdapPrincipal

public LdapPrincipal(org.apache.directory.shared.ldap.name.DN name,
                     org.apache.directory.shared.ldap.constants.AuthenticationLevel authenticationLevel,
                     byte[] userPassword)
Creates a new LDAP/X500 principal without any group associations. Keep this package friendly so only code in the package can create a trusted principal.

Parameters:
name - the normalized distinguished name of the principal
authenticationLevel - the authentication level for this principal
userPassword - The user password

LdapPrincipal

public LdapPrincipal()
Creates a principal for the no name anonymous user whose DN is the empty String.

Method Detail

getClonedName

public org.apache.directory.shared.ldap.name.DN getClonedName()
Gets a cloned copy of the normalized distinguished name of this principal as a DN.

Returns:
the cloned distinguished name of the principal as a DN

getName

public java.lang.String getName()
Returns the normalized distinguished name of the principal as a String.

Specified by:
getName in interface java.security.Principal

getAuthenticationLevel

public org.apache.directory.shared.ldap.constants.AuthenticationLevel getAuthenticationLevel()
Gets the authentication level associated with this LDAP principle.

Returns:
the authentication level

toString

public java.lang.String toString()
Returns string representation of the normalized distinguished name of this principal.

Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object

getUserPassword

public byte[] getUserPassword()

setUserPassword

public void setUserPassword(byte[] userPassword)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the object. This is done so that we don't store the password in a LdapPrincipal more than necessary.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The stream from which the LdapPrincipal is read
Throws:
java.io.IOException - If the stream can't be read
java.lang.ClassNotFoundException - If the LdapPrincipal can't be created
See Also:
Externalizable.readExternal(ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The stream in which the LdapPrincipal will be serialized. The password won't be written !
Throws:
java.io.IOException - If the serialization fail
See Also:
Externalizable#readExternal(ObjectInput)



Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.