Beta

Create a tenant

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

The service provider rejects a SAML response

Keiko gets through her company's sign-in, and the photo service's workspace refuses the SAML response her browser brings back. This lesson reads a rejected response in the order a service provider checks it: the status first, then the time conditions, the audience and recipient, and which element the service provider requires signed.

The assertion arrives and is rejected

The printing company's staff sign in to the photo service's business workspace with their company accounts. The printing company runs the identity provider, or IdP, at https://idp.printer.example/saml. The photo service's workspace is the service provider, or SP. Over the weekend both sides changed. The photo service moved its SAML handling to a new library on two new servers, sp-1 and sp-2, and gave the workspace a new entity ID, https://auth.photos.example/saml/sp, and a new assertion consumer service (ACS) address, https://auth.photos.example/saml/acs. The printing company's IT team imported the new metadata into their registration for the workspace.

On Monday morning the tickets start. Keiko, who manages print orders, writes: "I click Sign in, I get our usual company sign-in page and approve the prompt on my phone, then the photos workspace says The sign-in could not be verified."

That is a different failure from the one in Repairing a SAML connection, where the identity provider refused the service provider's request and nobody ever got a response to look at. Keiko got through her company's sign-in and her browser came back to the workspace. The IdP answered, the browser posted that answer to the ACS, and the SP refused it. So there is a message to read: the samlp:Response. The SP's log records why it refused each one:

09:05-09:35  sp.acs.reject  reason=status_not_success  status=Responder/InvalidNameIDPolicy
                            initiated=sp   count=38
09:05-09:35  sp.acs.reject  reason=audience_mismatch   initiated=idp  count=11

There are two groups, and they split by how sign-in started. Most staff click Sign in on the workspace, so the SP sends an authentication request first. That is SP-initiated sign-in. Some start from a tile in the printing company's staff portal, so the IdP sends a response nobody asked for. That is IdP-initiated sign-in. Two groups usually mean two faults.

To see the messages themselves, reproduce the failure with a test account and read the SP's debug record or a SAML tracing tool in your own browser. Do not ask staff to export their responses. A valid response carries a bearer assertion, and anyone who holds it can use it until it expires.

Read the status before the assertion

Here is the SP-initiated exchange for the test account. First the request the SP sent:

<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="_a71c2e90f3" Version="2.0" IssueInstant="2026-10-19T09:12:02Z"
    Destination="https://idp.printer.example/saml/sso"
    AssertionConsumerServiceURL="https://auth.photos.example/saml/acs"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST">
  <saml:Issuer>https://auth.photos.example/saml/sp</saml:Issuer>
  <samlp:NameIDPolicy
      Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
      AllowCreate="true"/>
</samlp:AuthnRequest>

And the response the IdP posted back:

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="_r5d0b84c21" InResponseTo="_a71c2e90f3" Version="2.0"
    IssueInstant="2026-10-19T09:12:09Z"
    Destination="https://auth.photos.example/saml/acs">
  <saml:Issuer>https://idp.printer.example/saml</saml:Issuer>
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Responder">
      <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"/>
    </samlp:StatusCode>
    <samlp:StatusMessage>Requested NameID format is not configured for this application</samlp:StatusMessage>
  </samlp:Status>
</samlp:Response>

Read samlp:Status before anything else. The top-level status code is one of a few broad values: Success, Requester (the problem is in the request), Responder (the responder could not or would not do it) or VersionMismatch. A nested second-level code narrows it down, and that is the one to act on. InvalidNameIDPolicy means the IdP cannot or will not produce the name identifier the request asked for. Some identity providers put Requester above it instead of Responder. The second-level code is the same either way.

Notice what is missing: there is no saml:Assertion at all. The IdP authenticated Keiko and then declined to issue anything. No signature was checked and no certificate was involved, so rotating or re-importing certificates would change nothing.

The request explains the refusal. A NameIDPolicy asks for a particular NameID format, the kind of identifier that will name the user in the assertion. The new SP library asks for emailAddress by default. The printing company's registration for the workspace is configured to send persistent identifiers: opaque, stable values that never change when someone's email address does. Every workspace account is linked to one of those values. The fix is to make the SP request the format the application is configured for. Here that means setting the SP to request persistent. Switching the IdP to send email addresses instead would also make the error stop, but every staff member would then arrive under an identifier their workspace account was never linked to.

