SAML - Security Assertion Markup Language
About 2 min read
SAML (Security Assertion Markup Language) is an open standard for securely exchanging XML-based authentication and authorization information across different domains. SAML 2.0 was established by OASIS in 2005 and is one of the protocols used for single sign-on (SSO) in enterprise environments. OpenID Connect (OIDC) is also in use, but SAML is still used in some settings because of its compatibility with existing enterprise systems.
The SAML 2.0 Authentication Flow
The SAML authentication flow has two patterns: SP-initiated (originating from the SP) and IdP-initiated (originating from the IdP).
The Structure of a SAML Assertion
A SAML assertion is an XML document through which the IdP conveys the result of user authentication to the SP. It is composed mainly of three elements.
Describes when and by what method the user was authenticated. Includes the authentication time and the authentication method (password, MFA, etc.).
Stores the user's attribute information (email address, department, role, etc.). The SP uses this information to perform access control.
Describes whether access to a specific resource is permitted. The SAML 2.0 specification states that this feature has been frozen as of SAML V2.0, with no future enhancements planned.
Comparison with OIDC
Both SAML and OIDC are protocols that enable federated authentication, but they differ in design philosophy and technical foundation.
| Aspect | SAML 2.0 | OIDC |
|---|---|---|
| Data format | XML | JSON / JWT |
| Year established | 2005 | 2014 |
| Main use case | Enterprise SSO | Web and mobile apps |
| Implementation complexity | High (XML signatures, certificate management) | Low (JSON-based) |
| Mobile support | Difficult (assumes browser redirects) | Native support |
| Token size | Large (several KB) | Small (a few hundred bytes) |
Why SAML Persists in Legacy Systems
Even though OIDC is more modern and easier to implement, there are several reasons why SAML remains in use in enterprise environments. First, major SaaS products such as Salesforce, Workday, and ServiceNow have supported SAML for years, and migrating existing integration settings to OIDC carries a high cost. Second, where SAML integrations have accumulated in an in-house Active Directory Federation Services (AD FS) deployment, rebuilding those integration settings takes effort. Third, audit and compliance requirements sometimes call for a "proven protocol." The article on corporate password policy also touches on choosing an SSO protocol.
A SAML Vulnerability - XML Signature Wrapping Attacks
Because SAML uses XML Signature, it is exposed to an attack called XML Signature Wrapping (XSW). In this attack, a legitimate signed assertion is moved within the XML document, and a forged assertion created by the attacker is inserted at a position outside the scope of signature verification. If the SP's XML parser looks at different nodes for signature verification and for value reference, the attacker may be able to log in as any user. The countermeasure is to make the part checked when verifying digital signatures match the part from which later processing reads values.
- Pass only the elements covered by signature verification on to assertion processing
- Keep the SAML library at the latest version and apply patches for known XSW vulnerabilities
- Strictly validate the schema of the assertions received on the SP side
- Use encrypted assertions (EncryptedAssertion) whenever possible
Common Misconceptions
There is a misconception that "SAML is old, so it is not secure," but the age of a standard does not in itself make it weak. Problems arise from implementation flaws (lax signature verification, missed certificate rotation, etc.), and as XML Signature Wrapping shows, the freedom XML Signature allows in placing the signature and the signed content can also lead to implementation mistakes. Check the implementation checkpoints for introducing SSO in the startup security checklist.
The Operational Load While Both Protocols Coexist
A configuration in which newly adopted services use OIDC while existing services remain integrated over SAML arises as a transitional state until migration is complete. What increases during this period is less technical difficulty than verification work: the IdP holds two sets of integration settings for the same users, so adding an account, changing permissions, or disabling access when someone leaves has to be confirmed against both. Troubleshooting procedures diverge as well - on the SAML side, signature verification and certificate expiry are the places to suspect; on the OIDC side, token validation and where the keys are fetched from. Expiry management cannot be unified either, since certificates and client credentials are tracked on separate schedules. The OIDC side is contiguous with OAuth permission management, so the design of the scopes granted needs to be reviewed alongside it. Coexistence itself is hard to avoid, but if the inventory of which service uses which method is not current, permission changes will be missed on one side; setting a deadline for the migration so that the transitional state does not become permanent is therefore the operational key.
Was this article helpful?
Related Terms
- Single Sign-On (SSO) - One Login for EverythingSSO lets users authenticate once and access multiple applications without re-entering credentials. It improves productivity and security posture but creates a single point of failure if compromised.
- OpenID Connect (OIDC) - The Identity Layer on OAuth 2.0OpenID Connect (OIDC) adds an identity layer on top of OAuth 2.0, providing standardized user authentication. It returns an ID token with user claims, enabling SSO across web and mobile apps.
- Identity Providers - Centralized Authentication ServicesAn identity provider (IdP) centrally manages user credentials and issues assertions via SAML or OIDC. Okta, Microsoft Entra ID (formerly Azure AD), and Google Workspace are examples in enterprise environments.
- Password Rotation - Periodic Credential ChangesPassword rotation is the practice of changing passwords at regular intervals. NIST now advises against forced rotation unless a breach is suspected, as it often leads to weaker password choices.