Skip to main content

LDAP/AD

Learn how to configure IntelliAsk to use LDAP for user authentication.

You can use a Lightweight Directory Access Protocol (LDAP) authentication server to authenticate users.

LDAP sign-in requires non-empty string values for both the login identifier (email in the request body, including username-based deployments) and password. Missing, empty, or non-string values return 400 with Invalid credentials before contacting the LDAP authentication provider. No configuration change is required.

LDAP/AD Server Configuration

Basic Configuration

  • LDAP_URL and LDAP_USER_SEARCH_BASE are required.
  • LDAP_SEARCH_FILTER is optional; if not specified, the mail attribute is used by default. If specified, use the literal {{username}} to use the given username for the search.
KeyTypeDescriptionExample
LDAP_URLstringLDAP server URL.LDAP_URL=ldap://localhost:389
LDAP_BIND_DNstringBind DNLDAP_BIND_DN=cn=root
LDAP_BIND_CREDENTIALSstringPassword for bindDNLDAP_BIND_CREDENTIALS=password
LDAP_USER_SEARCH_BASEstringLDAP user search baseLDAP_USER_SEARCH_BASE=o=users,o=example.com
LDAP_SEARCH_FILTERstringLDAP search filterLDAP_SEARCH_FILTER=mail={{username}}

Field Mappings

You can specify a mapping between the attributes of IntelliAsk users and those of LDAP users. Use these settings if the default mappings do not work properly.

KeyTypeDescriptionExample
LDAP_IDstringSpecify a unique user ID. By default, uid or sAMAccountName, mail is used.LDAP_ID=uid
LDAP_USERNAMEstringBy default, it uses givenName or mail.LDAP_USERNAME=givenName
LDAP_EMAILstringBy default, it uses mail.LDAP_EMAIL=userPrincipalName
LDAP_FULL_NAMEstringBy default, it uses a combination of givenName and surname.LDAP_FULL_NAME=givenName,surname

Username or Email

By default, IntelliAsk uses an email address and password for authentication. This may sometimes cause problem with LDAP and you may want to use a username instead. Set the LDAP_SEARCH_FILTER to filter for the username instead (e.g. LDAP_SEARCH_FILTER=uid={{username}} and configure IntelliAsk to request login via username:

KeyTypeDescriptionExample
LDAP_LOGIN_USES_USERNAMEbooleanUse username instead of email.LDAP_LOGIN_USES_USERNAME=true

Active Directory over SSL

To connect via SSL (ldaps://), such as a company using Windows AD, specify the path to the internal CA certificate with LDAP_CA_CERT_PATH.

LDAP_TLS_REJECT_UNAUTHORIZED is only applied when LDAP_CA_CERT_PATH is set. In that case, certificate verification is off unless you explicitly set LDAP_TLS_REJECT_UNAUTHORIZED=true. When LDAP_CA_CERT_PATH is not set, IntelliAsk passes no TLS options and the default Node.js behavior applies (the server certificate is checked against the system trust store).

Enable certificate verification

If you set LDAP_CA_CERT_PATH without LDAP_TLS_REJECT_UNAUTHORIZED=true, IntelliAsk trusts any certificate presented by the LDAP server, which exposes bind credentials and user passwords to man-in-the-middle attacks. Always set LDAP_TLS_REJECT_UNAUTHORIZED=true in production.

KeyTypeDescriptionExample
LDAP_CA_CERT_PATHstringCA certificate path.LDAP_CA_CERT_PATH=/path/to/root_ca_cert.crt
LDAP_TLS_REJECT_UNAUTHORIZEDbooleanVerify the LDAP server certificate against LDAP_CA_CERT_PATH. Must be true to enable verification; ignored when LDAP_CA_CERT_PATH is not set.LDAP_TLS_REJECT_UNAUTHORIZED=true

LDAP StartTLS

Enabling LDAP StartTLS allows IntelliAsk to upgrade an insecure connection to a secure TLS connection. This is useful if you want to secure the connection without switching to ldaps://.

KeyTypeDescriptionExample
LDAP_STARTTLSbooleanEnable LDAP StartTLS for upgrading the connection to TLS. Set to true to enable this feature.LDAP_STARTTLS=true

Last updated on