What are the main parts of a SAML 2.0 assertion, and which part names the person it describes?
answer
- a dated statement, not a session
- issuer, subject, conditions, statements
- the Subject carries the NameID
- Conditions bound validity and audience
- AuthnStatement and AttributeStatement carry the claims
basics
~20 sA SAML 2.0 assertion holds an Issuer naming who made the statement, a Subject naming who it is about, Conditions bounding when it may be relied on, and statements — an AuthnStatement and often an AttributeStatement — saying what it claims.
solid answer
~40 sA `<saml:Assertion>` is one XML document with an `ID`, an `IssueInstant` and `Version` of 2.0. `<Issuer>` names the party that made the statement, as an `entityID` URI. `<Subject>` names the human it is about: a `<NameID>` (or an `<EncryptedID>`) with a `Format`, plus a `<SubjectConfirmation>` whose `Method` in browser single sign-on is `urn:oasis:names:tc:SAML:2.0:cm:bearer` and whose `<SubjectConfirmationData>` carries `Recipient`, `NotOnOrAfter` and `InResponseTo`. `<Conditions>` bounds when the statement may be relied on and, through `<AudienceRestriction>`, by whom. The statements then say what is claimed: an `<AuthnStatement>` that this subject authenticated, and an `<AttributeStatement>` of `<Attribute>` values. Statements are optional in the core grammar, but the Web Browser SSO profile requires an `<AuthnStatement>`.
code
xml · 25 lines<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_8f3a2c91" IssueInstant="2026-09-19T08:14:02Z" Version="2.0">
<saml:Issuer>https://idp.haulier.example/saml</saml:Issuer>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">
9c41e0b7-driver
</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData Recipient="https://intake.coop.example/acs"
NotOnOrAfter="2026-09-19T08:19:02Z"
InResponseTo="_req41ab"/>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2026-09-19T08:13:52Z"
NotOnOrAfter="2026-09-19T08:24:02Z">
<saml:AudienceRestriction>
<saml:Audience>https://intake.coop.example/sp</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2026-09-19T08:13:58Z" SessionIndex="_s77c2">
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
</saml:Assertion>go deeper
Be able to point at the four parts — who issued it, who it is about, when it may be relied on, and what it claims — and say that the NameID inside the Subject is what names the person.
Explain that statements are optional in the grammar while the Web Browser SSO profile requires an AuthnStatement, and that the NameID Format decides whether the identifier is stable across logins.
Show that you read an unfamiliar assertion element by element before wiring anything to it, and that you know which field a local record may safely be keyed on.
Frame which identifier formats and which attributes you are willing to accept from a counterparty at all, because each one becomes a field your own records then depend on.
## What the document is A SAML 2.0 assertion is a single XML element, `<saml:Assertion>`, in the namespace `urn:oasis:names:tc:SAML:2.0:assertion`. In it, one party states — at one moment, about one subject — a fixed set of things. It is not a session, not a key, and not an OAuth2 access token. It is a **dated statement with a bounded life, addressed to a named reader**. The element itself carries three attributes: - `ID` — a unique identifier for this assertion, the handle everything else refers to it by. - `IssueInstant` — a UTC instant saying when it was created. - `Version` — `2.0`. Picture a grain co-operative's intake office. A haulier's driver rolls onto the weighbridge, and the intake system has to know, from a statement issued minutes earlier somewhere else, who is driving and which haulier they represent. Every part below is a part of that statement. ## Who is speaking, and about whom `<Issuer>` names the party that made the statement: an `entityID` URI naming an organisation's identity provider, never a person. `<Subject>` names who the statement is about, and it does two jobs. 1. **Identify.** A `<NameID>` — or an `<EncryptedID>` where the identifier itself is hidden from anything between the two parties — whose `Format` attribute says what kind of identifier it is. `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` is a stable pseudonym for this subject between this pair of parties; `urn:oasis:names:tc:SAML:2.0:nameid-format:transient` is good for this login only; `urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress` is an address. 2. **Say how the holder may be confirmed as that subject.** `<SubjectConfirmation>` with `Method` set to `urn:oasis:names:tc:SAML:2.0:cm:bearer` in browser single sign-on, meaning whoever delivers this document is treated as the subject. Its `<SubjectConfirmationData>` carries `Recipient` (the endpoint this copy was meant for), `NotOnOrAfter` (how long delivery may take), `InResponseTo` and optionally `Address`. The other defined method, `urn:oasis:names:tc:SAML:2.0:cm:holder-of-key`, instead requires the presenter to prove possession of a key. ## What is claimed The statements carry the content: - `<AuthnStatement>` — this subject authenticated to the issuer. `AuthnInstant` says when, `SessionIndex` names the issuer's session, `SessionNotOnOrAfter` bounds that session, and `<AuthnContextClassRef>` says by what class of method. - `<AttributeStatement>` — a list of `<Attribute>` elements, each with a `Name` and usually a `NameFormat`, each holding `<AttributeValue>` children: the haulier's identifier, the driver's licence class, the depots they may enter. Statements are optional in the core grammar; an assertion may carry none. The Web Browser SSO profile is what requires an `<AuthnStatement>`, and attributes travel only where the two parties agreed in advance which ones and under which `Name` values. ## What bounds it `<Conditions>` is the fence around the statement: - `NotBefore` and `NotOnOrAfter` — the window inside which the statement may be relied on at all. - `<AudienceRestriction>` holding `<Audience>` values — the parties it is addressed to, as `entityID` URIs. - `<OneTimeUse>` — a signal that the relying party must not keep it around in a form that could be used again. - `<ProxyRestriction>` — a limit on further assertions issued onward from this one. `<Advice>` may carry supporting material the relying party is free to ignore. | Element | Names or bounds | Value shape | |---|---|---| | `<Issuer>` | who made the statement | an `entityID` URI | | `<NameID>` | who the statement is about | an identifier plus a `Format` | | `<SubjectConfirmationData>` | where and how long this copy may be delivered | `Recipient`, `NotOnOrAfter`, `InResponseTo` | | `<Conditions>` | when, and to whom, it may be relied on | two instants and `<Audience>` URIs | | `<AuthnStatement>` | that the subject authenticated | `AuthnInstant`, `SessionIndex` | | `<AttributeStatement>` | what else is claimed | `<Attribute>` and `<AttributeValue>` | ## Order matters when you read one The children appear in a fixed order: `<Issuer>` first, then a signature if one is present, then `<Subject>`, `<Conditions>`, `<Advice>`, then the statements. How the assertion is signed or encrypted, and how that is checked, is a separate subject from the grammar described here. ## What it is not - **Not a session.** The assertion is a statement delivered once. Any session the intake system then keeps is its own, with its own lifetime. - **Not a permission list.** The attributes are the issuer's claims about the driver; whether that driver may book an intake slot is the intake system's decision. - **Not open-ended.** Without the `<Conditions>` window and `<AudienceRestriction>`, the same document read later or elsewhere still parses — which is exactly why those elements exist.
- Does a SAML assertion have to contain an `<AttributeStatement>`?No. The core grammar makes statements optional, and an assertion may carry none at all. What the Web Browser SSO profile does require is an `<AuthnStatement>`. Attributes travel only where the two parties agreed in advance which ones are sent and under which `Name` values, so an assertion with no attributes is ordinary, not malformed.
- What does a `<NameID>` with `Format` set to `urn:oasis:names:tc:SAML:2.0:nameid-format:transient` mean for recognising the same driver next week?Nothing carries over. A transient identifier is a one-login pseudonym and will be a different value at the next sign-in, so a local record cannot be keyed on it. `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` is the format that gives a stable pseudonymous value for the same subject between the same two parties.
saying these in an interview costs you the question
- Treats the enclosing Response message and the assertion inside it as one element.
- Calls the NameID a display name meant for the user interface.
- Assumes every assertion must carry an AttributeStatement.
- Thinks an assertion stays usable until the user logs out.
- Confuses the Issuer with the party the assertion is addressed to.