Home / Resources / Documentation / Tutorials / Mapping LDAP/CAS User Fields

Mapping User Fields with CAS and LDAP Modules

Note: Drupal 7 instructions only are given as most websites move away from Drupal 6.


Drupal 7 Setup

  1. Install and enable required modules.
    1. CAS – Only the CAS sub-module needs to be enabled.
    2. CAS Attributes – Both CAS Attribute Tokens and CAS LDAP Tokens must be enabled.
    3. LDAP – Only the LDAP Servers sub-module need to be enabled. Other LDAP sub-modules can be enabled if you need them later.
  2. Add an LDAP server.
    1. Navigate to admin/config/people/ldap/servers/add
    2. Set the field values to match those in the attached image called ldap-module-settings.png.
    3. Navigate to list of LDAP servers at admin/config/people/ldap/servers and click on the test link to test your settings.
    4. Navigate to the main LDAP settings page at admin/config/people/ldap and check the Require HTTPS On Credential Pages. This makes sure that any login pages are sent over HTTPS.
  3. Setup CAS module.
    1. Follow the instructions at https://drupal.asu.edu/build/cas-central-authentication-service to setup the CAS module.
  4. Setup CAS Attribute mapping to user fields.
    1. Navigate to admin/config/people/cas/attributes
    2. Set the field values to match those in the attached image called cas-attribute-module-settings.png.
    3. Map other LDAP attributes to your user fields as necessary by using the [cas:ldap:?] tokens (see a list of them at admin/config/people/cas/attributes/ldap).
    4. Do not set the Username and E-mail address fields as those user fields will automatically get populated by the CAS module when the user first logs in.
  5. Test your settings. Your setup is now complete. Test by clearing out your own user fields (first name, last name, etc.), logging out, and then logging back in. Your user should now have the fields you mapped populated with the data from the LDAP server.

A note about using rules

If you are using the rules module to check for user events (login, before save, after save, etc.), the events will not be triggered due to this issue (http://drupal.org/node/1420170). You can follow some of the suggestions given in the issue thread, mainly changing the weight of the cas module and triggering a rules event, but at your own risk.