Skip to content
Wallet and Entity Collection draft updates
Documentation menu

14.2. Operate an Entity Collection

Feature guides · Example context

The Entity Collection Endpoint, Draft 01 lists direct and indirect subordinates of a selected Trust Anchor. It returns unsigned JSON for discovery and display. Validate a selected entity through normal federation trust processing before relying on it. Clients must treat returned Trust Marks as unverified, even when the responder verified them to filter its results.

@oidfed/core provides EntityCollectionService, MemoryFederationStorage, storage contracts, schemas, and the fetchEntityCollection client. Trust Anchors, Intermediates, and leaves use this service for their optional endpoint. An independent application can also serve collections using core, without becoming a Federation Entity.

See collection responsibilities for scope policy, scheduled refreshes, shared storage, and consumer trust checks.

Start with the hosting class

For an existing federation participant, pass collection and its advertised endpoint to TrustAnchor, Intermediate, or Leaf. Use that host's .collection for refresh and query operations and its handleRequest() for serving. The hosted directory example connects all three. Do not construct another service beside the one the host already owns.

Core's service constructor is appropriate for an independent directory that does not need a federation host identity. The examples below cover that distinct deployment and its storage and callback contracts. The same collection settings can be placed inside a hosting class's collection configuration.

Independent providers

Supply the anchors and public Federation Entity Keys your application already trusts. Pass options with an engine and storage declaring entityCollection. Add replay for an authenticated directory. In this example, the application supplies anchorPublicJwks. Do not use an unverified Entity Configuration as the source of those initial keys.

import {
  createTrustAnchorSet,
  EntityCollectionService,
  entityId,
} from "@oidfed/core";
import { type JWKSet, type FederationOptions } from "@oidfed/core";

export async function createCollection(anchorPublicJwks: JWKSet, options: FederationOptions) {
  const anchor = entityId("https://anchor.example");
  const collection = new EntityCollectionService({
    options,
    endpoint: "https://directory.example/collect?version=1",
    trustAnchors: createTrustAnchorSet([
      { entityId: anchor, jwks: anchorPublicJwks },
    ]),
  });

  // Run explicitly from an application-owned job or administrative operation.
  const refreshed = await collection.refresh(anchor);
  if (!refreshed.ok) throw new Error(refreshed.error.description);

  const page = await collection.query({
    trustAnchor: anchor,
    entityType: ["openid_provider", "custom_entity_type"],
    entityClaims: ["entity_types", "entity_infos"],
    infoClaims: ["display_name", "logo_uri"],
    locale: ["en", "de"],
    limit: 20,
  });
  if (!page.ok) throw new Error(page.error.description);
  return collection;
}

Route Web-standard Request objects to collection.handleRequest(request) and return its Response. The application handles routing for an independent provider. Set endpoint to identify fixed query components such as version=1.

To request another page, repeat the filters and selectors and pass the returned next as from. You may change the page size. Cursors are opaque and expire; removal of a referenced snapshot also makes them unavailable. An unavailable cursor returns page_not_found.

Federation entity integration

Pass collection: { trustAnchors, ... } in AuthorityConfig or LeafConfig and publish metadata.federation_entity.federation_collection_endpoint. The hosting class advertises that URL and routes its requests to core. Publishing the endpoint without collection configuration is an error. You can configure the service without publishing a URL to use it in process.

Access the service through entity.collection on TrustAnchor, Intermediate, or Leaf. Call refresh(anchor) explicitly. Requests to configured leaf collection routes go through Leaf.handleRequest. A leaf serving collections keeps its leaf role; it gains no Fetch, List, Extended Listing, or Subordinate Events endpoints.

A Federation Entity publishing the endpoint should also publish a Resolve endpoint, following §3. The collection feature does not add a Resolve endpoint to a leaf automatically.

Selecting an anchor

