ResourcesInfrastructure

SAML SSO Integration: Architecture, Protocols & Best Practices

How SAML SSO integration works: the assertion flow between identity and service provider, the trust model behind it, and what breaks in enterprise deployments.

TL;DR — SAML SSO integration allows a central Identity Provider to pass authenticated user identities to multiple Service Providers using digitally signed XML assertions. This enables users to access many applications with a single set of credentials, improving security and simplifying access management.

If your engineering team manages more than a handful of internal applications, data pipelines, and orchestration platforms, credential sprawl is an operational liability. Managing local user accounts across every tool leads to forgotten passwords, stale access tokens, and severe audit risks during compliance reviews.

SAML SSO integration solves this by establishing a trusted bridge between a centralized Identity Provider—such as Okta, Azure AD, or Keycloak—and your downstream infrastructure. Instead of validating credentials at every application boundary, systems delegate authentication to a single trusted authority using cryptographic XML assertions.

What is SAML SSO integration?

SAML SSO integration is the process of using the SAML protocol to implement a single sign-on experience. It connects an organization’s identity management system with third-party and internal applications, creating a federated identity model where trust is established once and reused everywhere.

Defining SAML: Security Assertion Markup Language

SAML (Security Assertion Markup Language) is an open standard for exchanging authentication and authorization data between parties. It uses XML to create “assertions,” which are statements about a user’s identity, attributes, and entitlements. These assertions are digitally signed to ensure their integrity and authenticity, forming the basis of trust between systems that may not share a common infrastructure.

Understanding SSO: Single Sign-On explained

Single Sign-On (SSO) is a session and user authentication service that permits a user to use one set of login credentials (e.g., name and password) to access multiple applications. The service authenticates the user for all the applications they have been given rights to and eliminates further prompts when they switch applications during the same session.

How SAML enables SSO: The trust bridge

SAML is the mechanism that makes cross-domain SSO possible. It defines a standardized way for an Identity Provider (IdP), which holds the user’s credentials, to securely communicate a user’s identity to a Service Provider (SP), the application the user wants to access. This communication happens without the SP ever seeing the user’s password. The trust is based on a pre-configured relationship involving shared metadata and public key cryptography. This model is central to any enterprise SSO workflow orchestration.

How SAML authentication works in production

The SAML authentication process involves three main actors: the user, the Identity Provider (IdP), and the Service Provider (SP). The flow is typically initiated by the SP when a user tries to access a protected resource.

The SAML authentication flow: IdP, SP, and user roles

  1. User Access Request: The user attempts to access a service or application (the SP) via their web browser.
  2. SP-Initiated Request: The SP identifies that the user is not authenticated. It constructs a SAML authentication request, encodes it, and redirects the user’s browser to the IdP’s SSO URL with the request as a parameter.
  3. IdP Authentication: The IdP receives the request, decodes it, and prompts the user to log in (if they don’t already have an active session). The IdP authenticates the user against its local directory (e.g., Active Directory, LDAP).
  4. SAML Assertion Generation: Upon successful authentication, the IdP generates a SAML Response. This is an XML document containing an assertion with the user’s identity (like their email address), attributes, and a digital signature.
  5. Redirection to SP: The IdP encodes the SAML Response and sends it back to the user’s browser. The browser then automatically submits this response to the SP’s Assertion Consumer Service (ACS) URL.
  6. SP Validation and Access: The SP receives the SAML Response, verifies the IdP’s digital signature using the pre-configured public key, and parses the XML assertion to identify the user. If the assertion is valid, the SP creates a local session for the user and grants them access.

Key components: Assertions, metadata, and bindings

  • Assertions: These are the XML statements an IdP makes about a user. There are three types:
    • Authentication Assertions: State that the user was authenticated at a specific time and by a specific method.
    • Attribute Assertions: Contain specific user attributes, such as email, department, or roles.
    • Authorization Decision Assertions: Specify what the user is authorized to do on the SP.
  • Metadata: An XML file exchanged between the IdP and SP during setup. It contains essential information like SSO endpoint URLs, entity IDs, and the public keys required for signing and encrypting assertions.
  • Bindings: Define how SAML messages are transported. Common bindings include HTTP Redirect (for sending requests) and HTTP POST (for sending responses).

