7.3. Use a federation resolver
Feature guides / 7. Federation endpoints · Example context
LIGO Wiki can ask a resolver for an assessment of Umeå University OP instead of performing every discovery step itself. That introduces a trust decision about the resolver as well as the target entity.
How to use it
Use TrustAnchor.resolveEntity() or Intermediate.resolveEntity() to produce a signed Resolve Response locally. On the consumer, configure trustResolution and call the host's assessEntity() or the appropriate protocol role operation. The default consumer mode validates the returned subject chain locally; explicitly delegated resolver assessment is a separate choice. Resolve endpoint; Resolver trust.
import type { TrustAnchor, Intermediate } from "@oidfed/authority";
import type { Leaf } from "@oidfed/leaf";
import { entityId } from "@oidfed/core";
export function resolveAtCampus(campus: TrustAnchor | Intermediate) {
return campus.resolveEntity(entityId("https://op.umu.example"), entityId("https://edugain.example"));
}
export function assessAtLigoWiki(ligoWiki: Leaf) {
// Uses the host's trustResolution configuration and still validates the subject chain locally.
return ligoWiki.assessEntity(entityId("https://op.umu.example"));
}
Choose acquisition or delegation
LIGO Wiki can use the campus resolver to obtain a chain while retaining its own validation. Configure trustResolution on the host or role, then keep using the existing protocol API. OIDC registration and Wallet verification still perform their required checks.
For an application that explicitly trusts the campus resolver's assessment, the same host method supports mode: "resolver":
import type { Leaf } from "@oidfed/leaf";
import { entityId } from "@oidfed/core";
import { type TrustAnchorSet, type JWKSet } from "@oidfed/core";
export async function trustCampusAssessment(ligoWiki: Leaf, anchors: TrustAnchorSet, campusKeys: JWKSet) {
const assessment = await ligoWiki.assessEntity(entityId("https://op.umu.example"), {
trustAnchors: anchors,
mode: "resolver",
trustResolution: {
kind: "resolver",
resolver: {
entityId: "https://edugain.example",
endpoint: "https://edugain.example/resolve",
trust: { kind: "pinned", jwks: campusKeys },
},
},
});
if (!assessment.ok) throw new Error(assessment.error.description);
}
The result identifies a resolver assessment explicitly. Its reportedTrustMarks remain the resolver's assertions, and its expiry limits how long the application can use it. Omitting mode requests local validation instead. Local policy callbacks require local mode.
An application that already owns its EC publication and routing can use core's standalone FederationResolverService. For Driving Licence Federation's managed participant, attach the resolver service to a Leaf with resolver: {} and published federation_resolve_endpoint metadata. No subordinate database is required. Existing Authority hosts use the same service.
If you configure chainSelection, the service waits for discovery to complete within its resource limits before calling it. Truncated discovery returns HTTP 503 with temporarily_unavailable; no successful assessment is signed or cached. This keeps LIGO Wiki's path preference from being applied to an incomplete candidate set.
What your application owns
Decide whether the application trusts that resolver to perform the assessment. Configure expectedAudience when accepting audience-bound responses. Current authority defaults require authentication for fresh HTTP resolution; anonymous requests use cached assessments, and local resolveEntity() can warm the cache. Plan capacity and cache freshness instead of exposing unrestricted graph traversal as a public request side effect.
The resolver tries subsequent candidates if an earlier chain fails. If none succeeds, it also accounts for branches that could not be discovered because an upstream service was unavailable. A missing subject returns not_found; invalid chains return invalid_trust_chain, and metadata-only failures return invalid_metadata. Temporary discovery failures return temporarily_unavailable. The response exp follows the chain/mark minimum; earlier delegation and evidence deadlines stop cache reuse without changing that signed formula.
An intermediate’s own Entity Configuration can expire before the statements in the returned chain. That earlier deadline stops reuse of the cached assessment; it does not replace the chain’s expiration in the signed response. The same separation applies to delegation and other required evidence deadlines.
Decide who evaluates the evidence
In chain-acquisition mode, LIGO Wiki obtains evidence from a resolver and validates the subject chain itself. In delegated assessment mode, it explicitly trusts the configured resolver's assessment under the selected resolver trust policy. These choices have different security boundaries even if they contact the same HTTP endpoint.
An anonymous Resolve request may be served only from cached assessments under the default hosting policy. Warm the cache through an authorized local or authenticated operation when live discovery is needed. Distinguish an absent chain, an invalid candidate, and temporary discovery failure when deciding whether to retry.
Verify a signed Resolve response
A custom integration that receives an already-obtained response JWT can use core's standalone verifyResolveResponse; normal host and role workflows already verify their resolver responses. Supply the resolver's trusted public keys, its Entity Identifier, and the requested subject. For an authenticated request, supply your application's Entity Identifier as expectedAudience:
import type { CryptoEngine } from "@oidfed/crypto";
import { verifyResolveResponse } from "@oidfed/core";
import { type JWKSet } from "@oidfed/core";
export async function checkResolverResponse(engine: CryptoEngine, responseJwt: string, resolverJwks: JWKSet) {
const result = await verifyResolveResponse(responseJwt, resolverJwks, {
engine,
expectedIssuer: "https://resolver.example.com",
expectedSubject: "https://leaf.example.com",
expectedAudience: "https://client.example.com",
});
return result;
}
Under Federation §8.3.2, aud is optional and identifies only the requesting party when present. The helper accepts a string or a nonempty array containing only that same identifier, following RFC 7519 §4.1.3. Each value must match expectedAudience exactly. A response containing aud fails verification if the caller omits expectedAudience. Responses without aud remain valid with or without a configured audience; any supplied expectedAudience must be a valid Entity Identifier.
The helper checks the JWT signature, type, time claims, payload shape, issuer, subject, and audience. Supply expected identities from your request or trusted configuration, as required for contextual JWT validation by RFC 8725 §3.8. The application chooses trusted resolver keys and assesses the returned chain against its trust policy.
Acquire evidence or delegate an assessment
A resolver is an explicitly trusted service. Configure its Entity Identifier and endpoint, then either pin its verification keys or validate its own chain against independently configured anchors:
import type { Leaf } from "@oidfed/leaf";
import { entityId, type TrustResolutionSource } from "@oidfed/core";
import { type JWKSet, type TrustAnchorSet } from "@oidfed/core";
export async function assessThroughResolver(ligoWiki: Leaf, resolverKeys: JWKSet, anchors: TrustAnchorSet) {
const trustResolution: TrustResolutionSource = {
kind: "resolver",
resolver: {
entityId: "https://edugain.example",
endpoint: "https://edugain.example/resolve",
trust: { kind: "pinned", jwks: resolverKeys },
},
};
const result = await ligoWiki.assessEntity(entityId("https://op.umu.example"), {
trustAnchors: anchors,
trustResolution,
mode: "resolver",
});
if (!result.ok) throw new Error(result.error.description);
if (result.value.kind === "resolver") {
const metadata = result.value.resolvedMetadata;
// reportedTrustMarks records the resolver's assertions, not local mark verification.
}
return result;
}
Use trust: { kind: "federation", trustAnchors: resolverAnchors } to authenticate the configured resolver through its own chain. This validation uses bottom-up discovery and cannot recursively delegate back to the resolver. Its trust configuration is separate from the subject's accepted anchors.
Omitting mode, or using mode: "local", locally validates the subject chain. For supplied evidence, pass trustChain and any supporting entityConfigurations; this also works offline. discoverEntity and protocol operations also perform local validation when trustResolution selects a resolver. A resolver response carries the subject chain in its payload; a resolver chain in the protected header is a separate, optional artifact.
Delegated assessments authenticate the response, bind identities and the requested anchor, and limit their lifetime by the response and included evidence. They have a distinct result type and runtime provenance (isEntityAssessment). Copying or deserializing an assessment does not preserve that provenance. Local selection and custom policy/constraint callbacks require local mode. A remote resolver returns its chosen path; a client callback cannot rank paths the service did not return.
Existing endpoint authentication options apply. The known resolver identity is checked against the configured authentication audience. For private_key_jwt, the response recipient is inferred from clientId; custom authentication can provide the recipient with resolver.requester. A response containing aud requires a known matching recipient. Failed authentication never falls back to anonymous access. Offline operations require locally supplied evidence.
Host a standalone Resolve service
import { FederationResolverService, longestExpiry } from "@oidfed/core";
import { type CryptoContext, type TrustAnchorSet } from "@oidfed/core";
export function createCampusResolver(crypto: CryptoContext, anchors: TrustAnchorSet) {
const resolver = new FederationResolverService({
entityId: "https://edugain.example",
crypto,
trustAnchors: anchors,
options: { engine: crypto.engine, algorithmRegistry: crypto.algorithmRegistry, chainSelection: longestExpiry, maxTotalFetches: 50 },
});
return {
resolver,
// Mount on the advertised federation_resolve_endpoint.
handleRequest: (request: Request) => resolver.handleRequest(request),
};
}
Create the service once for the host and reuse its handler across requests so its cache can survive between calls. Supply authentication to configure supported methods, replay protection, and client-key lookup. Anonymous HTTP requests use cached assessments by default. Trusted in-process callers can use resolver.resolve(request) to populate that cache. Per-call resolution options are supported and get an isolated cache namespace. Set requireAuthForFreshResolution: false only when the deployment intentionally allows anonymous discovery.
The service requires no subordinate store. assessLocalTrustMarkStatus optionally connects marks issued by this resolver to its own status service; otherwise normal issuer-status verification is used. Authority hosts reuse this implementation. A Leaf can host it through LeafConfig.resolver while publishing the Resolve endpoint in its metadata.
These APIs implement the choices in Federation §17. They do not relax OIDC or Wallet profile requirements for chain verification or contextual policy processing.
Resolve cache and signed-response lifetimes
Anonymous HTTP Resolve requests use cached assessments by default, following the denial-of-service guidance in Federation §18.1. A cold or expired cache returns 404 not_found without discovery. Authenticated requests and local resolveEntity(subject, anchor) calls can perform discovery and populate the cache. Set requireAuthForFreshResolution: false to allow fresh anonymous discovery with the configured network limits.
The authority stores audience-neutral snapshots in storage.cache, or a bounded in-memory cache when none is provided. Snapshots are isolated to the authority instance and expire at the earliest of options.cacheMaxTtlSeconds (default 3,600 seconds), chain expiry, and included evidence expiry. Restarting an instance requires warming its Resolve cache again, even when its storage cache is shared.
Each response is signed with the current key. Its exp remains the minimum expiry of the subject's Trust Chain and included Trust Marks, as required by §8.3.2. Delegation and issuer/history evidence expiry also cap the usable assessment. The cache reuse deadline controls how long the authority serves that assessment. Cached responses omit the optional issuer-chain header, which may describe an older signing key. Only authenticated responses carry the current caller's aud. Cache failures never enable anonymous discovery.
Include accredited active marks
Resolve includes only marks authorized by the selected Trust Anchor, as required by Federation §8.3.2. Independently established or out-of-band issuer evidence cannot replace that anchor's issuer and owner/delegation policy. An expired, unauthorized, or unverifiable mark is omitted while an otherwise valid holder chain can still resolve.
The resolver also checks active status before inclusion. For locally issued marks it uses the same assessment as the Status endpoint, including a configured trustMarkStatusPolicy; a suspended result is not active. For external issuers it uses authenticated issuer evidence to locate and verify the Status response, even when the issuer is absent from the holder's chain. The response expiration follows the chain and included marks; cache reuse also stops at earlier evidence deadlines. Applications enforce required accreditations using the core requirement helper.
Candidate selection and Resolve errors
Resolve tries discovered candidate chains until one validates. A bad path does not hide a valid path to another requested anchor. Discovery and validation attempts share the request's fetch budget and cancellation signal.
A missing subject or absent chain returns 404 not_found. When discovery has no outstanding operational failures, discovered chains that all fail validation return 400 invalid_trust_chain; metadata-only failures return 400 invalid_metadata. When no valid candidate is available, incomplete discovery caused by temporary upstream failures or exhausted limits returns 503 temporarily_unavailable. Unexpected internal failures return 500 server_error. Responses contain generic descriptions rather than validation details or signed evidence.
The response's exp is the minimum expiration of the selected chain and the included Trust Marks, as §8.3.2 specifies. Auxiliary intermediate Entity Configurations, delegations, and other issuer evidence must still be valid when the response is produced. These auxiliary documents do not shorten the expiration calculated from statements in the returned chain. Their earlier deadlines limit cache reuse independently of the wire exp: an anonymous request can therefore encounter a cache miss before a previously issued response expires. Fresh resolution reassesses the evidence and omits marks that can no longer be verified as active.
Fixed routing selectors use the endpoint's parameter rules. Known membership filters accept reordered or repeated identical values; scalar selectors and unknown extensions keep exact comparison. Authority construction rejects overlapping routes under those same rules, including routes whose parameter rules differ.
Host Resolve on a Leaf
Set options.chainSelection or options.trustResolution on LeafConfig to provide defaults for attached roles and the Leaf's own trust operations. Instance methods discoverEntity, discoverEntityFromChain, and assessEntity inherit the host's anchors and options; per-call values override them. Static methods accept explicit anchors and options.
A Leaf can host a Resolve endpoint without becoming an Authority:
import { Leaf } from "@oidfed/leaf";
import { type CryptoContext, type TrustAnchorSet } from "@oidfed/core";
export async function createResolverLeaf(crypto: CryptoContext, anchors: TrustAnchorSet) {
const leaf = await Leaf.create({
entityId: "https://resolver.example",
authorityHints: ["https://edugain.example"],
crypto,
trustAnchors: anchors,
metadata: {
federation_entity: { federation_resolve_endpoint: "https://resolver.example/resolve" },
},
resolver: {},
});
return leaf;
}
resolver.options overrides host options for this service. Its authentication methods must match the published metadata. Resolve routes cannot replace another route or the Entity Configuration endpoint. The resolver property exposes the service for trusted in-process resolution; anonymous HTTP discovery remains cache-only by default. Advertising an externally hosted Resolve endpoint does not require local hosting configuration.
See core trust establishment for supplied-chain and delegated-assessment examples.
Next: 7.4. Retrieve authenticated historical federation keys