Skip to content

SAML assertion validity checker

Check an assertion’s NotBefore, NotOnOrAfter and IssueInstant against the current time, or another time, with the clock skew your app allows.

Runs in your browser. Nothing you paste is sent to us.

Assertion

A made-up response issued a minute ago is filled in. Paste a response or a bare assertion; it stays in your browser.

Check

Slack for clocks that disagree. Keycloak calls it Allowed clock skew on a SAML identity provider.

NotBefore is inclusive and NotOnOrAfter exclusive: an assertion is valid from NotBefore up to, but not at, NotOnOrAfter. SessionNotOnOrAfter limits the service provider’s session, not the assertion.

How to use it

  1. Paste the SAMLResponse value or the assertion XML.
  2. Set the clock skew your app or Keycloak allows, in seconds.
  3. Check against now, or pick another time, such as when the error happened.
  4. Read which limit fails, and by how much.

What to know

An assertion carries its own time limits. Conditions sets when the assertion may be used, from NotBefore up to but not including NotOnOrAfter. SubjectConfirmationData sets when the browser may deliver it to the app.

Errors such as "assertion expired" or "not yet valid" right after sign-in usually mean the clocks of the identity provider and the app disagree. Fix the clock with NTP first; clock skew is a margin, not a cure.

When Keycloak is the service provider for another SAML identity provider, the identity provider’s Allowed clock skew setting adds that margin. SAML times are always UTC, written with a Z at the end.

Why SAML assertions expire

A SAML assertion is a signed statement that a user signed in. Anyone who holds it while it is valid could try to use it. Short validity windows limit that risk: a copied assertion is worthless a few minutes later.

So every assertion carries time limits, and every app must check them. When the clocks of the identity provider and the app disagree, those checks fail for valid assertions, which is one of the most common SAML errors in production.

The time fields in a response

A response can carry several times. They mean different things, and only some of them are limits.

Time fields (sample, shortened)
<samlp:Response IssueInstant="2026-11-25T10:00:00Z" …>
  <saml:Assertion IssueInstant="2026-11-25T10:00:00Z" …>
    <saml:Subject>
      <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
        <saml:SubjectConfirmationData NotOnOrAfter="2026-11-25T10:05:00Z" …/>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:Conditions NotBefore="2026-11-25T10:00:00Z"
                     NotOnOrAfter="2026-11-25T10:05:00Z">…</saml:Conditions>
    <saml:AuthnStatement AuthnInstant="2026-11-25T10:00:00Z"
                         SessionNotOnOrAfter="2026-11-25T20:00:00Z">…</saml:AuthnStatement>
  </saml:Assertion>
</samlp:Response>
FieldWhereWhat it limits
IssueInstantResponse and assertionNothing directly; when it was made. Apps may refuse very old or future ones.
NotBeforeConditionsThe assertion is not valid before this time.
NotOnOrAfterConditionsThe assertion is not valid at or after this time.
NotOnOrAfterSubjectConfirmationDataThe time by which the assertion must be delivered to the app.
AuthnInstantAuthnStatementNothing; when the user actually authenticated.
SessionNotOnOrAfterAuthnStatementHow long the app’s own session may last. Not a limit on the assertion.

Inclusive and exclusive limits

SAML 2.0 core defines the window exactly. NotBefore is inclusive: the assertion is valid from that instant. NotOnOrAfter is exclusive: the assertion is valid only strictly before that instant, as the name says.

All SAML times are xs:dateTime values in UTC, written with a Z and no offset. A time without a zone is ambiguous, and different libraries read it differently. The tool flags such values.

Clock skew

No two servers have exactly the same time. Clock skew is a margin the app adds when it checks the window: it accepts an assertion a little before NotBefore and a little after NotOnOrAfter. A few seconds to a couple of minutes is typical.

Skew is a tolerance, not a fix. If the clocks are minutes apart, a large skew hides the problem and makes stolen assertions usable for longer. Sync both servers with NTP first, then keep the skew small.

Clock skew in Keycloak

When Keycloak is the service provider, brokering sign-in through another SAML identity provider, the identity provider’s settings include Allowed clock skew, in seconds. It applies when Keycloak checks the assertions it receives from that provider.

When Keycloak is the identity provider, the app checks the times, so the skew is the app’s setting. Keycloak stamps its assertions with its host’s clock, so that host needs time sync too.

What this tool does

Paste a response or a bare assertion, as Base64 or XML. The tool reads every time field, compares each limit with the time you choose, and shows which ones pass and which fail, by how much, with the clock skew you set. It works with several assertions in one response.

You can check against now, which updates every second, or against another time, such as the moment an error was logged. A button loads a fresh sample so you can see a passing case.

What it does not do

It does not check the signature, audience or recipient. A valid time window is only one of the checks an app must make. It cannot read the times of an encrypted assertion.

