The service provider rejects a SAML response
Keiko gets through her company's sign-in, and the photo service's workspace refuses the 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. 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 serviceThe 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. (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=11There are two groups, and they split by how sign-in started. Most staff click Sign in on the workspace, so the SP sends 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. 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 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. 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 certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name. 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=90sEvery 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.
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=trueSAML lets an identity provider sign the whole Response, the Assertion inside it, or both. When the response travels through the browser by HTTPThe Hypertext Transfer Protocol, the rules browsers, apps, and servers use to send requests and responses on the web. 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.
| SP log reason | Evidence | Cause | Repair |
|---|---|---|---|
status_not_success, SP-initiated | Responder with InvalidNameIDPolicy, no assertion | New SP library requests emailAddress; application sends persistent | Photo service: request persistent |
audience_mismatch, IdP-initiated | Audience, Recipient and Destination carry the old values | Old entity ID and ACS still the registration's defaults | Printing company: new values made default, old ones scheduled for removal |
assertion_not_signed | Response signed, assertion not; SP wants signed assertions | Signature placement disagreement | Printing company: sign the assertion too |
assertion_expired, sp-2 only | Arrival at 09:52 seen as 09:59 | No time source on the new server | Photo 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.
Try it in the Lab
- Find why the service provider rejects a SAML responsePartner users authenticate, then Lab Photos refuses the response. Read the status before the assertion, align the NameID format, then see an assertion fail its time conditions after a stalled POST.