SAML 2.0 as the enterprise standard

SAML 2.0, ratified in 2005, is the current and most widely adopted version of the standard. It provides a mature, well-tested framework for federated identity, making it the default choice for enterprise-level SSO, especially in B2B and corporate environments.

SAML vs. SSO: Clearing up the confusion

The terms SAML and SSO are often used interchangeably, but they represent different concepts. Understanding the distinction is key to designing a solid authentication architecture.

What’s the difference between SSO and SAML?

SSO is the desired outcome or user experience—logging in once to access multiple applications. SAML is one of the technologies or protocols used to achieve that outcome. Think of SSO as the “what” and SAML as the “how.”

Can SSO work without SAML?

Yes. SSO can be implemented using various other protocols. OpenID Connect (OIDC), Kerberos, and proprietary token-based systems can all provide a single sign-on experience. SAML’s strength lies in its standardization and widespread support across enterprise applications.

Why SAML remains the enterprise default

Despite the rise of newer protocols, SAML is deeply entrenched in the enterprise software estate. Its maturity, security features, and platform-agnostic XML format make it a reliable choice for integrating with a diverse set of applications, from legacy on-premise systems to modern SaaS platforms.

Comparing SAML with modern authentication protocols

While SAML is a powerful standard, the authentication landscape has evolved. Newer protocols like OIDC and OAuth 2.0 address different use cases, particularly for mobile and single-page applications.

SAML vs. OpenID Connect (OIDC): XML versus JSON

OIDC is a modern authentication layer built on top of the OAuth 2.0 authorization framework. The primary difference is the data format: SAML uses XML, which can be verbose, while OIDC uses lightweight JSON Web Tokens (JWTs). This makes OIDC a better fit for mobile and browser-based applications where bandwidth and parsing efficiency are critical. SAML, by contrast, remains dominant in traditional enterprise and web application federation.

SAML vs. OAuth 2.0: Authentication versus Authorization

This comparison is often a point of confusion. SAML is, at its core, about authentication—it proves who a user is. OAuth 2.0 is about authorization—it grants an application permission to access specific resources on behalf of a user, without sharing their credentials. OIDC was built on top of OAuth 2.0 to add the missing authentication piece, making it a more direct competitor to SAML.

What is replacing SAML in modern stacks?

For new consumer-facing, mobile, and API-centric applications, OIDC is the preferred successor to SAML. Its simplicity, reliance on REST/JSON, and strong support from major identity providers like Google and Microsoft make it easier for developers to implement. But in the enterprise space, SAML is not being replaced but rather coexisting with OIDC, with each protocol used where it fits best.

Implementing SAML SSO integration in enterprise platforms

Configuring SAML requires a coordinated setup between the Identity Provider and the Service Provider. The goal is to establish a cryptographic trust relationship.

Steps to configure SAML for your applications

  1. Generate Metadata: Both the IdP and SP generate metadata files. The SP’s metadata is imported into the IdP, and the IdP’s metadata is imported into the SP.
  2. Configure Trust: This exchange of metadata establishes the trust relationship. The SP now knows where to send authentication requests and has the public key to verify the IdP’s signatures.
  3. Map Attributes: The administrator maps user attributes from the IdP’s directory (e.g., user.email) to the attributes the SP expects (e.g., EmailAddress).
  4. Assign Users: In the IdP, administrators assign users or groups to the application, granting them the ability to log in via SSO.

For a specific example, see how to set up a Keycloak SSO integration for workflow orchestration.

Bridging authentication and authorization with SCIM

While SAML handles authentication, it doesn’t manage the user lifecycle. This is where SCIM (System for Cross-domain Identity Management) comes in. SCIM is a protocol for automating user provisioning. When a user is added to a group in the IdP, SCIM provisioning can automatically create an account for them in the downstream application. When they are removed, SCIM de-provisions their account.

Securing internal orchestration tools with SAML and RBAC

For platforms like Kestra, SAML SSO is the foundation for secure enterprise access. Once a user is authenticated via SAML, their identity and group memberships (passed as SAML attributes) are used to enforce Role-Based Access Control (RBAC) within the application. This ensures that a user from the “Data-Platform” group can only access their team’s workflows, while a user from “Finance” can only access financial reporting pipelines.