Time conditions and clock skew

With the NameID policy aligned and the signature setting below agreed, SP-initiated sign-in works for some attempts and fails for others, roughly one in two. The test account's next response does contain an assertion, and the parts that matter here are its time conditions:

<saml:Assertion ID="_as93e1f7b2" IssueInstant="2026-10-19T09:52:07Z" Version="2.0">
  <saml:Issuer>https://idp.printer.example/saml</saml:Issuer>
  <ds:Signature>...</ds:Signature>
  <saml:Subject>
    <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">p-4f81c0d9</saml:NameID>
    <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
      <saml:SubjectConfirmationData InResponseTo="_b2f04a6e18"
          NotOnOrAfter="2026-10-19T09:57:07Z"
          Recipient="https://auth.photos.example/saml/acs"/>
    </saml:SubjectConfirmation>
  </saml:Subject>
  <saml:Conditions NotBefore="2026-10-19T09:51:07Z" NotOnOrAfter="2026-10-19T09:57:07Z">
    <saml:AudienceRestriction>
      <saml:Audience>https://auth.photos.example/saml/sp</saml:Audience>
    </saml:AudienceRestriction>
  </saml:Conditions>
  ...
</saml:Assertion>

There are three time limits. Conditions says the assertion is valid from NotBefore until just before NotOnOrAfter. The bearer SubjectConfirmationData has its own NotOnOrAfter, the deadline for presenting the assertion at the ACS. An SP checks them against its own clock with a small allowance for skew, often a minute or two. This assertion was issued at 09:52:07 and the browser posted it two seconds later, well inside its five-minute window. The SP's log shows what happened next:

09:52:10  host=sp-1  sp.acs.accept  assertion=_as93e1f7b2  subject=p-4f81c0d9
09:59:31  host=sp-2  sp.acs.reject  reason=assertion_expired  assertion=_c80d2a5e41
          not_on_or_after=09:57:07Z  skew_allowed=90s

Every rejection came from sp-2, and sp-2 believed it was 09:59 for a response that arrived at 09:52. Its clock was seven minutes fast. The new server had been built without a time source, and it drifted from the start. Load balancing between the two servers explains the one-in-two pattern.

The same rejection appears for other reasons too. A response can be held too long: a browser that stalled on the page that posts it, a proxy that queued it, a user who walked away before the post completed, or someone replaying a captured response later. A clock that runs slow on either side produces the mirror image, a NotBefore that seems to lie in the future. In every version, fix the clock or find what held the response. Do not widen the allowed skew to an hour. The short window is what limits how long a captured assertion is worth anything.

Audience and Recipient after an entity ID change

The second group in the first log, audience_mismatch, came only from staff who started at the portal tile. Their responses arrive with valid signatures and fresh timestamps, but they name the wrong service:

<samlp:Response ... Destination="https://photos.example/saml/acs">
  ...
      <saml:SubjectConfirmationData NotOnOrAfter="2026-10-19T09:20:41Z"
          Recipient="https://photos.example/saml/acs"/>
  ...
    <saml:AudienceRestriction>
      <saml:Audience>https://photos.example/saml/metadata</saml:Audience>
    </saml:AudienceRestriction>

Three values address an assertion. Audience names the SP the assertion is for, by its entity ID. Recipient on the bearer confirmation, and Destination on the signed response, name the ACS address it was meant to be delivered to. The SP compares all three with its own configuration. These carry the old entity ID and the old ACS.

The printing company's registration explains why. When IT imported the new metadata, the new entity ID and ACS were added alongside the old ones, and the old ones stayed marked as the defaults. For SP-initiated sign-in, the IdP answers with the identifier and ACS that the request names, so those responses are addressed correctly. A portal tile sends no request, so the IdP falls back to the defaults. The old hostname still reaches the photo service, so the response landed at the new SP, which refused it as not meant for it.

That refusal is exactly right. A signed assertion addressed to another service provider is not a credential for this one, and an SP that skipped the audience check could be signed in to with an assertion stolen from any other application the same IdP serves. The repair is in the registration: make the new entity ID and ACS the defaults, then remove the old ones once nothing uses them. Adding the old entity ID to the SP's accepted audiences would also silence the error, at the cost of keeping a retired identifier alive with no end date.

The morning's two groups of refusals. The SP-initiated response carried a status and no assertion; the tile response carried an assertion addressed to the old entity ID. Each needed its own repair, on a different side.

Which signature the SP requires

Once the NameID fix landed, every SP-initiated attempt failed again, this time for one reason:

09:41:18  host=sp-1  sp.acs.reject  reason=assertion_not_signed
          response_signature=valid  assertion_signature=absent  want_assertions_signed=true

SAML lets an identity provider sign the whole Response, the Assertion inside it, or both. When the response travels through the browser by HTTP POST, as here, the assertion must be protected by a signature, and either placement does that, because a signature on the response covers everything inside it. The printing company's IdP signed only the response:

<samlp:Response ID="_r9a3f61b07" ...>
  <saml:Issuer>https://idp.printer.example/saml</saml:Issuer>
  <ds:Signature>
    <ds:SignedInfo> ... <ds:Reference URI="#_r9a3f61b07"> ... </ds:SignedInfo> ...
  </ds:Signature>
  <samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>
  <saml:Assertion ID="_as51c8e0d3" ...>
    <saml:Issuer>https://idp.printer.example/saml</saml:Issuer>
    <!-- no ds:Signature inside the assertion -->
    ...
  </saml:Assertion>
</samlp:Response>

The new SP library's metadata says WantAssertionsSigned="true", so it requires a signature on the assertion itself and ignores the one around it. The reverse mismatch also happens: an SP configured to require a signed response, given a response where only the assertion is signed. Neither side is wrong in isolation. They disagree, and both must use the same rule. Here the printing company switched its IdP to sign the assertion as well as the response, which matches what the SP published.

There is a reason SPs care where the signature sits. The signature that counts is the one whose Reference URI points at the element you go on to trust. An SP that only confirms "there is a valid signature somewhere in this message" and then reads whichever assertion it finds first can be fooled by signature wrapping: an attacker keeps a genuinely signed element in the message and adds a forged, unsigned assertion where the SP will read it. Whatever the configuration, validation must check that the signature it verified covers the exact assertion it then uses. Turning off the signature requirement to get past this error is never the repair.

Worked example: the incident ledger

The ledger both teams keep for the morning records each refusal in the order it appeared, what proved its cause, and who changed what.

Service provider rejections after the SAML reconfiguration, in order
SP log reasonEvidenceCauseRepair
status_not_success, SP-initiatedResponder with InvalidNameIDPolicy, no assertionNew SP library requests emailAddress; application sends persistentPhoto service: request persistent
audience_mismatch, IdP-initiatedAudience, Recipient and Destination carry the old valuesOld entity ID and ACS still the registration's defaultsPrinting company: new values made default, old ones scheduled for removal
assertion_not_signedResponse signed, assertion not; SP wants signed assertionsSignature placement disagreementPrinting company: sign the assertion too
assertion_expired, sp-2 onlyArrival at 09:52 seen as 09:59No time source on the new serverPhoto service: time sync on sp-2; skew allowance unchanged

To verify, sign in with the test account both ways, from the workspace and from the portal tile, several times so both servers handle it. Check that the account lands on the same workspace profile as before the weekend, which proves the persistent identifier still matches. Then repeat one attempt that must still be refused: replay the test account's captured response after its NotOnOrAfter. The SP rejects it as expired, on both servers. Not changed: the IdP's signing certificate, the SP's trusted certificate and the skew allowance.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Staff authenticate at the IdP, and the SP receives a response whose top-level StatusCode is urn:oasis:names:tc:SAML:2.0:status:Responder with a nested InvalidNameIDPolicy code and no assertion. What should the team change first? 1 of 3

Choose one answer.

After the SP changed its entity ID, SP-initiated sign-in works but sign-in from the IdP's portal tile fails with audience_mismatch. The assertions' Audience carries the old entity ID. Where is the repair? 2 of 3

Choose one answer.

The SP logs assertion_not_signed with response_signature=valid and want_assertions_signed=true. The IdP signs only the outer Response. What is the repair? 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