Request Result
Explicit supported trust_anchor The selected anchor's collection, regardless of the responder's role.
Omitted on a Trust Anchor Its own anchor collection.
Omitted on an identified Intermediate or leaf An empty collection.
Omitted on a provider without an Entity Identifier invalid_request.
Explicit unsupported anchor invalid_trust_anchor.

The anchor rules come from §3.3.1.

Collection policy

The default collector walks the federation and requires valid chains. You can replace it with a collector callback to use an application-owned inventory or another collection method, as permitted by §5.1. The responder chooses which entities it exposes under §5.3.

A custom collector returns Result<readonly EntityCollectionCandidate[]>. Each candidate contains an entity object and a finite expiresAt value in seconds since the epoch. Core supplies the snapshot identifier and refresh timestamp, validates the output, sorts by Entity Identifier, and publishes it atomically. Duplicate identifiers, malformed entries, unsupported evidence fields, and candidate sets above maxEntities fail refresh and preserve the previous snapshot.

Before storing an inventory, core combines each entry's entity_types with the type names in entity_infos, removing duplicates. It preserves supplied types and adds any missing known types, even when the collector omitted entity_types. This follows §3.4.1.1: a published type summary must include every type the responder knows about. The collector's objects are left unchanged. Requesting only entity_id still returns only that claim.

For example, an independent application can publish an inventory without collecting trust chains for its entries:

import {
  createTrustAnchorSet,
  EntityCollectionEntitySchema,
  EntityCollectionService,
  entityId,
  nowSeconds,
  ok,
} from "@oidfed/core";
import { type JWKSet, type FederationOptions } from "@oidfed/core";

export async function createCustomCollection(anchorPublicJwks: JWKSet, options: FederationOptions) {
  const anchor = entityId("https://anchor.example");
  const trustAnchors = createTrustAnchorSet([
    { entityId: anchor, jwks: anchorPublicJwks },
  ]);

  const directory = new EntityCollectionService({
    options,
    trustAnchors,
    collector: async ({ options }) => ok([
      {
        entity: EntityCollectionEntitySchema.parse({
          entity_id: "https://rp.example",
          entity_types: ["openid_relying_party"],
          entity_infos: {
            openid_relying_party: { display_name: "Example service" },
          },
        }),
        expiresAt: nowSeconds(options.clock) + 300,
      },
    ]),
  });
  return directory;
}

The callback receives the selected trustAnchor, its pinned trustAnchorJwks, effective options, and a cancellation signal. Use this context to select entities associated with the requested anchor; the inventory source is responsible for that association. Network calls through the supplied options share the refresh budget and redirect policy. Core rejects unsupported anchors before invoking the callback.

Custom entries do not gain chain evidence. If they include Trust Marks, core confirms publication in the entity's self-signed Entity Configuration and verifies each qualifying mark using trusted issuer keys. By default, it uses the selected collection anchor; explicit accreditation settings are described below. The publication check alone does not establish a chain for the entry. Collectors cannot supply verifiedMarks or chainExpiresAt as proof. Verification happens during refresh; queries never fetch or verify marks on demand.

Use filter for an additional application restriction. It runs once per eligible entry after mark verification, with a detached, frozen entry and the same anchor context. Return false to exclude an entry, true to retain it, or { expiresAt } to shorten its eligibility. Filtering an intermediate does not prevent collection of its descendants.

This example keeps entries with a particular verified mark and expires them when that evidence expires:

import { EntityCollectionService, type FederationOptions, type TrustAnchorSet } from "@oidfed/core";

export async function createAccreditedCollection(trustAnchors: TrustAnchorSet, options: FederationOptions) {
  const curated = new EntityCollectionService({
    options,
    trustAnchors,
    filter: (entry) => {
      const matches = entry.verifiedMarks.filter(
        (mark) => mark.type === "https://marks.example/member",
      );
      return matches.length
        ? { expiresAt: Math.max(...matches.map((mark) => mark.expiresAt)) }
        : false;
    },
  });
  return curated;
}

