LDAP Auth Configuration
The ldap-auth plugin verifies HTTP Basic credentials with an LDAP directory and maps the authenticated directory user to an API consumer. Configuration covers credential fields and route and service fields.
Parameters
See plugin common configurations for configuration options available to all plugins.
Credentials
The following attributes configure LDAP Auth on a consumer.
user_dn
Distinguished name of the LDAP entry represented by the consumer, such as
uid=johndoe,ou=users,dc=example,dc=org. It must match the DN used for the successful directory bind.API7 Gateway 3.10.6 and APISIX 3.18.0 introduced RFC 4514 escaping when constructing the bind DN. If the user name contains structural characters, configure
user_dnwith the matching escaped DN. API7 Gateway 3.9 does not escape these characters.Supports an environment variable reference with the
$env://prefix or a secret-manager reference with the$secret://prefix. See environment variables in plugins and secrets.
Routes or Services
The following attributes configure LDAP Auth on routes or services.
base_dn
Base distinguished name appended to the user name when the plugin constructs the bind DN, such as
ou=users,dc=example,dc=org.ldap_uri
LDAP directory address as
hostorhost:port. The default port is389when omitted.use_tls
If true, connect to the directory over LDAPS. This field does not enable StartTLS.
tls_verify
If true, verify the directory certificate when
use_tlsis enabled. Configure the gateway trust bundle so that it trusts the issuing CA and use a directory host name covered by the certificate.uid
LDAP attribute placed before the client-supplied user name when constructing the bind DN. For example,
uidproducesuid=johndoe,<base_dn>.hide_credentials
If true, remove the
Authorizationheader after authentication so the directory password is not forwarded upstream.Introduced in API7 Gateway 3.10.6 and APISIX 3.18.0. API7 Gateway 3.9 does not support this field and forwards the header upstream.
realm
valid value:
between 1 and 128 printable ASCII characters, excluding double quotes and backslashesRealm included in the
WWW-Authenticatechallenge returned with an authentication failure.