SAML 2.0: understand its components and validate a browser SSO response
See how assertions, protocol messages, bindings and profiles fit together, then check the controls an SP should apply before opening a session.
SAML 2.0: understand its components and validate a browser SSO response
SAML 2.0 (Security Assertion Markup Language) is a framework for exchanging XML security information between organizations. In browser single sign-on (SSO), an identity provider (IdP) reports an authentication result to a service provider (SP), which checks the response and creates its own session. SAML is not just an XML assertion: the assertion, protocol message, transport binding and use-case profile must work together.
Four layers
**Assertion:** claims about a subject, such as authentication or attributes.
**Protocol:** request and response messages, such as `AuthnRequest` and `Response`.
**Binding:** how a message travels, such as HTTP Redirect, POST or Artifact.
**Profile:** rules that combine and constrain these pieces for a use case, such as Web Browser SSO.
A Response carries an assertion; receiving SAMLResponse does not by itself establish trust. In an SP-initiated flow, the SP creates an AuthnRequest, the browser visits the IdP, and the IdP returns a response to the SP's Assertion Consumer Service (ACS). In an IdP-initiated flow, the user selects an app at the IdP and no SP request preceded the response. Agree on the supported flow, entity IDs, ACS URL and binding before integration.
Checks before the SP creates a session
Match the Response and assertion `Issuer` to the IdP already trusted by configuration.
Verify every signature that is present using trusted metadata keys, and ensure the verified signature covers the exact XML element whose claims the SP uses. The profile and binding determine which signatures are required.
Check that `AudienceRestriction` includes this SP's entity ID and bearer `Recipient` matches the ACS that received the response.
Enforce `NotBefore`, `NotOnOrAfter` and the profile's subject-confirmation expiry; allow only a bounded, intentional clock skew.
For an SP-initiated request, match `InResponseTo` to the outstanding request and browser session. An unsolicited IdP response has no such request, so accept that flow only under an explicit policy.
Keep processed Response and assertion IDs for an appropriate window to prevent replay; this is operational protection, not a universal syntax requirement.
Map NameID or attributes through an agreed account-linking rule. Do not assume an email address or display name is immutable.
Audience failures usually point to mismatched entity IDs; Recipient failures to the registered/external ACS URL or proxy configuration; time failures to clock synchronization or expiry; signature failures to trust keys, rollover or the signed element; and account mismatches to identifier and linking policy. Never fix an error by skipping signature, audience or recipient checks. Core and Profiles are OASIS Standards dated 15 March 2005; the Technical Overview is Committee Draft 02 (2008), explanatory rather than normative. Follow the agreed profile and applicable approved errata.
Sources
[OASIS SAML V2.0 Profiles, §4.1](https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf)
[OASIS SAML V2.0 Core, §§2.3–2.5](https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf)
[OASIS SAML V2.0 Technical Overview, Committee Draft 02](https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html)