Filters may be asynchronous, so an application can consult its Resolve service or other policy data using the refresh context. Results are stored in the snapshot. If the policy depends on evidence that expires, return its expiry; the filter cannot extend the candidate's deadline. Filters and collectors never run while serving pages.

A callback failure or cancellation before publication prevents a new snapshot from being stored. Cancellation settles the caller promptly, including while its refresh is queued. A cancelled queued refresh never runs its collector, and later refreshes still wait for the active predecessor. An active refresh can abandon a callback that ignores cancellation, but that callback can no longer publish a snapshot through the service. Cancellation cannot roll back a store publication already in progress; that write stays ahead of later refreshes in the queue. Callbacks are trusted application code and must use the supplied signal to stop their own I/O. Shorten entry lifetimes or refresh explicitly when inventory or policy changes.

Search behavior

By default, query matches a case-insensitive substring of the Entity Identifier or collected informational text. §3.3.1 leaves the matching rule to the responder. Use queryMatcher when your directory needs a different rule:

import { EntityCollectionService, type FederationOptions, type TrustAnchorSet } from "@oidfed/core";

export async function createSearchableCollection(trustAnchors: TrustAnchorSet, options: FederationOptions) {
  const directory = new EntityCollectionService({
    options,
    trustAnchors,
    queryMatcher(query, entity) {
      const name = entity.entity_infos?.openid_provider?.display_name;
      return typeof name === "string" &&
        name.toLowerCase().startsWith(query.toLowerCase());
    },
  });
  return directory;
}

This example lets eduGAIN offer prefix search for identity provider names. The callback receives the original query and detached, deeply frozen entity data before claim projection. It runs only when a query is supplied, including an empty string, and must return a boolean synchronously. Errors, promises, and other return values fail the query without creating a cursor.

Keep the decision deterministic for a fixed query and snapshot so that pagination stays consistent. Load external data during collection; a matcher should only examine the collected data. It can narrow results, but cannot restore expired entries or bypass the entity-type and Trust Mark filters. It does not change the ordering. Authority and Leaf configurations expose the same option as collection.queryMatcher.

Accreditation for Trust Mark filters

The default is to verify marks under the collection's Trust Anchor, following the SHOULD in §3.3.1. Some directories recognize a separate accreditation federation. For example, eduGAIN might list university services while trusting a separate accessibility accreditor to certify them:

import { EntityCollectionService, type FederationOptions, type TrustAnchorSet } from "@oidfed/core";

export async function createCampusCollection(campusAnchors: TrustAnchorSet, accessibilityAccreditationAnchors: TrustAnchorSet, options: FederationOptions) {
  const directory = new EntityCollectionService({
    trustAnchors: campusAnchors,
    options: {
      ...options,
      trustMarkVerification: {
        mode: "resolve",
        trustAnchors: accessibilityAccreditationAnchors,
      },
    },
  });
  return directory;
}

Collection uses the same configured issuer-evidence selection as ordinary chain validation. In resolve mode, matching supplied issuerEvidence takes precedence; missing evidence is resolved against the configured accreditation anchors, or the collection anchor when no alternative is supplied. Resolution shares the refresh's network budget and cancellation signal. An incomplete issuer discovery preserves the previous snapshot. A completed check that finds an untrusted issuer leaves its mark unverified.

For an offline accreditation relationship, use mode: "provided" with issuerEvidence obtained through establishTrustMarkIssuerTrust, or an explicitly trusted kind: "out-of-band" issuer context. Provided mode never discovers missing issuer evidence. Collection traversal and holder-publication checks may still fetch; this setting controls issuer trust, not the whole operation's network access. A federation evidence object must be the original verified object; copying or deserializing it does not preserve its provenance. Out-of-band accreditation is a host trust decision permitted by Federation §17.5, not something inferred from a JWT's self-published keys.

These explicit settings use the accreditation context's issuer and owner policy. They do not additionally require the collection anchor to recognize the mark type. The holder must still publish the exact mark in its authenticated Entity Configuration, and core verifies the signature, subject, type, validity, and any required owner delegation. Historical-key settings remain available; configuring only historicalKeys keeps Collection's default same-anchor policy. Supplying only an accreditation anchor set does not enable discovery: set mode: "resolve" explicitly.

