4.3. Supply metadata through a superior
Feature guides / 4. Metadata · Example context
Umeå University assigns Umeå University OP a federation registration endpoint. Umeå University OP's own EC can omit that field while its immediate superior supplies the value in the Subordinate Statement.
How to use it
Put supplied values in the subordinate record's metadata field. This is different from metadataPolicy, which applies operators. Chain validation combines the permitted metadata inputs and checks important invariants again on the final result. Metadata override; Metadata constraints.
import { entityId } from "@oidfed/core";
import type { TrustAnchor, Intermediate } from "@oidfed/authority";
export async function completeUmeaOp(authority: TrustAnchor | Intermediate) {
await authority.updateSubordinate(entityId("https://op.umu.example"), {
metadata: { openid_provider: {
federation_registration_endpoint: "https://op.umu.example/federation-registration",
} },
});
}
What your application owns
The endpoint must actually be served by Umeå University OP's deployment. A superior cannot turn identity-bound issuer metadata into another entity's identity. Do not apply full required-field validation to every partial publication and accidentally prohibit completion. Consumers need resolved metadata, not a hand-merged approximation of the EC. Contextual prepare/complete validation is reserved for workflows that have additional authenticated protocol input.
Check what the Superior supplied
For Umeå University OP, document which metadata fields it publishes and which eduGAIN completes. This is an operational agreement: an omitted field is not a promise that a Superior will provide it. The consumer validates the completed result before using the OP.
Test both the complete path and a missing-Superior-value case. A good local draft can still resolve to unusable metadata if the Superior removes an endpoint or applies an incompatible policy. Surface that failure in a preview or deployment check instead of waiting for the first sign-in request. Changing Superior metadata also affects downstream consumers when their evidence refreshes.
Composition, lifetimes, and owned metadata
composeEntityMetadata(...sources) makes an owned copy of metadata. Supply host metadata first and role metadata afterward. A later source replaces each conflicting parameter's whole value, so arrays and nested objects are not recursively merged. Open entity-type and parameter names remain ordinary own properties, including names such as __proto__. The helper rejects non-object entity-type blocks and propagates cloning errors; protocol conformance is checked separately by the relevant role.
import { composeEntityMetadata, assertPositiveTtlSeconds } from "@oidfed/core";
const metadata = composeEntityMetadata(
{ openid_relying_party: { redirect_uris: ["https://portal.example/callback"] } },
{ openid_relying_party: { client_registration_types: ["automatic"] } },
);
assertPositiveTtlSeconds(3600, "entityConfigurationTtlSeconds", "safe-integer");
assertPositiveTtlSeconds(60.5, "trustMarkTtlSeconds", "finite");