Common challenges and best practices for SAML deployment

One of the most critical operational risks in a SAML deployment is silent and catastrophic: the expiration of the IdP’s signing certificate. When the X.509 certificate used to sign SAML assertions expires, every SSO login attempt to every integrated application will fail simultaneously until the certificate is manually rotated.

This can be prevented by orchestrating a monitoring workflow. The following Kestra flow runs on a daily schedule, fetches the IdP’s public SAML metadata, parses the signing certificate, and sends a Slack alert if the expiration date is within 30 days.

id: saml-idp-certificate-expiry-check
namespace: company.team.security
tasks:
- id: fetch-idp-metadata
type: io.kestra.plugin.core.http.Request
uri: "{{ secret('IDP_METADATA_URL') }}"
- id: check-expiry-date
type: io.kestra.plugin.scripts.python.Script
runner: DOCKER
docker:
image: python:3.11-slim
beforeCommands:
- pip install cryptography pyopenssl > /dev/null
script: |
from kestra import Kestra
import xml.etree.ElementTree as ET
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from datetime import datetime, timezone
with open("{{ outputs['fetch-idp-metadata'].body }}", "r") as f:
metadata_xml = f.read()
root = ET.fromstring(metadata_xml)
cert_b64 = root.find('.//{urn:oasis:names:tc:SAML:2.0:metadata}KeyDescriptor[@use="signing"]/{http://www.w3.org/2000/09/xmldsig#}KeyInfo/{http://www.w3.org/2000/09/xmldsig#}X509Data/{http://www.w3.org/2000/09/xmldsig#}X509Certificate').text
cert_data = f"-----BEGIN CERTIFICATE-----\n{cert_b64}\n-----END CERTIFICATE-----".encode('utf-8')
cert = x509.load_pem_x509_certificate(cert_data, default_backend())
expiry_date = cert.not_valid_after_utc
days_left = (expiry_date - datetime.now(timezone.utc)).days
print(f"SAML signing certificate expires on: {expiry_date}. Days remaining: {days_left}")
Kestra.outputs({'days_left': days_left, 'expiry_date': str(expiry_date)})
- id: if-expiring-soon
type: io.kestra.plugin.core.flow.If
condition: "{{ outputs['check-expiry-date'].vars.days_left < 30 }}"
then:
- id: send-slack-alert
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK_URL') }}"
payload: |
{
"channel": "#platform-alerts",
"text": "🚨 CRITICAL: SAML IdP signing certificate expires in {{ outputs['check-expiry-date'].vars.days_left }} days on {{ outputs['check-expiry-date'].vars.expiry_date }}."
}
else:
- id: log-ok-status
type: io.kestra.plugin.core.log.Log
message: "SAML certificate check OK. {{ outputs['check-expiry-date'].vars.days_left }} days remaining."
triggers:
- id: daily-check
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 9 * * *"

A few things are worth noticing in this workflow:

  • Automation as Prevention: It turns a manual, error-prone task into a reliable, automated check, preventing a high-impact production incident.
  • Declarative Definition: The entire process is defined in a single, version-controllable YAML file, making the logic transparent and auditable.
  • Secrets Management: Sensitive information like the metadata URL and Slack webhook are managed securely using Kestra’s secrets backend.
  • Conditional Logic: The If task ensures that alerts are only sent when necessary, avoiding alert fatigue for the operations team.

Troubleshooting redirect loops and clock skew

  • Redirect Loops: Often caused by misconfigured SSO URLs or session state issues. Ensure the IdP and SP have the correct endpoint URLs for each other.
  • Clock Skew: SAML assertions have a short validity window. If the system clocks on the IdP and SP servers are not synchronized (usually via NTP), assertions may be considered expired or not yet valid, causing authentication to fail.

Enforcing least-privilege access across distributed teams

SSO is only the first step. True security requires enforcing the principle of least privilege after authentication. In a platform context, this means using the attributes from the SAML assertion (like group membership) to dynamically assign permissions. This ensures that teams in regulated industries like finance or enterprise software providers can operate on a shared platform with zero blast radius between them.

Frequently asked questions

Find answers to your questions right here, and don't hesitate to Contact Us if you couldn't find what you're looking for.