The stored verification deadline cannot exceed any applicable publication, chain, accreditation, mark, delegation, or historical-response deadline. Verification for filtering does not make the unsigned response trustworthy to its recipient: clients must still perform their own federation verification.

Refresh and storage

By default, refresh walks the configured anchor's subordinate hierarchy and validates chains against pinned anchor keys. It collects informational metadata from Entity Configurations. The default collector includes only entities with a valid chain at refresh time, an oidfed policy permitted by §5.3.

The default collector excludes entities with invalid chains or malformed Entity Configurations. An expired or untrusted Trust Mark does not invalidate an otherwise valid chain for collection purposes; it cannot satisfy a mark filter. The collector logs unrecognized mark types at debug level. A missing type in the anchor’s trust_mark_issuers is not the explicit empty-array authorization described in Federation §3.1.2.

If a branch is unreachable, traversal is incomplete, a mandatory work limit is reached, or the caller cancels, refresh fails and keeps the previous snapshot. Diagnostics identify failed listings, authorities without traversal endpoints, and snapshot publication failures. An ordinary leaf ends traversal normally.

The service publishes snapshots atomically and runs refreshes for each anchor in sequence within one EntityCollectionService instance. Shared storage does not coordinate refreshes across instances; the application must arrange that coordination, for example with a single scheduled writer or an external lock. Queries read stored snapshots without starting traversal or a scheduler. The last_updated value records the successful refresh time and stays unchanged when a page is read.

An empty list for a mark type in trust_mark_issuers permits any issuer for that type under Federation §3.1.2. Core still establishes issuer trust and verifies the mark, following §7.3.

Refresh completes entity traversal, publication checks, and explicitly listed issuer checks before resolving open issuers. Open-issuer lookups allow at most 50 fetches per issuer and 100 network calls in total per refresh, within the remaining options.maxTotalFetches allowance. An unreachable issuer or a lookup that reaches these limits leaves its marks unverified and allows publication. An incomplete lookup for an explicitly listed issuer still fails refresh. These are oidfed availability policies; cancellation, incomplete entity traversal, and mandatory fetch-budget exhaustion prevent publication.

Refresh checks alternate valid paths through shared intermediates and returns each entity once. It reuses fetched statements and listings within the refresh. Chain and mark expiry times reflect the verified paths in that snapshot. Exploring alternate paths counts toward the work limits; reaching a limit fails refresh and prevents publication of a partial collection. Cached subordinate attestations use the actual issuer identifier to keep authorities on the same origin separate.

Setting Default
maxPageSize 100; also used when limit is omitted.
cursorTtlSeconds 900 seconds.
maxEntities 10,000 examined candidates; custom inventories have the same entry cap.
options.maxTotalFetches 1,000 network calls across the refresh, including issuer resolution.
options.maxConcurrentFetches 6.
options.maxChainDepth 8.
options.maxResolutionSteps 1,000 branch expansions per Trust Mark issuer resolution, including reused statements.
options.maxResponseBytes 512 KiB for network reads and collection pages.
options.httpTimeoutMs 10 seconds per network operation and request-body read.

To fit the byte cap, a response may contain fewer entities than requested. Each included entity keeps all requested claims that are available. If a single entry cannot fit, the query returns an availability error. Setting limit=0 returns no entities, with a continuation value if results remain.

The default memory store retains superseded snapshots for 900 seconds and holds up to 100 snapshots. The maxSnapshots budget is shared by current and retained snapshots. Size it for every configured anchor plus the history you want to retain. If current anchors occupy the entire budget, another anchor cannot publish until capacity is increased; refreshing an existing anchor may evict its previous snapshot immediately. Snapshot eviction can invalidate referencing cursors sooner.

