SAML and Enterprise Single Sign-On

Understand SAML-based SSO so your product can plug into corporate identity providers.

Advanced · about 4 hours · difficulty 4/5

Learn first: OAuth 2.0 and OpenID Connect

SAML 2.0 is an XML-based standard for single sign-on that predates OIDC and is still the norm in large companies. When a business customer says "we need SSO with Okta or Microsoft Entra ID", they often mean SAML (or OIDC).

How it works

  • The Identity Provider (IdP), such as Okta or Entra ID, authenticates users.
  • Your app is the Service Provider (SP).
  • The user is redirected to the IdP, logs in, and the IdP posts a signed SAML assertion (XML) back to your app's Assertion Consumer Service URL. You verify the signature and read attributes like email and groups.
  • Configuration is exchanged via metadata XML documents containing URLs and certificates.

Related enterprise features

SCIM for automatically provisioning and deprovisioning users, and mapping IdP groups to your app's roles.

Practical advice

Do not hand-roll SAML parsing; XML signature validation has a long history of vulnerabilities. Use a mature library or an identity platform that supports SAML for you.

You are ready to move on when you can configure a free developer IdP account to log into a sample app via SAML and explain what is inside the assertion.

Key concepts

  • Identity Provider vs Service Provider
  • SAML assertions and signatures
  • SP and IdP metadata
  • SCIM provisioning
  • Okta and Microsoft Entra ID

Mini project

Integrate a sample app with a free Okta or Auth0 developer tenant using SAML, and map an IdP group to an admin role in your app.

Check yourself

Why is writing your own SAML signature validation a bad idea?

Free resources