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

      Newest LF Decentralized Trust Lab HOPrS identifies if photos have been altered

      July 9, 2025

      Coder reimagines development environments to make them more ideal for AI agents

      July 9, 2025

      Report: AI coding productivity gains cancelled out by other friction points that slow developers down

      July 9, 2025

      15 Proven Benefits of Outsourcing Node.js Development for Large Organizations

      July 9, 2025

      How passkeys work: Do your favorite sites even support passkeys?

      July 10, 2025

      Samsung Galaxy Z Fold 7 vs. Z Fold 6: I tried both phones, and the difference is dramatic

      July 10, 2025

      Cor, blimey! The ASUS ROG Ally drops to its lowest-ever price for Amazon Prime Day in the UK — the only Windows handheld to permanently replace my Steam Deck

      July 9, 2025

      Owlcat Games talks to us about about WH40K: Rogue Trader, the next game ‘Dark Heresy’ — and how the studio feels about working with Xbox Game Pass

      July 9, 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

      Cally – Small, feature-rich calendar components

      July 9, 2025
      Recent

      Cally – Small, feature-rich calendar components

      July 9, 2025

      Working with the Command Line and WP-CLI

      July 9, 2025

      Access to Care Is Evolving: What Consumer Insights and Behavior Models Reveal

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

      Cor, blimey! The ASUS ROG Ally drops to its lowest-ever price for Amazon Prime Day in the UK — the only Windows handheld to permanently replace my Steam Deck

      July 9, 2025
      Recent

      Cor, blimey! The ASUS ROG Ally drops to its lowest-ever price for Amazon Prime Day in the UK — the only Windows handheld to permanently replace my Steam Deck

      July 9, 2025

      Owlcat Games talks to us about about WH40K: Rogue Trader, the next game ‘Dark Heresy’ — and how the studio feels about working with Xbox Game Pass

      July 9, 2025

      Microsoft says ‘we have threads at home’ — rolls out feature Slack has had for years

      July 9, 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

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-3497 – Radiflow iSAP Smart Collector EOL Vulnerability

    July 10, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-3498 – Radiflow iSAP Smart Collector Unauthenticated Remote Command Execution and Configuration Modification

    July 10, 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

    Node.js vs Django: Discover the Top Backend Framework for 2025

    Tech & Work

    Want AI to work for your business? Then privacy needs to come first

    News & Updates

    CVE-2025-28035 – TOTOLINK A830R Remote Command Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-48877 – Discourse Codepen Unintended JS Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Development

    Validate Controller Requests with the Laravel Data Package

    May 19, 2025

    The Laravel Data package has many incredible features for working with data objects in Laravel…

    Microsoft Urges TPM 2.0 for Windows 11 Upgrade as Win 10 Support Nears End

    April 21, 2025

    AI in Sitecore: Transforming Digital Experiences

    April 16, 2025

    “Am I crazy or is GPT-4.1 the best model for coding?” ChatGPT gets new models with exemplary web development capabilities — but OpenAI is under fire for allegedly skimming through safety processes

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

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