Map LDAP Attributes to Drupal Fields
In this guide, we'll walk you through the process of mapping LDAP server attributes to Drupal fields,
ensuring a secure and seamless user authentication experience. Whether you're looking to map essential
attributes like 'uid,' 'mail,' and 'samaccountname' from LDAP to Drupal fields such as 'email,'
'firstname,' and ‘Lastname,' this guide is your go-to resource.
If you want to assign the Drupal role to the user based on their LDAP Groups or OU then you can refer to
the Role Mapping guide.
Setup Attribute Mapping in Drupal:
- After successfully configuring the module head towards the Attribute & Role Mapping
tab (admin/config/people/ldap_auth/attribute_mapping) of the module.
- From the Email Attribute dropdown select the LDAP attribute name under which your
LDAP user’s email address is stored. E.g., mail or userprincipalname.
- Select the desired LDAP Attribute Name and corresponding Drupal Field
Machine Name from the dropdown that you want to map.
- You can check out the user’s LDAP attribute name and its value on the right side.
- Click on the Save Attribute Mapping Configuration button to save the mapping. You
can refer to the below screenshot.
In the above screenshot, you can see that LDAP's givenname and cn
are mapped with Drupal’s name and
field_lastname user fields. When a user logs into the Drupal site using their LDAP
credentials, their LDAP 'givenname' and 'cn' values will be assigned to the Drupal 'name' and
How Does LDAP to Drupal Attribute Mapping Work?
Follow the below steps to check the LDAP to Drupal Attribute mapping.
- Open a browser private/incognito window and visit to Drupal login page.
- Enter the user’s LDAP credentials and click on the Log in button
- After a successful LDAP login, the user's Drupal name and lastName
will be updated with the LDAP
attributes givenname and cn as per our mapping. You can refer to
the below screenshot.
Congratulations, you have successfully configured Attribute mapping in Drupal LDAP.
If you want a 10-day fully-featured trial or have any questions or in case you need any sort of
assistance in setting up the module according to your use case, please feel free to drop us an email at