org.apache.directory.server.core.authn
Class AbstractAuthenticator

java.lang.Object
  extended byorg.apache.directory.server.core.authn.AbstractAuthenticator
All Implemented Interfaces:
Authenticator
Direct Known Subclasses:
AnonymousAuthenticator, SimpleAuthenticator

public abstract class AbstractAuthenticator
extends java.lang.Object
implements Authenticator

Base class for all Authenticators.

Version:
$Rev: 434579 $, $Date: 2006-08-25 02:19:11 +0200 (Fri, 25 Aug 2006) $
Author:
Apache Directory Project

Constructor Summary
protected AbstractAuthenticator(java.lang.String type)
          Creates a new instance.
 
Method Summary
abstract  LdapPrincipal authenticate(LdapDN bindDn, ServerContext ctx)
          Performs authentication and returns the principal if succeeded.
protected static LdapPrincipal createLdapPrincipal(java.lang.String name, AuthenticationLevel authenticationLeve)
          Returns a new LdapPrincipal instance whose value is the specified name.
 void destroy()
          Calls doDestroy() method, and clears default properties (factoryConfiguration and configuration).
protected  void doDestroy()
          Implement your deinitialization code here.
protected  void doInit()
          Implement your initialization code here.
 java.lang.String getAuthenticatorType()
          Returns the type of this authenticator (e.g.
 AuthenticatorConfiguration getConfiguration()
          Returns the configuration of this authenticator.
 DirectoryServiceConfiguration getFactoryConfiguration()
          Returns DirectoryServiceConfiguration of InitialContextFactory which initialized this authenticator.
 void init(DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg)
          Initializes default properties (factoryConfiguration and configuration, and calls doInit() method.
 void invalidateCache(LdapDN bindDn)
          Does nothing leaving it so subclasses can override.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAuthenticator

protected AbstractAuthenticator(java.lang.String type)
Creates a new instance.

Parameters:
type - the type of this authenticator (e.g. 'simple', 'none'...)
Method Detail

getFactoryConfiguration

public DirectoryServiceConfiguration getFactoryConfiguration()
Returns DirectoryServiceConfiguration of InitialContextFactory which initialized this authenticator.


getConfiguration

public AuthenticatorConfiguration getConfiguration()
Returns the configuration of this authenticator.


getAuthenticatorType

public java.lang.String getAuthenticatorType()
Description copied from interface: Authenticator
Returns the type of this authenticator (e.g. 'simple', 'none',...).

Specified by:
getAuthenticatorType in interface Authenticator

init

public final void init(DirectoryServiceConfiguration factoryCfg,
                       AuthenticatorConfiguration cfg)
                throws javax.naming.NamingException
Initializes default properties (factoryConfiguration and configuration, and calls doInit() method. Please put your initialization code into doInit().

Specified by:
init in interface Authenticator
Throws:
javax.naming.NamingException

doInit

protected void doInit()
               throws javax.naming.NamingException
Implement your initialization code here.

Throws:
javax.naming.NamingException

destroy

public final void destroy()
Calls doDestroy() method, and clears default properties (factoryConfiguration and configuration). Please put your deinitialization code into doDestroy().

Specified by:
destroy in interface Authenticator

doDestroy

protected void doDestroy()
Implement your deinitialization code here.


authenticate

public abstract LdapPrincipal authenticate(LdapDN bindDn,
                                           ServerContext ctx)
                                    throws javax.naming.NamingException
Description copied from interface: Authenticator
Performs authentication and returns the principal if succeeded.

Specified by:
authenticate in interface Authenticator
Throws:
javax.naming.NamingException

invalidateCache

public void invalidateCache(LdapDN bindDn)
Does nothing leaving it so subclasses can override.

Specified by:
invalidateCache in interface Authenticator
Parameters:
bindDn - the already normalized distinguished name of the bind principal

createLdapPrincipal

protected static LdapPrincipal createLdapPrincipal(java.lang.String name,
                                                   AuthenticationLevel authenticationLeve)
                                            throws javax.naming.NamingException
Returns a new LdapPrincipal instance whose value is the specified name.

Parameters:
name - the distinguished name of the X.500 principal
authenticationLeve -
Returns:
the principal for the name
Throws:
javax.naming.NamingException - if there is a problem parsing name