13.1. Record and read subordinate event history
Feature guides / 13. Subordinate Events · Example context
Umeå University OP's registration changed during a key rollover. eduGAIN records the event so an authorized reader can inspect what the authority reported about that subordinate over time.
How to use it
The lifecycle methods record configured events transactionally. recordSubordinateEvents() can add observations without changing registration state. getSubordinateEvents() signs the response; fetchSubordinateEvents() verifies a remote response with the configured issuer and keys. Subordinate Events Draft 01.
import { entityId } from "@oidfed/core";
import type { TrustAnchor, Intermediate } from "@oidfed/authority";
export async function umeaOpHistory(authority: TrustAnchor | Intermediate) {
return authority.getSubordinateEvents(entityId("https://op.umu.example"));
}
eduGAIN can give each signed history response a five-minute lifetime by setting subordinateEventsTtlSeconds: 300 in its TrustAnchor or Intermediate configuration. The response then carries exp = iat + 300; the historical events keep their original occurrence times. Leave the option unset to omit exp, as the draft permits.
Manual recording captures nested event data when called. If an HTTP reader cancels while waiting for storage or keys, the handler stops waiting and avoids starting a signature afterward. This leaves the recorded history intact.
What your application owns
Choose storage retention, access rules, and an operational meaning for any custom events. Preserve issuer/subject isolation and transaction guarantees. A recorded suspension does not automatically disable a registration. Revocation through revokeSubordinate() removes the current registration while preserving history. Signed history attests to the authority's account; it is not retrospective proof of every trust-validation step. The draft defines retrieval, not push notifications.
Use events to trigger reassessment
LIGO Wiki retrieves the complete history for a subject and compares it with the history it has already processed. The endpoint has no cursor or “events since” selector. Track processing progress locally, preserve repeated events and equal timestamps, and save progress only after handling the response successfully. An iat value alone is not a unique event identifier.
An event is a change signal from the issuer, not a replacement for the current Subordinate Statement or the application's trust decision. Make processing idempotent because retries can revisit an event. Keep publication and event persistence in the same storage transaction where the lifecycle API requires it; a durable enrollment change without its required history leaves consumers with an incomplete account.
Retrieve and verify a history response
Draft 01 defines signed histories published by authorities about their Immediate Subordinates. fetchSubordinateEvents fetches and verifies a response using independently trusted issuer keys:
import type { CryptoEngine } from "@oidfed/crypto";
import { entityId, fetchSubordinateEvents } from "@oidfed/core";
import { type JWKSet } from "@oidfed/core";
export async function readSubordinateHistory(engine: CryptoEngine, trustedAuthorityJwks: JWKSet) {
const result = await fetchSubordinateEvents(
"https://ta.example.org/history",
entityId("https://client.example.org"),
{
engine,
issuer: entityId("https://ta.example.org"),
issuerJwks: trustedAuthorityJwks,
},
);
if (!result.ok) throw new Error(result.error.description);
console.log(result.value.federation_registration_events);
return result;
}
trustedAuthorityJwks must come from a trusted source. The client checks the signature, JWT type, payload schema, expected issuer, requested subject, and applicable dates. The endpoint origin is not a substitute for the issuer Entity Identifier. A supplied clientAssertion switches the request to authenticated form POST; create the assertion with the authority's Entity Identifier as its audience. Existing timeout, response-size, cancellation, and fetch-URL protections apply. Both request modes reject redirects to prevent assertion forwarding and requests to unvalidated destinations. Use the final advertised endpoint URL; it must have no fragment, including an empty trailing #. Encoded %23 characters in paths or query parameters remain valid.
Use verifySubordinateEventsResponse(jwt, trustedAuthorityJwks, { engine, issuer, subject }) for a JWT obtained separately. Both helpers accept the existing clock and clock-skew options. Required response claims are iss, sub, iat, and federation_registration_events; exp is optional. Response issuance and event occurrence times are separate. Numeric timestamps may be fractional or negative and must be finite.
Core exports SubordinateEventSchema, SubordinateEventsResponseSchema, their inferred types, and standard SubordinateEventType constants. The event field also accepts operator-defined strings. The standard key-change name is jwks_update, as defined in §2.3.3; names in received history are preserved. The registration exclusion in that section is applied by authority capture to its initial registration operation, without rejecting separate events merely for equal timestamps.
information_uri is optional and recommends HTTPS; HTTP URLs and fragments remain valid. The client does not dereference it. The shared MediaType.EntityEventsStatement and JwtTyp.EntityEventsStatement constants identify the response. Decoding alone does not verify history, and signed history does not establish past trust-chain validity.
Lifecycle recording and endpoint responses
Automatic jwks_update capture compares the published public JWK Set, including lifecycle dates and extension members. Reordering keys alone creates no event. Invalid replacement keys fail within the transaction, preserving both the record and its history.
The optional Subordinate Events Endpoint, Draft 01 publishes an authority's recorded history about its Immediate Subordinates. Both TrustAnchor and Intermediate support it. Enable event storage and advertise federation_subordinate_events_endpoint in the authority's own metadata:
import { MemoryFederationStorage } from "@oidfed/core";
export const storage = new MemoryFederationStorage({ namespace: "https://edugain.example" });
// Configure metadata.federation_entity.federation_subordinate_events_endpoint
// on the host that receives this adapter, for example https://edugain.example/history.
The memory adapter is for development and tests. Production adapters implement the optional subordinateEvent repository in both the adapter and its transactions. Advertising the endpoint without event storage fails at construction.
Use the authority instance's lifecycle methods to record changes automatically:
| Method | Behavior |
|---|---|
registerSubordinate(record) |
Adds a registration and records registration, including its initial configuration. |
updateSubordinate(subject, updates) |
Records changes to attested metadata, metadata policy, and registered public keys as metadata_update, metadata_policy_update, or jwks_update. |
revokeSubordinate(subject) |
Removes the current registration and records revocation, preserving history. |
recordSubordinateEvents(subject, events) |
Appends explicit observations or imported events, including suspension and custom event types. It does not change registration state. |
getSubordinateEvents(subject) |
Returns a signed history JWT for local use. Throws for unknown history or unavailable storage. |
State changes and generated events commit in one transaction. Registration and updates copy their inputs before asynchronous work, so later changes to the caller’s object cannot alter the stored record or its events. No-op updates, reordered object properties, reordered key sets, and authority signing-key rotation do not produce subordinate update events. Initial registration produces only its registration event. Draft 01 §2.3.3's "at the same time" exclusion is interpreted as applying to initial updates within the registration operation; a later change retains its event even if the clock gives it the same timestamp.
Manual event recording also copies nested extension values before waiting for storage, so changing an input object after calling recordSubordinateEvents() cannot change the recorded observation.
An aborted Events request stops waiting for storage or key lookup and does not start signing after that wait. The handler returns a Federation JSON server error. An already-running storage operation or signing operation may finish independently; cancellation does not roll back committed history. The configured options.signal also applies to local getSubordinateEvents() calls, which reject on cancellation.
Direct writes to storage.subordinate bypass event capture. Append events in the same transaction when they belong in the history. Storage contract
The endpoint accepts GET with a required sub Entity Identifier. If authentication is configured through federation_subordinate_events_endpoint_auth_methods, it uses the existing federation client-authentication middleware and authenticated form POST. A private_key_jwt assertion names the authority's Entity Identifier as its audience, which can differ from the endpoint URL. The authenticated client and requested subject need not be identical.
Unsupported methods receive HTTP 405 with Allow and a Federation JSON error containing error: "invalid_request" and error_description. This applies to both the anonymous handler and authenticated route. The advertised URL must have no fragment, including an empty trailing #.
Successful responses are compact JWTs with media type application/entity-events-statement+jwt and JWT type entity-events-statement+jwt, signed with the authority's Federation Entity Key. They contain iss, sub, a fresh response iat, and federation_registration_events. By default, the authority omits the optional exp. Set subordinateEventsTtlSeconds on TrustAnchor or Intermediate to a positive, finite number to include it, as permitted by Draft 01 §2.3.2. For example, subordinateEventsTtlSeconds: 300 gives each response a five-minute lifetime measured from its own iat. Event occurrence times remain unchanged when a new response is issued.
A current subordinate with no recorded events receives a signed empty history. Retained history remains available after removal and re-registration. A subject with neither a current record nor history receives HTTP 404 JSON not_found. Storage failures produce a server error, not empty history. These lookup and retention rules are oidfed policies; the draft does not prescribe them.
Published events require a nonempty name; custom names and empty descriptions are supported. This publication check applies to lifecycle imports, memory-store appends, and histories returned by custom adapters. Received event names retain the draft’s open string format.
information_uri is descriptive data. Draft 01 §2.3.2.1 recommends HTTPS. The library preserves URL schemes and does not fetch these links. Applications should allow only suitable navigation schemes, such as HTTPS, before rendering a clickable link; a valid signature does not make a URL safe to open.
History contains the authority's recorded observations and may be incomplete. A suspension event does not enforce suspension, and event history alone does not prove past trust-chain validity. The endpoint provides no pagination or notifications.
Lifecycle methods accept optional event annotations: registerSubordinate(record, annotations), updateSubordinate(subject, updates, annotations), and revokeSubordinate(subject, annotations). Use { eventDescription, informationUri } for the optional fields in Subordinate Events §2.3.2.1. Event storage is required when annotations are supplied. Updates apply the annotations to each generated event; a no-op update produces no event. Validation and event writes share the lifecycle operation's failure boundary.