The store holds up to 10,000 cursors and preserves unexpired cursors when that limit is reached: a query needing a new cursor returns HTTP 503 temporarily_unavailable. A limit=0 continuation reuses its cursor without extending its lifetime. Initial requests still need a cursor when results remain; applications control request rates. Current snapshots remain available until replaced; queries exclude entries whose eligibility or applicable chain evidence has expired. Each process has its own memory store, which is lost on restart.

Implement EntityCollectionStore for durable or shared storage. An adapter can throw EntityCollectionCursorCapacityError to report cursor exhaustion as temporarily_unavailable; other storage failures remain server_error. Its publish operation must atomically select the new snapshot for the anchor. Return detached values from reads, retain referenced snapshots and cursors, enforce expiry, and isolate anchors. Keep entries ordered by Entity Identifier.

A CollectionEntry stores public entity data, an expiresAt eligibility deadline, optional chainExpiresAt evidence, and verifiedMarks. The default collector sets eligibility to its verified chain expiry. Custom collectors supply an eligibility deadline without claiming that a chain was validated. Core derives verified mark evidence during refresh; unsigned collection responses cannot supply it.

Direct snapshot writers must supply valid wire data. Queries validate the selected entity fields and snapshot timestamp before allocating cursors; malformed output returns server_error.

Supply storage.entityCollection on the host or in the standalone service’s options. For development pass new MemoryFederationStorage({ namespace: "directory", capabilities: ["entityCollection"] }). First create the complete snapshot, then atomically publish it and advance the current pointer.

Filters and informational claims

  • Repeating entity_type matches entities with any requested type. Repeating trust_mark_type requires every requested mark type. The responder checks published, verified marks and their expiry times, including marks from trusted issuers outside the entity's chain. A mark issuance record alone does not qualify.
  • query uses case-insensitive substring matching across Entity Identifiers and mapped informational text in all available languages.
  • By default, the built-in collector returns all available standard entity and informational claims. Configure defaultEntityClaims and defaultInfoClaims to choose the response when a selector is omitted. Explicit request selectors override these defaults. Empty default arrays select no optional claims at that level; entity_id is always included. Defaults must name supported claims. Explicit selectors can request other supported claims, following the responder discretion in Draft 01 §3.3.1. With selectors, it returns the requested available claims and required entity_id. An unsupported requested claim produces unsupported_claim. A supported claim that is unavailable for one entity is omitted.
  • When included, entity_types contains all known types. An entity_type filter limits entity_infos to the requested types, plus the permitted federation_entity entry.
  • Informational fields include organization and display names, descriptions, keywords, contacts, and informational URLs. When display_name is missing, the collector uses client_name for RP/client types and resource_name for resource types. These fallbacks also apply to language variants.
  • Without locale, selected claims keep all available languages. With locales, the service uses case-insensitive RFC 4647 basic filtering to keep matching variants and selected untagged values. Claim selection applies before language filtering, so filtering cannot restore an excluded claim.

The built-in collector omits malformed optional informational claims individually and emits a message-only warning. The warning does not identify the entity or claim. It keeps the valid entity and continues traversal. This also applies to display-name fallbacks. Custom collectors remain responsible for supplying valid entries; an invalid custom refresh fails and retains the previous snapshot.

Declare additional claims for custom snapshot producers in the entityClaims and infoClaims configuration lists. The service checks exact declared names before interpreting language suffixes, including URI names containing #. To name a language variant, append # and the tag to the complete declared name. Pass the same infoClaims declarations in fetchEntityCollection options when consuming these names. This gives refresh, projection, and client validation the same interpretation of names such as display_name#v2 and localized variants such as description#long#de. The exported default schemas interpret standard claim names; configured service and client validation also understand the supplied declarations. Response schemas preserve extension fields and custom Entity Type Identifiers. The service and client do not fetch informational URLs automatically.