How to use it

  1. Capture the response: in developer tools, copy the SAMLResponse value from the POST to the app’s ACS URL.
  2. Paste it into the tool.
  3. Enter the clock skew the app allows, in seconds.
  4. Pick Now, or pick Another time and enter when the error happened, in your local time.
  5. Read the verdict and the row that fails.

Diagnosing time errors

Not yet valid right after sign-in

If the app says the assertion is not yet valid, the app’s clock is behind the identity provider’s: from the app’s point of view, NotBefore is still in the future. Check the app server’s time sync.

Expired right after sign-in

If the app says the assertion has expired a moment after the user signed in, the app’s clock is probably ahead. Compare NotOnOrAfter with the time the response arrived. If the window itself is very short, the identity provider’s assertion lifetime may be set too low.

Expired after a delay

If the error appears only sometimes, look for late delivery. The window starts when the identity provider issues the response, after the user has finished signing in. A browser that stays on the auto-submit page, or that resubmits an old form from its history, delivers the assertion late.

Replay errors

Apps store the IDs of assertions they have accepted until NotOnOrAfter passes, and refuse to accept one twice. Pressing back and resubmitting the form, or a proxy retrying the POST, triggers this. It is the app protecting itself, not a time problem.

Best practices

  • Sync every server with NTP, including the identity provider, the app and any proxy that checks assertions.
  • Keep assertion lifetimes short, a few minutes at most. The app’s own session handles the rest.
  • Use a small clock skew, and raise it only after you have fixed the clocks.
  • Log the times from the assertion and the server time together when a check fails.
  • Use SessionNotOnOrAfter for the app session length when the identity provider sends it.
  • Containers use the host’s clock. Fix time sync on the host or cluster node, not inside the container.
  • Virtual machines paused or restored from a snapshot can resume with an old time. Resync the clock after resume.

Security notes

A bearer assertion works for whoever presents it. Time limits, audience checks, recipient checks and one-time use together keep a copied assertion from being useful. Raising the clock skew or the lifetime weakens the first of these, so do it only with a reason.

How an app checks the window

Every SAML library does roughly the same thing when an assertion arrives. Written out, with now as the app’s clock and skew as its allowance:

The checks, in pseudo-code
if Conditions.NotBefore exists and now + skew < NotBefore: reject "not yet valid"
if Conditions.NotOnOrAfter exists and now - skew >= NotOnOrAfter: reject "expired"
for the bearer SubjectConfirmationData:
  if now - skew >= NotOnOrAfter: reject "confirmation expired"
  if Recipient != this ACS URL: reject
if assertion ID was seen before: reject "replay"

The order and wording differ between libraries, and some also refuse assertions whose IssueInstant is far in the past or future. The tool applies the same window checks so you can see which one an app would hit.

What to log when a time check fails

Time errors are hard to debug after the fact unless the logs have the right values. When you control the app, log these together on every rejected assertion:

  • The server time at the moment of the check, in UTC.
  • The NotBefore and NotOnOrAfter values that were compared.
  • The clock skew in use.
  • The assertion ID and IssueInstant.

With these, a glance shows whether the server clock was off, the assertion arrived late, or the identity provider issued a very short window. Paste the logged response into this tool with Another time set to the logged server time to reproduce the decision exactly.

Questions

Frequently asked questions

What does NotOnOrAfter mean in SAML?

The assertion or confirmation is valid only before this time. At that instant and after, it must be refused. It is always a UTC time.

Is NotBefore inclusive?

Yes. The assertion is valid from the NotBefore instant. NotOnOrAfter is the exclusive end of the window.

Why does my app say the SAML assertion is not yet valid?

The app’s clock is behind the identity provider’s, so NotBefore looks like the future. Sync the app server with NTP; a small clock skew can cover the remaining difference.

Why does my app say the SAML assertion has expired?

Either it was used after NotOnOrAfter, for example after a delay or a replay, or the app’s clock is ahead. Check both times here against when the error happened.

What is the difference between NotOnOrAfter and SessionNotOnOrAfter?

NotOnOrAfter limits when the assertion can be accepted, usually minutes. SessionNotOnOrAfter tells the app how long its own session for the user may last, often hours.

How much clock skew should I allow?

Keep it small, seconds rather than minutes. Fix clocks with NTP first; skew should only cover small differences that remain.

Where do I set clock skew in Keycloak?

For a SAML identity provider that Keycloak brokers, in that identity provider’s settings under Allowed clock skew, in seconds. When Keycloak is the identity provider, the app sets its own skew.

Are SAML times always in UTC?

Yes. SAML 2.0 requires xs:dateTime values in UTC without a time zone offset, written with a Z at the end.

What is IssueInstant used for?

It records when the identity provider created the response or assertion. It is not a limit by itself, but some apps refuse messages whose IssueInstant is far from their own clock.

Why does my SAML login fail with a time error only sometimes?

Clocks drift between syncs, and some deliveries are late. If the difference is close to the edge of the window, only some sign-ins fail. Check time sync on every server involved.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.