Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Ultimate Guide to Node.js Development Pricing for Enterprises

      July 29, 2025

      Stack Overflow: Developers’ trust in AI outputs is worsening year over year

      July 29, 2025

      Web Components: Working With Shadow DOM

      July 28, 2025

      Google’s new Opal tool allows users to create mini AI apps with no coding required

      July 28, 2025

      I replaced my Samsung OLED TV with this Sony Mini LED model for a week – and didn’t regret it

      July 29, 2025

      I tested the most popular robot mower on the market – and it was a $5,000 crash out

      July 29, 2025

      5 gadgets and accessories that leveled up my gaming setup (including a surprise console)

      July 29, 2025

      Why I’m patiently waiting for the Samsung Z Fold 8 next year (even though the foldable is already great)

      July 29, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Performance Analysis with Laravel’s Measurement Tools

      July 29, 2025
      Recent

      Performance Analysis with Laravel’s Measurement Tools

      July 29, 2025

      Memoization and Function Caching with this PHP Package

      July 29, 2025

      Laracon US 2025 Livestream

      July 29, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft mysteriously offered a Windows 11 upgrade to this unsupported Windows 10 PC — despite it failing to meet the “non-negotiable” TPM 2.0 requirement

      July 29, 2025
      Recent

      Microsoft mysteriously offered a Windows 11 upgrade to this unsupported Windows 10 PC — despite it failing to meet the “non-negotiable” TPM 2.0 requirement

      July 29, 2025

      With Windows 10’s fast-approaching demise, this Linux migration tool could let you ditch Microsoft’s ecosystem with your data and apps intact — but it’s limited to one distro

      July 29, 2025

      Windows 10 is 10 years old today — let’s look back at 10 controversial and defining moments in its history

      July 29, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Integrating Drupal with Salesforce SSO via SAML and Dynamic User Sync

    Integrating Drupal with Salesforce SSO via SAML and Dynamic User Sync

    June 14, 2025

    Single Sign-On (SSO) is a crucial part of modern web applications, enabling users to authenticate once and access multiple systems securely. If your organization uses Salesforce as an Identity Provider (IdP) and Drupal as a Service Provider (SP), you can establish a secure SSO connection using the SAML protocol.

    In this blog, we’ll walk through how to integrate Drupal with Salesforce for SSO using the SAML Authentication module. We’ll also explore how to dynamically sync user data—like first name, last name, company, and roles—from Salesforce into Drupal during login.

    Prerequisites

    Before starting, ensure you have the following:

    • A working Drupal 9 or 10 site.
    • Access to the Salesforce admin console.
    • The SAML Authentication module installed in Drupal.
    • SSL enabled on your Drupal site (SAML requires HTTPS).

    Step 1: Install the SAML Authentication Module in Drupal

    You can install the module via Composer:

    composer require drupal/saml_auth

    Then enable it using Drush or through the Drupal admin interface:

    drush en saml_auth

    Dependencies (like simplesamlphp) may need to be managed manually or via the simplesamlphp_auth module if you prefer a different approach.

    Step 2: Configure Salesforce as an Identity Provider (IdP)

    • Log in to Salesforce, and go to: Setup → Apps → App Manager → New Connected App
    • Fill in the basic details, then under Web App Settings:
      • Enable SAML.
      • Entity ID: Use your Drupal site’s SP Entity ID (e.g., https://example.com/saml/metadata)
      • ACS URL: https://example.com/saml/acs
      • Subject Type: Usually Email or Username.
      • Name ID Format: urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
    • Add custom attributes:
      • FirstName
      • LastName
      • Company
      • Roles
    • Download the IdP metadata or note:
      • IdP SSO URL
      • IdP Entity ID
      • X.509 certificate

    Step 3: Configure the SAML Authentication Module in Drupal

    Navigate to: Admin → Configuration → People → SAML Authentication Settings (/admin/config/people/saml)

    Fill in the settings:

    • IdP Entity ID and SSO URL: From Salesforce.
    • X.509 Certificate: Paste the public cert here.
    • SP Entity ID: Can be your site URL or a custom value.
    • ACS URL: Must match what you provided to Salesforce.
    • NameID format: Match Salesforce (usually emailAddress).
    • User match field: Set to mail.

    Step 4: Dynamic User Synchronization

    By default, SAML Authentication handles user login and account creation, but we extended this with custom logic to map additional attributes from Salesforce into the Drupal user profile.

    Salesforce sends additional user information in the SAML assertion, including:

    • First name
    • Last name
    • Company
    • Roles

    We’ve extended the default SAML authentication behavior with a custom hook or event subscriber to:

    • Create new users in Drupal using the email as the unique identifier.
    • Populate additional profile fields like first name, last name, and company.
    • Assign user roles dynamically based on the roles attribute from Salesforce.

    This ensures that user accounts are fully provisioned and kept up-to-date every time a user logs in through SSO.

    Step 5: Test the SSO Flow

    • Log out of your Drupal site.
    • Navigate to /saml/login.
    • You’ll be redirected to Salesforce to authenticate.
    • After login, you’ll be redirected back to Drupal and logged in automatically with synced user details.

    Check that:

    • A new Drupal user is created if it doesn’t exist.
    • First name, last name, and company fields are populated.
    • Roles are assigned correctly.

    If there’s an error, enable debugging logs and inspect the SAML response and assertion for mismatches.

    Conclusion

    Integrating Salesforce with Drupal using the SAML Authentication module enables a seamless and secure SSO experience. This is particularly useful for organizations using Salesforce as a central identity system. With proper configuration, users can enjoy frictionless access to your Drupal site while benefiting from Salesforce’s authentication infrastructure.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleDiscord Invite Link Hijacking Delivers AsyncRAT and Skuld Stealer Targeting Crypto Wallets
    Next Article Tunnel Run game in 170 lines of pure JS

    Related Posts

    Development

    Performance Analysis with Laravel’s Measurement Tools

    July 29, 2025
    Development

    Memoization and Function Caching with this PHP Package

    July 29, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-48827 – vBulletin Unauthenticated API Controller Method Invocation Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Lingmo OS – modern Linux distribution based on Debian

    Linux

    CVE-2025-20667 – Oracle Modem Information Disclosure Remote Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-53623 – ActiveJob Job Iteration API Remote Code Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    News & Updates

    This one Elden Ring Nightreign feature saved the day when I needed it most

    June 11, 2025

    Offline play support may not be something you need often, but I’m glad it was…

    Launch an AI-Powered MVP in Just 5 Weeks | Quick Guide

    May 26, 2025

    Building an A2A-Compliant Random Number Agent: A Step-by-Step Guide to Implementing the Low-Level Executor Pattern with Python

    June 21, 2025

    DOJ charges 12 more in $263 million crypto fraud takedown where money was hidden in squishmallow stuffed animals

    May 22, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.