Interface AuthnRequestStore

All Known Implementing Classes:
InMemoryAuthnRequestStore

public interface AuthnRequestStore
SPI for the registry of outstanding SAML authentication request IDs.

SamlAssertionValidator.rememberAuthnRequest(String) records the ID of each request this SP sends, and a response whose confirmation carries a matching InResponseTo consumes it. Each ID is accepted once. Multi-node deployments should supply an implementation backed by a store shared across every node, since the response may arrive at a different node than the one that sent the request.

Implementations must be thread-safe.

Since:
10.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    consume(String id, long nowMs)
    Atomically removes a request ID and reports whether it was outstanding.
    void
    remember(String id, long expiresAtMs, long nowMs)
    Records an outstanding request ID.
  • Method Details

    • remember

      void remember(String id, long expiresAtMs, long nowMs)
      Records an outstanding request ID.
      Parameters:
      id - The ID attribute of the outgoing request. Never null or blank.
      expiresAtMs - The epoch-millisecond instant after which the ID is no longer accepted.
      nowMs - The current epoch-millisecond instant according to the validator's clock.
      Throws:
      IllegalStateException - If the store cannot accept more outstanding requests.
    • consume

      boolean consume(String id, long nowMs)
      Atomically removes a request ID and reports whether it was outstanding.
      Parameters:
      id - The InResponseTo value from the response. Never null or blank.
      nowMs - The current epoch-millisecond instant according to the validator's clock.
      Returns:
      true if the ID was registered, unexpired and not yet consumed.