SAML Single Sign-On (SSO) into Drupal using Google Apps as IdP
Overview
The Drupal SAML integration using the miniOrange SAML SP module establishes seamless SSO between Google Apps and the Drupal site. The users will be able to log in to the Drupal site using their Google Apps credentials. This document will walk you through the steps to configure Single Sign-On - SSO between Drupal as a Service Provider (SP) and Google Apps as an Identity Provider (IdP). The module is compatible with with Drupal 7, Drupal 8, Drupal 9, Drupal 10 and Drupal 11.
Installation Steps
- Using Composer
- Using Drush
- Manual Installation
Configuration Steps
Drupal SAML SP Metadata
- Go to Configuration → People → SAML Login Configuration in the Administration menu. (/admin/config/people/miniorange_saml/idp_setup)
- Navigate to the Service Provider Metadata and copy the metadata URL. (This is required in configuring the Google Apps as a SAML IdP)
Configure SAML Single Sign-On Application in Google Apps
- Login into your G-Suite Administration account.
- Navigate to the Apps from the left panel and click on Web and mobile apps.
- Click on the Add app, and select the Add custom SAML app from the dropdown.
- Enter the App name and Description (optional). Click on the CONTINUE.
- Click on the DOWNLOAD METADATA button. Keep the downloaded file handy. (This is needed to configure Drupal as SAML SP.)
- Paste the copied SP Entity ID/Issuer and SP ACS URL (from Drupal site) into the Entity ID and ACS URL text field, respectively. Click on CONTINUE.
- In the Attribute mapping panel, select a user field from the dropdown under the Google Directory attribute (First name) and the corresponding attribute key to be sent in the response (field_fname). You can add more attributes using ADD.
Add Users to Google (G Suit) Application:
- In the Google Admin console, navigate to Menu → Apps → Web and mobile apps.
- Select the application that you have created on Google Apps. (In this case, Drupal_SAML).
- Click on the User access
- Enable the checkbox ON for everyone and click on the SAVE button.
Configure Drupal as Service Provider:
- Navigate to the Service Provider Setup tab of the Drupal site and click on Upload IDP Metadata.
- Paste the previously copied Google Apps Metadata URL into the Upload Metadata URL text field. Click on the Fetch Metadata button.
- Under Action, select the Edit.
- Enter Google Apps in the Identity Provider Name text field.
- Scroll down and click on the Save Configuration button.
Note: To update Identity Provider Name, follow these steps:
- Click on the Test link to test the connection between Drupal and Google Apps.
- On a Test Configuration popup sign in using Google Apps credentials (if an active session is not present). After successful authentication, a list of attributes that are received from Google Apps will be displayed. Click on the Done.
Congratulations! you have successfully configure Google Apps as SAML Identity Provider and Drupal as SAML Service Provider.
How does SAML SSO login work?
- Open a new browser/private window and navigate to the Drupal site login page.
- Click the Login using Identity Provider (Google Apps) link.
- You will be redirected to the Google Apps login page. Enter the Google Apps credentials. After successful authentication, the user will be redirected back to the Drupal site.