Skip to main content
Skip table of contents

Configure LDAP/Active Directory groups

In addition to being an authentication method, the LDAP/Active Directory integration can optionally also be used to retrieve additional attributes about the accounts authenticating: first name, last name, email address and group membership.

DCT only supports retrieving groups which are exposed as an attribute of the LDAP/Active Directory user record. DCT can not fetch groups membership from group records at the LDAP/Active Directory, and thus also does not support nested groups.

Group memberships are retrieved at authentication time, using the account credentials. DCT does not need credentials of an LDAP/Active Directory administrator, but will only be able to retrieve group memberships if LDAP/Active Directory users have the right to read the corresponding attribute.

This can be enabled by setting additional arguments to the domain API object.


The Context name in which to search. Being specific enables faster LDAP search.

To construct the search_base DN string according to your LDAP/Active Directory server, using an LDAP browser, navigate to a user, and then construct the search_base DN in reverse order from the User, up the folder hierarchy. For example: 

If a User DN is:


The corresponding search base might be:



Name of the attribute in the LDAP/Active Directory server containing email addresses.

Example: mail


Name of the attribute in the LDAP/Active Directory server containing last names

Example: sn


Name of the attribute in the LDAP/Active Directory server containing first names

Example: givenName


Name of the attribute in the LDAP/Active Directory server containing group(s) membership. This can be a multi-valued attribute.

Example: memberOf


Name of the attribute in the LDAP/Active Directory server of which value corresponds to the username provided to the DCT login requests.

For Active Directory, this is usually sAMAccountName.

Example: If the search base is CN=Users,DC=mycompany,DC=co and the search_attr is principalName, DCT will search for a record with a principalName matching the username provided to the login request under the CN=Users,DC=mycompany,DC=co sub tree.


Restricts search to records with an objectClass matching this value.

Example: person

Active Directory example

The following requests enable LDAP authentication over SSL with an Active Directory server at address, using the domain, and configures optional attributes to retrieve first name, last name, email address, and group membership from the users sub-tree.

curl --location --request PUT 'https://<hostname>/v2/management/ldap-config' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: apk <your API key>' \
--data-raw '{
 "enabled": true,
 "auto_create_users": true,
 "hostname": "",
 "enable_ssl": true,
 "port": 636,
   "email_attr": "mail",
   "first_name_attr": "givenName",
   "last_name_attr": "sn",
   "group_attr": "memberOf",
   "search_attr": "sAMAccountName"

With the above config, when a user logs in with username John, DCT will:

  1. Authenticate with the Active Directory server using the user principal name and supplied password.

  2. Search in the CN=Users,DC=mycompany,DC=co sub tree a record with objectClass=person and sAMAccountName=john.

  3. Create or update a DCT Account record with the attributes extracted from the Active Directory server.

  4. For each group membership found in the memberOf of the Active Directory server, an account tag is created with key=login_groups and value is the group name. These tags are protected (i.e cannot be modified within DCT) and can be securely used to control access groups membership.

As explained above, the ldap-config/validate API endpoint can be used to validate that each of the attributes corresponding to LDAP/Active Directory attributes.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.