Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

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 ACS, the SAMLResponse field held a long base64 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 signature values shortened:

xml
<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 protocol 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 code 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.

The parts of a signed SAML response and the check that reads each one. Here only the assertion is signed, so the values outside it are not protected by the signature.

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 issuer 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 provider that issued it and SPNameQualifier the service provider 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 session 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. SAML's Web Browser SSO 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 authentication 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:

xml
<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.

Only the assertion is signed. The response's Destination says one ACS and the assertion's SubjectConfirmationData Recipient says another. Which should the training service rely on? 1 of 3

Choose one answer.

An assertion has IssueInstant 09:00:02 and AuthnInstant 08:55:41. The training service needs a sign-in from the last minute. What should it conclude? 2 of 3

Choose one answer.

The training service decrypts an EncryptedAssertion with its own private key, and the assertion inside has no valid signature. Should it accept the assertion? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity