Package org.ldaptive.auth
Class AbstractAuthenticationHandler
- java.lang.Object
-
- org.ldaptive.AbstractFreezable
-
- org.ldaptive.auth.AbstractAuthenticationHandler
-
- All Implemented Interfaces:
AuthenticationHandler
,ConnectionFactoryManager
,Freezable
- Direct Known Subclasses:
CompareAuthenticationHandler
,SimpleBindAuthenticationHandler
public abstract class AbstractAuthenticationHandler extends AbstractFreezable implements AuthenticationHandler, ConnectionFactoryManager
Base class for an LDAP authentication implementations.
-
-
Field Summary
Fields Modifier and Type Field Description private RequestControl[]
authenticationControls
controls used by this handler.private ConnectionFactory
factory
Connection factory.protected Logger
logger
Logger for this class.
-
Constructor Summary
Constructors Constructor Description AbstractAuthenticationHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AuthenticationHandlerResponse
authenticate(AuthenticationCriteria ac)
Perform an ldap authentication.protected abstract AuthenticationHandlerResponse
authenticateInternal(Connection c, AuthenticationCriteria criteria)
Authenticate on the supplied connection using the supplied criteria.void
freeze()
Freezes this object, making it immutable.RequestControl[]
getAuthenticationControls()
Returns the controls for this authentication handler.ConnectionFactory
getConnectionFactory()
Returns the connection factory.protected RequestControl[]
processRequestControls(AuthenticationCriteria criteria)
Combines request controls in theAuthenticationRequest
withauthenticationControls
.void
setAuthenticationControls(RequestControl... cntrls)
Sets the controls for this authentication handler.void
setConnectionFactory(ConnectionFactory cf)
Sets the connection factory.String
toString()
-
Methods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
factory
private ConnectionFactory factory
Connection factory.
-
authenticationControls
private RequestControl[] authenticationControls
controls used by this handler.
-
-
Method Detail
-
freeze
public void freeze()
Description copied from interface:Freezable
Freezes this object, making it immutable.- Specified by:
freeze
in interfaceFreezable
- Overrides:
freeze
in classAbstractFreezable
-
getConnectionFactory
public final ConnectionFactory getConnectionFactory()
Description copied from interface:ConnectionFactoryManager
Returns the connection factory.- Specified by:
getConnectionFactory
in interfaceConnectionFactoryManager
- Returns:
- connection factory
-
setConnectionFactory
public final void setConnectionFactory(ConnectionFactory cf)
Description copied from interface:ConnectionFactoryManager
Sets the connection factory.- Specified by:
setConnectionFactory
in interfaceConnectionFactoryManager
- Parameters:
cf
- connection factory
-
getAuthenticationControls
public final RequestControl[] getAuthenticationControls()
Returns the controls for this authentication handler.- Returns:
- controls
-
setAuthenticationControls
public final void setAuthenticationControls(RequestControl... cntrls)
Sets the controls for this authentication handler.- Parameters:
cntrls
- controls to set
-
authenticate
public AuthenticationHandlerResponse authenticate(AuthenticationCriteria ac) throws LdapException
Description copied from interface:AuthenticationHandler
Perform an ldap authentication.- Specified by:
authenticate
in interfaceAuthenticationHandler
- Parameters:
ac
- to perform the authentication with- Returns:
- authentication handler response
- Throws:
LdapException
- if ldap operation fails
-
authenticateInternal
protected abstract AuthenticationHandlerResponse authenticateInternal(Connection c, AuthenticationCriteria criteria) throws LdapException
Authenticate on the supplied connection using the supplied criteria.- Parameters:
c
- to authenticate oncriteria
- criteria to authenticate with- Returns:
- authentication handler response
- Throws:
LdapException
- if the authentication fails
-
processRequestControls
protected RequestControl[] processRequestControls(AuthenticationCriteria criteria)
Combines request controls in theAuthenticationRequest
withauthenticationControls
.- Parameters:
criteria
- containing request controls- Returns:
- combined request controls or null
-
-