Skip to content

TB-001Bulletin

SAML explained with one diagram

Three parties, eight messages and six checks. The vocabulary of enterprise sign-on, mapped onto a single drawing.

Kwame MensahEngineer, identity protocols, Accra

Title
Technical bulletin
Doc. no.
LM-09 / TB-001
Subject
Protocols
Issued
18 Aug 2026
Reading
4 min

SAML has a reputation for being impenetrable, mostly because it is described in XML and acronyms. The mechanism underneath is small. One party vouches for a user by signing a short document; another party checks the signature and believes it. Everything else is envelope. If you hold on to the diagram below, the vocabulary falls into place around it.

1.0Three parties, and no direct line between two of them

The identity provider (IdP) is where the customer's employees already sign in: Okta, Microsoft Entra ID, Google Workspace. The service provider (SP) is your app, or Latch acting for it. The third party is the user's browser, and it does all the carrying. In the common flow your server and the IdP never open a connection to each other. Every message is handed to the browser as a redirect or a form, and the browser delivers it.

Browser
Your app (SP)
Identity provider
ines@palletline.io
302 + SAMLRequest
GET SSO URL
password, MFA, policy
form: SAMLResponse
POST to ACS URL
verify 6 things
session cookie
Fig. 1.1SP-initiated SAML sign-in. The identity provider and your app only ever talk through the browser.

Email The domain selects the customer's SAML connection. No password field is shown.

AuthnRequest A small XML request, deflated and base64-encoded into the redirect URL, with a unique ID.

Delivery The browser follows the redirect to the IdP, carrying the request and a RelayState.

Authentication Entirely the IdP's business. Your app never sees the credential.

Assertion A signed statement about the user, in an HTML form that submits itself.

Consumption The browser posts the form to your Assertion Consumer Service endpoint.

Validation Signature, issuer, audience, recipient, time window and request ID. See section 3.

Session From here on it is an ordinary session. SAML is finished.

2.0The vocabulary, mapped to the diagram

TermWhat it isWho provides it
Entity IDA unique name for one party, usually a URLBoth sides
SSO URLWhere step 3 is sentIdP
ACS URLWhere step 6 is postedSP
Signing certificateThe X.509 public key that checks step 5IdP
NameIDThe subject: who the assertion is aboutIdP
RelayStateAn opaque value echoed back, to resume where the user wasSP
MetadataAn XML file bundling all of the aboveBoth sides

Setting up a connection means each side learning the other's three or four values. That is the whole of “configuring SAML”, and exchanging metadata URLs does it in one step.

3.0What is inside an assertion

Stripped of namespaces, the document the IdP signs says: I am this issuer, this is the user, it is meant for that audience, and it is valid for these few minutes.

assertion.xml (trimmed)
<Assertion ID="_a81f3c" IssueInstant="2026-08-18T09:14:02Z">  <Issuer>https://palletline.okta.com/exk4f2</Issuer>  <Signature>…</Signature>  <Subject>    <NameID Format="…:persistent">00u8k2j1x</NameID>    <SubjectConfirmationData InResponseTo="_req_7d20"        Recipient="https://auth.acme.dev/saml/acs"        NotOnOrAfter="2026-08-18T09:19:02Z"/>  </Subject>  <Conditions NotBefore="2026-08-18T09:13:02Z" NotOnOrAfter="2026-08-18T09:19:02Z">    <AudienceRestriction><Audience>https://auth.acme.dev/saml</Audience></AudienceRestriction>  </Conditions>  <AttributeStatement>    <Attribute Name="email"><AttributeValue>ines@palletline.io</AttributeValue></Attribute>  </AttributeStatement></Assertion>

Your side has six checks to make, and skipping any one of them is a known vulnerability class:

  1. The signature verifies against the certificate pinned for this connection.
  2. The Issuer is the IdP entity ID you configured.
  3. The Audience is your own entity ID, so an assertion minted for another app is refused.
  4. The Recipient is your ACS URL.
  5. The current time is inside NotBefore / NotOnOrAfter, with two or three minutes of tolerance for clock skew.
  6. InResponseTo matches a request you issued and have not already consumed, which stops replay.
Caution
Verify the signature first, then read claims only from the element the signature covers. Code that validates one <Assertion> and then reads “the first Assertion in the document” is how signature-wrapping attacks succeed. Use a maintained library and keep it patched.

4.0Where real connections go wrong

  • Certificate rotation. IdP certificates expire, typically every one to three years. Accept two certificates per connection so the customer can roll over without an outage, and warn them 30 days ahead.
  • Email as the identifier. People change names, and companies change domains. Ask for a persistent, opaque NameID and treat email as an attribute.
  • IdP-initiated sign-in. The user clicks your tile in their Okta dashboard, so there is no request and nothing for InResponseTo to match. Support it only for customers who ask, and require a short validity window.
  • Clock skew. A server ten minutes off rejects every assertion. Allow a few minutes of tolerance and no more; the window is part of the security.
Note
SAML only speaks at sign-in. It cannot tell you that someone was fired this morning. Deactivation needs SCIM directory sync, or a session lifetime short enough that the next sign-in attempt fails at the IdP.

5.0SAML or OIDC

OpenID Connect does the same job with JSON and a back-channel: the browser carries only a one-time code, and your server exchanges it directly with the IdP for a signed ID token. It is easier to implement and harder to get wrong. If a customer's IdP offers both, choose OIDC.

You will still be asked for SAML, because it is the line item on the security questionnaire and the option every enterprise IdP has supported for fifteen years. In Latch, a connection is either protocol behind the same API, costs $50 a month, and is set up by the customer's own IT admin from a link you send them. The median setup we see takes 14 minutes, most of it spent finding who has the Okta admin password.

78%

Connections using SAML

14 min

Median self-serve setup

0

Outages from expired certificates

Fig. 5.1 — Enterprise connections on Latch, September 2026.

6.0Get started

Read enough. Try the part.

Everything in these bulletins is switched on in the free plan: passkeys, 60-second tokens, organizations and roles, for your first 10,000 monthly active users.

npm install @latch/nextjs

Included on Free

Monthly active users
10,000
Passkeys, codes, links
Included
Social providers
3
Organizations
5 members each
Card required
No