Reading an assertion
An assertion is Cedar Inc.'s signed statement about Avery, wrapped in a response. Reading one field by field shows who is speaking, about whom, for which service, for how long and how the browser may present it.
A response around an assertion
When Avery's browser posted the form to the training service's ACSThe endpoint at a SAML service provider that receives the identity provider's response, usually as a form the browser posts. The service provider publishes its ACS URL in metadata, and the identity provider sends responses only there., the SAMLResponse field held a long base64A way of encoding data as ordinary text characters so it can travel safely in headers, URLs, and JSON. Anyone can decode it, so it hides nothing; Base64url is a variant safe for URLs, used in JWTs. string. Decoded, it is an XML document, and it is worth reading slowly once, because every check in the rest of these lessons points at one part of it. XML namespaces, prefixes such as saml: and signing one element of a document by its ID are the pieces XML and XML signatures for identity took apart; this lesson reads them in a real response.
Here is the response Cedar Inc. sent, with the signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. values shortened:
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_r81d4b6e05c3" Version="2.0" IssueInstant="2026-10-12T09:00:02Z"
Destination="https://training.example/saml/acs"
InResponseTo="_a7f3c2e91b0d">
<saml:Issuer>https://login.cedar.example</saml:Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<saml:Assertion ID="_c5e27a9f4d18" Version="2.0" IssueInstant="2026-10-12T09:00:02Z">
<saml:Issuer>https://login.cedar.example</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#_c5e27a9f4d18">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>u5Qx0C9...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>kF2b7Lw...</ds:SignatureValue>
</ds:Signature>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
NameQualifier="https://login.cedar.example"
SPNameQualifier="https://training.example/saml">cedar-training-742</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData InResponseTo="_a7f3c2e91b0d"
Recipient="https://training.example/saml/acs"
NotOnOrAfter="2026-10-12T09:05:02Z"/>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2026-10-12T08:59:32Z" NotOnOrAfter="2026-10-12T09:05:02Z">
<saml:AudienceRestriction>
<saml:Audience>https://training.example/saml</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2026-10-12T08:55:41Z" SessionIndex="_s9b31e07"
SessionNotOnOrAfter="2026-10-12T17:00:00Z">
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute Name="urn:oid:0.9.2342.19200300.100.1.3" FriendlyName="mail"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml:AttributeValue>[email protected]</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="department"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue>finance</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>There are two layers. The outer Response is a protocolAn agreed set of rules for the messages two systems exchange and what each message means. HTTP, OAuth 2.0, OpenID Connect and SAML are all protocols. message: it answers the request _a7f3c2e91b0d, it was sent to the training service's ACS, and its Status says the request succeeded. A failed sign-in would have a different status codeThe three-digit number at the start of an HTTP response that says how the request went, such as 200 for success, 302 for a redirect, or 401 when authentication is needed. and no assertion. The inner Assertion is the statement about Avery, and it is the part that carries the signature: the Reference inside ds:Signature points at #_c5e27a9f4d18, the assertion's own ID.
Who says this about whom
Issuer names Cedar Inc. by its entity ID. It appears on both the response and the assertion, and the training service expects Cedar Inc.'s entity ID in both. On its own the issuerThe party that creates and signs a token, assertion, or certificate, named in a token's iss claim. A recipient must check that the issuer is exactly the one it expected and trusts. is a claim anyone can type; it becomes meaningful when the signature verifies with the key the agreement lists for that issuer.
Subject says whom the statement is about. The NameID cedar-training-742 is Avery's identifier for this relationship. Its Format says it is persistent, a stable value made for the training service alone. NameQualifier names the identity providerA service that authenticates users and tells other applications about the sign-in, so those applications never handle the users' passwords. In OpenID Connect it is called an OpenID Provider. that issued it and SPNameQualifier the service providerSAML's name for the application that relies on an identity provider's sign-in, which OpenID Connect calls a relying party. In SCIM, the same term means the application that stores the accounts. it was issued for. The training service stores all three, because the same characters from another identity provider would be a different person.
The response and the assertion each have their own ID, which is not Avery's identifier. The assertion's ID names this one statement, and the training service remembers it until the assertion expires so that a second copy can be refused. The SessionIndex names Avery's sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier. at Cedar Inc., which a later logout can refer to.
How the browser may present it
The assertion is a bearer assertion, as Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" says. Whoever presents it is accepted, as long as it is presented in the right way. SAMLThe Security Assertion Markup Language, a federation standard widely used for workplace single sign-on, in which the identity provider sends the application a signed assertion about the user.'s Web Browser SSOSigning in once and then using several applications without entering credentials again, usually because they all rely on the same identity provider. profile requires this SubjectConfirmation and its SubjectConfirmationData, which says exactly what the right way is:
Recipient: the ACS where it may be presented,https://training.example/saml/acs.NotOnOrAfter: the moment from which it may no longer be presented.InResponseTo: the request it answers. It is present because the training service asked; an unsolicited response leaves it out.
These look like copies of the response's Destination and InResponseTo, and the copies are deliberate. In this response only the assertion is signed. The outer Destination, InResponseTo and Status are not covered by any signature, so anyone carrying the message could change them without detection. Inside the assertion, the same facts are signed. The training service checks the signed ones.
When and where it may be used
Conditions restrict the assertion as a whole. NotBefore and NotOnOrAfter make a window, here from 08:59:32 to just before 09:05:02. NotOnOrAfter means what it says: at exactly 09:05:02 the assertion is already outside the window. Cedar Inc. set NotBefore half a minute early in case the training service's clock runs slightly behind, and the training service in turn may allow a small, explicit clock allowance, a minute or two, but never enough to turn a five-minute statement into a long-lived one.
AudienceRestriction lists who may rely on the assertion. Its Audience is the training service's entity ID. If the expense service, which also trusts Cedar Inc., received this assertion, it would find its own entity ID missing and refuse it. The audience names a service, and Recipient names an address; both must match. Conditions can also include OneTimeUse, asking the receiver to accept the assertion only once, though receivers should refuse repeats in any case.
What the authentication statement says
AuthnStatement says that an authenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do. happened. AuthnInstant is 08:55:41, when Avery actually signed in at Cedar Inc. The assertion's IssueInstant is 09:00:02, when Cedar Inc. wrote the statement. They differ because Cedar Inc. reused the session Avery started earlier. A freshly issued assertion can describe an old sign-in, so a service that needs a recent authentication checks AuthnInstant, not the issue time. SessionNotOnOrAfter suggests how long the training service's own session should last.
AuthnContext is required inside every authentication statement. Its AuthnContextClassRef says how Avery authenticated, here PasswordProtectedTransport, a password sent over a protected connection. SAML defines a list of such classes, and organizations often define their own, such as a URI meaning "multi-factor". A class name means only what the two parties have agreed it means, so the training service should compare it with values from the agreement rather than guess.
The AttributeStatement carries facts about Avery: her email address, under its standard object identifier name, and her department. An object identifier, or OID, is a dotted number such as 0.9.2342.19200300.100.1.3 registered in a public tree of names, so every system that reads it means the same attribute; the urn:oid: prefix marks it as one. A signature shows that Cedar Inc. stated them, not that every value is suitable for every decision. NameID and attributes looks at how to use them safely.
Encrypted assertions
Everything above passed through Avery's browser in readable form, base64 being an encoding rather than a protection. When the attributes are sensitive, or the path is not trusted, Cedar Inc. can encrypt the assertion to the training service. The response then carries an EncryptedAssertion in place of the Assertion:
<saml:EncryptedAssertion>
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
Type="http://www.w3.org/2001/04/xmlenc#Element">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#aes256-gcm"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<xenc:EncryptedKey>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#rsa-oaep"/>
<xenc:CipherData><xenc:CipherValue>Hs0Pq3...</xenc:CipherValue></xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData><xenc:CipherValue>9vTm2a...</xenc:CipherValue></xenc:CipherData>
</xenc:EncryptedData>
</saml:EncryptedAssertion>Cedar Inc. encrypts the assertion with a fresh AES key, then encrypts that key with the training service's public encryption key, which the training service published in its metadata for this purpose. Only the holder of the matching private key can open it. The training service decrypts first, then verifies the signature inside exactly as before. Encryption hides the content; it does not prove who wrote it. Anyone with the training service's public key could encrypt something, so the inner signature still decides.
Encryption also gives the training service its own key to manage, with its own rollover.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Separate a SAML subject, authentication and restrictionsSign in to a hosted SAML application, decode the response your browser carried, and find its issuer, audience, recipient, request, times, signature and attributes.