Language variants use BCP 47 tags, as defined in Draft 01 §4. For a declared base such as vendor_label, a name such as vendor_label#de_DE has a malformed suffix. A custom refresh containing it fails and retains the previous snapshot. A query against an existing snapshot returns server_error if the selected output contains such a field, with or without locale. Other selected fields remain queryable. The draft leaves recovery from malformed stored tags unspecified; this rejection policy belongs to oidfed. An exact declared name takes precedence over suffix parsing. Names with no declared base remain opaque extension fields.

In-process queries accept empty selector arrays. Use entityClaims: [] to return only entity_id, or infoClaims: [] to select no informational values. Draft 01 defines no wire representation for an empty list of claim names, so the HTTP client returns invalid_request for either empty selector array before fetching. Omit the selector to use the responder's defaults.

Queries exclude entries with an expired eligibility deadline or expired chain evidence when present. Expired marks no longer satisfy mark filters. Cursors expire before the evidence they depend on can change their result set. Choose a refresh schedule that keeps your application's collection data useful.

Authentication and HTTP clients

Authentication credential parameters belong in the POST body; registered header-based methods use their declared headers. The service rejects assertion parameters and registered custom credential parameters in the URL before trying authentication or anonymous access. This applies even when none is permitted. Anonymous GET and form POST remain supported, and unrelated unknown extension parameters remain ignored.

The service accepts anonymous GET and form POST. Authenticated requests use POST with private_key_jwt. For a Federation Entity, federation_collection_endpoint_auth_methods declares the accepted methods and defaults to ["none"]. If the hosted collection configuration also lists methods, they must match the metadata; conflicting settings fail construction. Independent providers configure methods directly on the service. Using ["none", "private_key_jwt"] allows anonymous POST as well as authenticated requests. Supplied invalid credentials always produce an error.

Independent providers and leaves use authentication.getClientFederationJwks to supply trusted client keys. On an independent provider, set authentication.receiverEntityId to its identifier and assertion audience. This gives it an identified non-anchor responder, so requests that omit trust_anchor receive an empty collection. Hosted entities use their own identifier. Authorities use their existing clientKeyProvider.

The endpoint configuration controls allowed signing algorithms. Assertions require exp and a unique jti. The service requires explicit storage.replay when private_key_jwt is configured. Use shared replay storage across production instances.

import type { CryptoEngine } from "@oidfed/crypto";
import { fetchEntityCollection } from "@oidfed/core";
import { type EntityId } from "@oidfed/core";

export async function fetchDirectory(engine: CryptoEngine, anchor: EntityId) {
  const result = await fetchEntityCollection(
    "https://directory.example/collect",
    { trustAnchor: anchor, entityType: ["openid_provider"], locale: ["en"] },
    { engine },
  );
  return result;
}

Use method: "POST" for anonymous POST. The shared authentication option generates a private_key_jwt assertion or invokes your custom authentication method. A caller-created clientAssertion remains supported; choose one authentication input, not both. Authenticated requests always use form POST.

Set endpoint on the service when its URL includes fixed protocol selectors. These selectors apply to GET and POST alike. For entity_type, trust_mark_type, entity_claims, info_claims, and locale, matching sets are accepted regardless of value order or identical repetitions. Different sets return invalid_request, and arbitrary protocol selectors in a POST query string are rejected. Unrelated fixed routing parameters remain in the URL.

Malformed JSON or schema-invalid successful responses return ERR_INVALID_RESPONSE; the client rejects the page as a whole. Transport failures retain their transport error codes.

The client accepts JSON responses with a charset parameter and applies byte and time limits to both success and error bodies. It applies HTTPS URL checks, timeouts, size limits, cancellation, and redirect rejection. URL checks do not resolve DNS or configure the injected transport's TLS policy; the host must enforce destination and TLS controls appropriate to its runtime. Supply options.httpClient and a host/network policy when your deployment needs further restrictions.

Unknown extension parameters are ignored, as required by Federation §8. Recognized parameters and supplied credentials are still validated.

