Attribute Mapping
The attribute mapping feature allows linking user attributes received from an OAuth or OpenID Connect Provider to Drupal user fields. Upon a successful Single Sign-On, the values from the mapped attributes are assigned to their corresponding Drupal fields.
Configure Attribute Mapping (Mandatory)
Watch how to configure Attribute Mappings: ▶ Watch Setup Video
- Once you have configured the OAuth or OIDC Provider successfully, you can click on the Test Configuration button to verify if the configurations are correct or not.
- If all the configurations are correct, you will receive a list of attributes from OAuth or OIDC Provider.
- After successfully performing the Test connection, you will be redirected to the Attribute Mapping tab by clicking on the Configure Mappings on the Test configuration pop-up. You will be redirect to the Attribute Mapping section under the Edit tab.
- On the right section, you will be able to see the complete list of the attributes received from OAuth or OIDC Provider.
- In the Select Field for SSO Login section, choose the OAuth provider attribute you are receiving and map it to the corresponding Drupal Attribute Machine Name to be used for SSO login.
- After that click Save button.
Advance Attribute Mapping
The Attribute Mapping allows you to map any additional user information received from the OAuth or OIDC Provider to the user profile attributes in Drupal. This feature helps you to sync any user information other than Username and Email when the user performs SSO. In order to configure the Custom Attribute Mapping, we need to create a few user fields first.
Add User field in the Drupal site
- For example, we will create 1 field - First name.
- Navigate to the People → Account Settings.
- After that, go to the Manage Fields tab and click on the Create New Field button.
- Select the Plain text field type in the Choose a type of field pop-up.
- In the Label text field, enter First Name. Drupal will automatically generate the machine name using the text that you have put in the text field.
- Click the Continue button.
- Enter the Maximum length and Allowed number of values.
- If you want to make mandatory field, then check the check box of the Required field.
- Similarly, check the check box of Set default value to set default value for this field and enter the value in the text field.
- Click on the Save button.
Configure Advance Attribute Mapping
- In the Attribute Mapping tab, scroll down to the Attribute Mapping section.
- Under the OAuth Server Attribute drop-down, select the attribute in which you have received the First Name of the user. In our example, we are receiving the First name of the user under the name attribute. So we will select the name attribute from the drop-down.
- Now, from the Drupal Machine Name drop-down, select the machine name of the First name field that we created earlier.
- Now, if you want to map multiple user attributes, add the no of rows in the textfield next to Add button and then click Add button.
- Once you have mapped all the required fields as per your use case, scroll down and click on the Save button.
Let’s see how this works
- Open a new incognito window and go to your Drupal site's login page.
- Click on the Login using the Provider link to initiate the SSO.
- Once you are logged in to the Drupal site successfully, navigate to the My Accountaccount link.
- You will be able to see that the user's First name and Last name will be mapped to Drupal's respective fields.