When a company buys your SaaS product, its IT team wants staff to sign in with their corporate account, and wants access to stop the day someone leaves. SAML is the standard most corporate identity providers use for this. The full form is Security Assertion Markup Language. Version 2.0 became an OASIS standard in March 2005 and is still the version in use. SAML has two parties. The identity provider (IdP), such as Okta, Microsoft Entra ID, Google Workspace or Keycloak, authenticates the user. The service provider (SP) is your application, which trusts the IdP's signed statement instead of checking a password itself.
How the SAML login flow works
The common pattern is SP-initiated login with the HTTP-POST binding:
- A user goes to
app.example.comand enterspriya@acme.com. The app sees thatacme.comuses SSO. - The app redirects the browser to Acme's IdP with an
AuthnRequest. - The user signs in at the IdP, often with MFA or a passkey.
- The IdP returns an HTML form that auto-posts a signed SAML response to the app's Assertion Consumer Service (ACS) URL.
- The app validates the response and creates a session. In IdP-initiated login, the user clicks your app's tile in the IdP portal and the flow starts at step 4. It is convenient but easier to abuse, because there is no request to match the response to. Setup is an exchange of metadata: the app gives the customer its entity ID and ACS URL, and the customer gives the app its IdP entity ID, SSO URL and signing certificate.
Example: what a SAML assertion says
Stripped down, the assertion inside the response looks like this:
<saml:Assertion ID="_a91c" IssueInstant="2026-11-21T09:30:00Z">
<saml:Issuer>https://sts.acme.example/idp</saml:Issuer>
<ds:Signature>…</ds:Signature>
<saml:Subject>
<saml:NameID>priya@acme.com</saml:NameID>
<saml:SubjectConfirmationData InResponseTo="_req42"
NotOnOrAfter="2026-11-21T09:35:00Z"
Recipient="https://app.example.com/saml/acs"/>
</saml:Subject>
<saml:Conditions NotBefore="2026-11-21T09:29:30Z" NotOnOrAfter="2026-11-21T09:35:00Z">
<saml:AudienceRestriction><saml:Audience>https://app.example.com</saml:Audience></saml:AudienceRestriction>
</saml:Conditions>
<saml:AttributeStatement>
<saml:Attribute Name="groups"><saml:AttributeValue>finance-admins</saml:AttributeValue></saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
Before trusting it, the app checks the signature with the customer's certificate, the issuer, audience, recipient and time window, and that InResponseTo matches a request it actually sent. It then maps the groups attribute to a role in the app.
SAML vs OIDC
| SAML 2.0 | OpenID Connect | |
|---|---|---|
| Format | XML, XML Signature | JSON, JWT |
| Transport | Browser redirects and form posts | Redirects plus back-channel token calls |
| Mobile and API use | Awkward | Designed for it |
| Where you meet it | Corporate IdPs, older enterprise apps | New apps, consumer login, enterprise SSO |
| Most B2B products support both, because enterprise customers' IT teams often pick SAML. |
Common mistakes
- Writing your own XML signature checks. XML signature wrapping attacks have bypassed hand-rolled and library code. Use a maintained SAML library or your identity provider.
- Checking that a signature exists but not that it covers the assertion you read.
- Not handling certificate rotation, so every customer's SSO breaks when their IdP certificate expires.
- Leaving password login open for SSO users, which defeats central offboarding. SSO and SCIM provisioning often decide enterprise deals. See authentication providers compared, or our product engineering work.