2.1. Publish an Entity Configuration
Feature guides / 2. Entity Statements · Example context
LIGO Wiki needs a signed description that other participants can discover. Its EC carries its identity, federation keys, superior hints, and metadata. LIGO Wiki's own application still handles the sign-in callback and session.
How to use it
A Leaf signs and caches its EC and exposes it through handleRequest(). Configure metadata appropriate to the roles you attach. For this minimal federation-only participant, the caller supplies a persistent signing keyring. EC claims; EC retrieval.
import type { CryptoContext } from "@oidfed/core";
import { Leaf } from "@oidfed/leaf";
export async function createLigoWiki(keys: CryptoContext) {
const leaf = await Leaf.create({
entityId: "https://wiki.ligo.example",
authorityHints: ["https://incommon.example"],
metadata: { federation_entity: { organization_name: "LIGO Wiki" } },
crypto: keys,
});
return {
leaf,
handleRequest: (request: Request) => leaf.handleRequest(request),
};
}
What your application owns
Serve the well-known path over HTTPS for that exact Entity Identifier. authorityHints names candidate superiors; it does not enroll LIGO Wiki with them. Enrollment is a separate operator action. getEntityConfiguration() returns the signed JWT; refreshEntityConfiguration() regenerates a Leaf EC. Its expiry and caching must fit the deployment's refresh policy. The host performs publication checks, but a self-signature alone does not establish federation trust.
Publish an extension your federation understands
LIGO Wiki can put custom top-level claims in its EC with additionalClaims. If the receiving application must process one, list its name in crit. The same options work on TrustAnchor and Intermediate for their own ECs. See the access-profile example.
Hosts validate and deeply copy these options at construction. Refreshing the EC preserves that snapshot. Build a new host instance to publish a changed extension configuration; changing the original input object has no effect. A custom claim name must not replace a standard Entity Statement claim.
Keep discovery available
Give composed role handlers their own paths. A role cannot replace the host's discovery endpoint or another role's handler. Hosted federation endpoints also reject conflicting role paths, including a pathname already used by an endpoint with fixed query parameters. A conflict fails construction so LIGO Wiki can correct its configuration before serving requests.
Hosts remove one trailing / from their configured identifier once. Use the resulting entityId when enrolling the participant or sharing its identity. The discovery URL is then calculated from that published identifier using §9; EC claims and role contexts use the same identity.
Publish and inspect the configuration
Mount LIGO Wiki's handler at the path derived from its published Entity Identifier. Test the complete external HTTPS URL through the same proxy a peer will use. A correct local handler is insufficient if the proxy changes the path, requires a browser session, or returns an HTML error page instead of the signed configuration.
Decode the response to inspect it, then verify it through your consumer's trust workflow. Check that the metadata contains the intended role blocks and public keys, without private key material. Keep cache refresh separate from a metadata edit: configuration ownership is fixed by the host API, so changing the original object after construction is not a publication mechanism.
How does the Entity Configuration caching work?
The signed iss and sub preserve the configured Entity Identifier, including any trailing slash. Section 9 removes that slash before appending /.well-known/openid-federation. If your existing deployment enrolled or pinned the slashless form, configure that exact form when upgrading. Changing the Entity Identifier requires coordinating enrollment and trust anchor configuration.
A rotating keyring can publish a new key while retaining the old signer, then switch signers and retire the previous key. The Leaf cache does not track those keyring transitions automatically. Call refreshEntityConfiguration() after publication, signer switch, and retirement when the served configuration must reflect a change before expiry. The application chooses propagation and overlap intervals; see the rollover stages.
The Leaf class signs and caches the Entity Configuration JWT internally. When getEntityConfiguration() is called, it returns the cached JWT if it has not expired yet. If it has expired or if refreshEntityConfiguration() is called, it re-queries the crypto for keys and generates a new signature.
During concurrent refreshes, only the newest generation updates the cache. A caller already waiting on an earlier build can still receive that JWT. The "Entity Configuration generated" message confirms that signing finished; it does not mean that result became the cached configuration.
Leaf configuration ownership
A Leaf captures its metadata at construction, including nested values. Roles initialize before their metadata is composed; their parameters override host values in role order. Later changes to the original metadata or a role's metadata do not update the Leaf. Construct a replacement Leaf to change general metadata.
refreshEntityConfiguration() refreshes the signed configuration and reads the current federation keyring. It does not reload the original metadata object. Dedicated Trust Mark operations still publish their changes through their existing methods.
entityConfigurationTtlSeconds must be a positive safe integer and is checked at construction. Keyrings, storage, and callbacks remain live service references. Discovery and assessment methods apply per-call options over host options, and explicitly supplied trust anchors override host anchors.