Ever had that moment where you log into a work app and it just… works? No password prompt, no friction, just straight to your dashboard because you’re already signed into your corporate email. That’s usually saml doing the heavy lifting behind the scenes.
Security Assertion Markup Language (saml) is basically a way for different systems to tell each other, "Hey, I know this person, they're cool to come in." It’s an open standard based on XML that lets an Identity Provider (IdP) pass authorization credentials to a Service Provider (SP).
The jump from 1.1 to 2.0 was huge because it merged different standards into one cohesive framework. We use xml because it’s structured and readable by machines, even if it looks a bit clunky to us humans. According to Gartner, saml remains a cornerstone for web-based SSO because it decouples the authentication event from the application itself.
The whole dance relies on a trust relationship. The IdP (like Okta or Azure AD) is the source of truth that says who you are. The SP (the app you want to use, like Slack or Salesforce) trusts the IdP's word.
Basically, the SP never sees your password. It just gets a signed digital "passport" from the IdP. This setup is great for security because if a employee leaves, you just disable them in the idp and they lose access to everything at once.
Next up, we'll dig into how these assertions actually look under the hood.
Before we move on, let's actually look at the guts of that xml. It's easy to talk about "tokens," but seeing the tags helps make it real. A typical assertion has a few key parts: the Subject (who the person is), the Conditions (how long this is valid), and the AttributeStatement (the extra info like their email or role).
Here is a simplified version of what that "passport" looks like:
<saml:Assertion ID="_a7b8c9..." IssueInstant="2024-05-20T12:00:00Z">
<saml:Issuer>https://idp.example.com/</saml:Issuer>
<!-- The Subject tells the app WHO is logging in -->
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">
[email protected]
</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="2024-05-20T11:55:00Z" NotOnOrAfter="2024-05-20T12:05:00Z" />
<!-- AttributeStatement holds the "claims" about the user -->
<saml:AttributeStatement>
<saml:Attribute Name="Role">
<saml:AttributeValue>Admin</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
<ds:Signature>...</ds:Signature>
</saml:Assertion>
That <ds:Signature> part at the bottom is the most important bit—it’s the digital seal that proves the idp actually sent this and some hacker didn't just write it in notepad.
So, you've got the high-level idea of saml being a "passport," but how does the actual handshake happen without things breaking? It’s basically a game of hot potato with xml tokens.
Most of the time, you’re dealing with two main flavors: SP-Initiated and IdP-Initiated. They sound fancy, but they just describe who starts the conversation.
In a typical SP-initiated flow (the most common one), the journey looks something like this:
Next, we're gonna look at why ctos actually care about this stuff for their business.
If you’re a cto, you probably spend more time than you’d like worrying about "the enterprise wall." You know, that moment where a huge potential customer says they love your product but won't sign the contract unless you support their specific identity provider.
Honestly, saml is basically the ticket to the big leagues for any B2B startup. Without it, you’re stuck managing a million local passwords, which is a security nightmare and a massive drag on your support team.
Building a custom saml integration for every single customer is a trap. I've seen teams waste months trying to map custom attributes or debugging "Signature validation failed" errors. This is where an api-first platform like SSOJet saves your life. It handles the messy stuff like directory sync and certificate rotations, so your devs can actually build features that people pay for.
Now that we've seen why it's useful, let's compare it to the other big player in the space.
So, you’re probably wondering—if saml is so great for enterprise, why does everyone keep talking about oidc? Honestly, it’s not about which one is "better," it’s about what you’re trying to build and who’s using it.
Think of saml as that heavy, reliable master key for a corporate office building. It’s built on xml and is the absolute gold standard for big-box enterprise stuff. But if you’re building a sleek mobile app or a modern single-page web app, saml can feel a bit… clunky.
That’s where OpenID Connect (oidc) comes in. It sits on top of OAuth 2.0 and uses json, which is way lighter and easier for a javascript dev to handle than digging through xml namespaces.
Don't get stuck in a "this or that" mindset. Most mature identity architectures use a bridge to handle both. Next, let's look at some security best practices and how to handle common errors when things go sideways.
Look, saml isn't bulletproof just because it uses xml signatures. If you don't validate the audience restriction, an attacker could reuse a token meant for one app to sneak into another.
NotBefore and NotOnOrAfter windows. Loose timestamps are an open door for replay attacks.| Error | Likely Cause | Fix |
|---|---|---|
| Signature Validation Failed | Certificate mismatch or xml was altered in transit. | Check that the public key in your SP matches the IdP's private key. |
| Audience Restriction Error | The 'Audience' in the xml doesn't match your SP Entity ID. | Ensure your SP's unique ID is correctly configured in the IdP settings. |
| Response Expired | The server clocks are out of sync. | Check the NotOnOrAfter tag and ensure your server uses NTP to stay on time. |
Keep your metadata urls private and rotate certificates before they expire, not the morning after. Stay safe out there.
*** This is a Security Bloggers Network syndicated blog from SSOJet - Enterprise SSO & Identity Solutions authored by SSOJet - Enterprise SSO & Identity Solutions. Read the original post at: https://ssojet.com/blog/what-is-saml-2-0-and-how-does-it-work