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

      From Data To Decisions: UX Strategies For Real-Time Dashboards

      September 13, 2025

      Honeycomb launches AI observability suite for developers

      September 13, 2025

      Low-Code vs No-Code Platforms for Node.js: What CTOs Must Know Before Investing

      September 12, 2025

      ServiceNow unveils Zurich AI platform

      September 12, 2025

      Building personal apps with open source and AI

      September 12, 2025

      What Can We Actually Do With corner-shape?

      September 12, 2025

      Craft, Clarity, and Care: The Story and Work of Mengchu Yao

      September 12, 2025

      Distribution Release: Q4OS 6.1

      September 12, 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

      Learning from PHP Log to File Example

      September 13, 2025
      Recent

      Learning from PHP Log to File Example

      September 13, 2025

      Online EMI Calculator using PHP – Calculate Loan EMI, Interest, and Amortization Schedule

      September 13, 2025

      Package efficiency and dependency hygiene

      September 13, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Dmitry — The Deep Magic

      September 13, 2025
      Recent

      Dmitry — The Deep Magic

      September 13, 2025

      Right way to record and share our Terminal sessions

      September 13, 2025

      Windows 11 Powers Up WSL: How GPU Acceleration & Kernel Upgrades Change the Game

      September 13, 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

    Artificial Intelligence

    Scaling Up Reinforcement Learning for Traffic Smoothing: A 100-AV Highway Deployment

    September 13, 2025
    Defending against Prompt Injection with Structured Queries (StruQ) and Preference Optimization (SecAlign)
    Artificial Intelligence

    Defending against Prompt Injection with Structured Queries (StruQ) and Preference Optimization (SecAlign)

    September 13, 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-53750 – Apache HTTP Server Authentication Bypass

    Common Vulnerabilities and Exposures (CVEs)

    How GitHub engineers tackle platform problems

    News & Updates

    SonicWall-lek dat voor fabrieksreset zorgt mogelijk misbruikt bij aanvallen

    Security

    North Korean Hackers Targeted Nearly 18,000 in Phishing Campaign During Martial Law Turmoil

    Development

    Highlights

    The AI complexity paradox: More productivity, more responsibilities

    July 7, 2025

    AI is just as capable of increasing as it is reducing complexity. The impact of…

    Chinese Hackers Target Taiwan’s Semiconductor Sector with Cobalt Strike, Custom Backdoors

    July 18, 2025

    CTA warns of tariff-fueled price hikes on consumer tech – but it’s not all bad news

    May 9, 2025

    Benchmarking the Orange Pi R2S Single Board Computer

    July 7, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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