AuthenticationHandler@Private @Evolving public class LdapAuthenticationHandler extends java.lang.Object implements AuthenticationHandler
LdapAuthenticationHandler implements the BASIC authentication
mechanism for HTTP using LDAP back-end.
The supported configuration properties are:
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
BASE_DN |
Constant for the configuration property that indicates the base
distinguished name (DN) to be used with the LDAP server.
|
static java.lang.String |
ENABLE_START_TLS |
Constant for the configuration property that indicates whether
the LDAP server supports 'StartTLS' extension.
|
static java.lang.String |
LDAP_BIND_DOMAIN |
Constant for the configuration property that indicates the LDAP bind
domain value to be used with the LDAP server.
|
static java.lang.String |
PROVIDER_URL |
Constant for the configuration property that indicates the url of the LDAP
server.
|
static java.lang.String |
SECURITY_AUTHENTICATION |
Constant that identifies the authentication mechanism to be used with the
LDAP server.
|
static java.lang.String |
TYPE |
Constant that identifies the authentication mechanism.
|
WWW_AUTHENTICATE| Constructor | Description |
|---|---|
LdapAuthenticationHandler() |
| Modifier and Type | Method | Description |
|---|---|---|
AuthenticationToken |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
Performs an authentication step for the given HTTP client request.
|
void |
destroy() |
Destroys the authentication handler instance.
|
java.lang.String |
getType() |
Returns the authentication type of the authentication handler.
|
void |
init(java.util.Properties config) |
Initializes the authentication handler instance.
|
boolean |
managementOperation(AuthenticationToken token,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
Performs an authentication management operation.
|
void |
setDisableHostNameVerification(java.lang.Boolean disableHostNameVerification) |
Configure the Host name verification for this handler.
|
void |
setEnableStartTls(java.lang.Boolean enableStartTls) |
Configure StartTLS LDAP extension for this handler.
|
public static final java.lang.String TYPE
public static final java.lang.String SECURITY_AUTHENTICATION
public static final java.lang.String PROVIDER_URL
public static final java.lang.String BASE_DN
public static final java.lang.String LDAP_BIND_DOMAIN
public static final java.lang.String ENABLE_START_TLS
@VisibleForTesting public void setEnableStartTls(java.lang.Boolean enableStartTls)
enableStartTls - true If the StartTLS LDAP extension is to be enabled
false otherwise@VisibleForTesting public void setDisableHostNameVerification(java.lang.Boolean disableHostNameVerification)
disableHostNameVerification - true to disable host-name verification
false otherwisepublic java.lang.String getType()
AuthenticationHandlergetType in interface AuthenticationHandlerpublic void init(java.util.Properties config)
throws javax.servlet.ServletException
AuthenticationHandler
This method is invoked by the AuthenticationFilter.init(javax.servlet.FilterConfig) method.
init in interface AuthenticationHandlerconfig - configuration properties to initialize the handler.javax.servlet.ServletException - thrown if the handler could not be initialized.public void destroy()
AuthenticationHandler
This method is invoked by the AuthenticationFilter.destroy() method.
destroy in interface AuthenticationHandlerpublic boolean managementOperation(AuthenticationToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, AuthenticationException
AuthenticationHandlerThis is useful for handling operations like get/renew/cancel delegation tokens which are being handled as operations of the service end-point.
If the method returns TRUE the request will continue normal
processing, this means the method has not produced any HTTP response.
If the method returns FALSE the request will end, this means
the method has produced the corresponding HTTP response.
managementOperation in interface AuthenticationHandlertoken - the authentication token if any, otherwise NULL.request - the HTTP client request.response - the HTTP client response.TRUE if the request should be processed as a regular
request,
FALSE otherwise.java.io.IOException - thrown if an IO error occurred.AuthenticationException - thrown if an Authentication error occurred.public AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, AuthenticationException
AuthenticationHandler
This method is invoked by the AuthenticationFilter only if the HTTP client request is
not yet authenticated.
Depending upon the authentication mechanism being implemented, a particular HTTP client may end up making a sequence of invocations before authentication is successfully established (this is the case of Kerberos SPNEGO).
This method must return an AuthenticationToken only if the the HTTP client request has
been successfully and fully authenticated.
If the HTTP client request has not been completely authenticated, this method must take over
the corresponding HTTP response and it must return null.
authenticate in interface AuthenticationHandlerrequest - the HTTP client request.response - the HTTP client response.AuthenticationToken if the HTTP client request has been authenticated,
null otherwise (in this case it must take care of the response).java.io.IOException - thrown if an IO error occurred.AuthenticationException - thrown if an Authentication error occurred.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.