Lion Cipher Lab

Federate an app with SAML 2.0 — and read the assertion off the wire

Why it matters

If you take an identity, security or IT job at any company bigger than a startup, you will meet SAML in your first month — and probably in the form of a broken login you are expected to fix. SAML 2.0 is the protocol that sits underneath most enterprise single sign-on that exists today: Okta, Microsoft Entra ID and Ping fronting Salesforce, Workday, ServiceNow, Zoom, AWS, and a long tail of internal applications too old or too expensive to modernise. It has been an OASIS standard since 2005 and it is not going anywhere, because thousands of vendors implement it and nobody rewrites a working…

What you'll learn

Steps in this lab

  1. From zero: what 'federation' means, and the cast of characters
  2. Why bother with a 2005 protocol — and what you are about to build
  3. Start Keycloak in Docker
  4. Create the two realms: one plays the employer, one plays the app
  5. In corp-idp: create the employee and a group
  6. Look at the IdP's metadata — the XML that makes federation possible
  7. In corp-idp: register the application as a SAML client
  8. Add mappers so real attributes cross the boundary
  9. In app-sp: consume corp-idp as an external SAML identity provider
  10. Open DevTools, then watch the hand-off happen
  11. Capture the SAMLResponse and decode it
  12. What you are looking at — a real decoded assertion, trimmed
  13. Issuer, Subject and NameID — who minted it, and who the user is
  14. Conditions and AudienceRestriction — the two things that stop reuse
  15. AttributeStatement — how group membership crosses the boundary, and why that IS the game
  16. The Signature — what is signed, and the bug class that lives here
  17. Certificate rotation — why SSO breaks on a Tuesday morning
  18. SP-initiated vs IdP-initiated, and why one is discouraged
  19. The judgment call: SAML or OIDC?
  20. What NEITHER protocol gives you: logout, clocks, and the debugging move
  21. Clean up — and what is left on your machine

Open the full interactive lab →