Success responses use HTTP 200 and application/json. Errors include error and error_description. Malformed requests, unsupported defined features, and unsupported claims return 400. Unavailable cursors and unsupported anchors return 404; an unavailable initial snapshot returns 503.

Calling the collection from the CLI

See the CLI collection command for terminal selectors and authentication options.

Authentication during collection traversal

When traversal uses client authentication, authentication.audience must match the authority whose Listing endpoint is being called. The collector checks this before preparing credentials or sending that request. The endpoint can be hosted on a different origin; its origin does not replace the authority's Entity Identifier.

Credentials for each authority

A collection crawl can visit several authorities, each accepting a different credential. Supply options.getEndpointAuthentication on the service or refresh operation to choose credentials for each request. Static options.authentication remains useful when every authenticated request targets the same entity.

For example, LIGO Wiki can use its Federation Entity Key at eduGAIN, then a different registered credential at Umeå University. Keep a configured list of the endpoints allowed to receive each credential:

import type { CryptoEngine, KeyringEntry } from "@oidfed/crypto";
import type { EndpointClientAuthentication, FederationOptions } from "@oidfed/core";

export function directoryAccess(
  engine: CryptoEngine,
  campusSigner: KeyringEntry,
  umeaOpSigner: KeyringEntry,
): FederationOptions {
  const credentialsByEndpoint = new Map<string, EndpointClientAuthentication>();
  for (const authority of [
    {
      entityId: "https://edugain.example",
      directory: "https://directory.edugain.example",
      signer: campusSigner,
    },
    {
      entityId: "https://umu.example",
      directory: "https://directory.umu.example",
      signer: umeaOpSigner,
    },
  ]) {
    const authentication: EndpointClientAuthentication = {
      method: "private_key_jwt",
      clientId: "https://wiki.ligo.example",
      audience: authority.entityId,
      signer: authority.signer,
    };
    credentialsByEndpoint.set(`${authority.directory}/list`, authentication);
    credentialsByEndpoint.set(`${authority.directory}/fetch`, authentication);
  }
  const publicEndpoints = new Set(["https://public-directory.example/list"]);

  return {
    engine,
    getEndpointAuthentication({ endpoint }) {
      const authentication = credentialsByEndpoint.get(endpoint);
      if (authentication) return authentication;
      if (publicEndpoints.has(endpoint)) return undefined;
      throw new Error("No access policy configured for this endpoint");
    },
  };
}

Use the actual advertised endpoint URLs in this mapping, including any fixed query parameters. In this example, both signing keys are Federation Entity Keys of LIGO Wiki; each authority must accept the selected key under its authentication policy.

Set each authentication object's audience to that authority's Entity Identifier. The collector supplies this identifier for Listing and Fetch requests, even when the endpoint lives on another origin. A mismatch fails before signing or preparing credentials. An async callback can load credentials from a host-managed store and receives the operation's signal for cancellation.

Choose either static authentication or getEndpointAuthentication. Returning undefined requests anonymous access; a callback error stops the request rather than trying anonymously. Entity Configuration discovery always uses anonymous GET. Existing operation caches can reuse a response without asking for credentials again.

Host a collection on a Leaf

A leaf can serve the optional Draft 01 collection endpoint while keeping its leaf role. Configure collection and publish federation_collection_endpoint. Requests through Leaf.handleRequest use the core service. Requests that omit trust_anchor receive an empty collection; an explicit supported anchor selects that collection. See the Entity Collection guide.

Use collection.collector for an application-owned inventory or collection.filter for an additional restriction. These callbacks run during explicit refresh, through the same core service used by authorities and independent providers. See collection policy. Use collection.queryMatcher for synchronous search, and collection.options.trustMarkVerification for explicit accreditation policy. These options use the same core implementation as an independent collection provider.

The federation option customConstraintChecks registers synchronous checks for additional constraints in authenticated Trust Chains. Failed checks reject the operation; unknown constraints remain ignored. See custom constraints for the API and callback context.

Next: 15. OIDC and OAuth workflows

View source on GitHub