Skip to content
Wallet and Entity Collection draft updates
Documentation menu

15.5. Sign client assertions with protocol keys

Feature guides / 15. OIDC and OAuth workflows · Example context

LIGO Wiki authenticates to Umeå University OP with a signed client assertion. The assertion identifies the client and binds it to the intended recipient; it is not a federation Entity Statement.

How to use it

An initialized OIDC RP role exposes createClientAssertion(). Its host keyring selects the signer for the role’s clientAssertion purpose. For Federation client authentication, use Umeå's Entity Identifier as the audience, including when the HTTP destination is its PAR or token endpoint. The receiving profile determines the audience for other uses of the generic assertion helper. OAuthClientRole also exposes its supported static assertion creation surface. OIDC client authentication; JWT client assertions.

import type { OidcRelyingPartyRole } from "@oidfed/oidc";

export async function assertionForUmeaOp(rp: OidcRelyingPartyRole) {
  return rp.createClientAssertion("https://op.umu.example");
}

What your application owns

Use the audience required by the receiving protocol; federation endpoint authentication has its own Entity Identifier audience rule. The receiver must authenticate keys, verify claims, and enforce replay protection. Never log assertions or private keys. An assertion proves possession of the selected key, not entitlement to every requested scope or registration.

Choose authentication for the endpoint being called

A client assertion proves possession of the appropriate signing key to a particular responder. For federation endpoints, the audience is the responder's Entity Identifier, not its Fetch, List, or Resolve URL. For PAR, use the protocol's mutually supported proof configuration.

Do not reuse one assertion across unrelated responders or repeated acceptance attempts. The recipient's replay and expiration checks remain part of the authentication decision. Client Attestation uses an attestation and proof pair with a different trust model; it is not another spelling of a self-issued private-key JWT assertion.

Prepare and process PAR with different proofs

OidcRelyingPartyRole and OAuthClientRole expose createPushedAuthorizationRequest(discovery, parameters, proof, options). It prepares a form-encoded POST and returns its endpoint, parameters, headers, and server trust chain. The host sends the request and handles the returned request_uri. Existing automatic-registration methods keep their current return shapes and behavior.

In the academic federation, a Campus Portal can prepare a request using its protocol signing key without a Request Object:

import { type OidcRelyingPartyRole } from "@oidfed/oidc";
import { type DiscoveryResult, type HttpClient } from "@oidfed/core";

export async function preparePar(portalRole: OidcRelyingPartyRole, universityDiscovery: DiscoveryResult, callbackUrl: string, applicationHttpClient: HttpClient) {
  const prepared = await portalRole.createPushedAuthorizationRequest(
    universityDiscovery,
    { response_type: "code", scope: "openid", redirect_uri: callbackUrl },
    { mode: "private_key_jwt" },
  );

  if (prepared.ok) {
    const { endpoint, parameters, headers } = prepared.value;
    const response = await applicationHttpClient(endpoint, {
      method: "POST",
      headers,
      body: parameters,
      redirect: "manual",
    });
    // Check the PAR response and retain its request_uri for the authorization flow.
  }
}

The proof modes are:

Mode What is sent
request_object A signed Request Object carrying the selected Trust Chain
private_key_jwt Authorization parameters and an RP protocol-key assertion
self_signed_tls_client_auth Authorization parameters; the host presents the configured TLS certificate
attest_jwt_client_auth Client Attestation headers and a signed Request Object

For TLS, supply certificate as the base64 DER certificate from the RP protocol JWK's x5c. The host must actually present and prove possession of that certificate during TLS. The library does not configure a runtime-specific TLS agent. Remote protocol JWK Sets are supported as well as inline keys.

For attestation, supply attestationJwt and popJwt. Retrieve and include the server's challenge when it advertises challenge_endpoint. The role checks the client, audience, and advertised algorithms before preparing the request; the server still performs full authentication. Attestation alone does not replace the RP-key proof required by Federation §12.1.1.2.

OidcProviderRole and OAuthAuthorizationServerRole expose processPushedAuthorizationRequest(request, options). They verify the request, apply registration policy and the configured registration adapter, and return verified authorization parameters and client registration information. The host then issues and stores the single-use PAR request_uri; this method is not a complete authorization server.

Pass effective providerMetadata if Superior metadata or policy completes the provider's publication. Authentication methods must be mutually supported by the resolved client and provider metadata. A signed Request Object does not excuse an invalid additional authentication proof.

For self-signed TLS, configure clientCertificate(request, signal) to return the certificate authenticated by the transport. Do not extract it from an untrusted forwarding header. Federation requires matching the certificate to the RP protocol JWK Set and omitting certificate-chain validation for this method. The transport must still verify possession of the certificate's private key.

For attestation, configure clientAttestation with trusted-attester resolution, acceptance policy, freshness, and replay handling. Local algorithm restrictions are intersected with effective server metadata. When the server advertises a challenge endpoint, it must also provide challenge verification for these requests.

The client roles expose static proof, header, serialization, and challenge helpers. The provider roles expose static attestation verification, authentication, and challenge-handler methods. Their implementation is shared through core.

PAR parameter encoding and acceptance deadlines

PreparedPushedAuthorizationRequest.parameters is a URLSearchParams, ready to use as the POST body. This preserves repeated resource parameters. Use parameters.getAll("resource") when inspecting them. The host still decides which resources a client may access.

Request Object creation accepts JSON values. For example, max_age: 0, an OIDC claims object, and an authorization_details array remain numbers, objects, and arrays in the signed JWT and in the processed result. For an unsigned form, structured parameters are JSON-encoded; repeated resources are individual form entries. Processing a form retains its string values and returns repeated resources as an array. Unknown extension fields are preserved for the host to interpret. Invalid JSON inputs and nested request or request_uri are rejected.

With a Request Object, authorization parameters belong inside the JWT. Only request, client_id, and the applicable authentication parameters belong in the PAR form. This restriction does not change the outer parameters used by ordinary OIDC authorization-endpoint requests.

If effective client or server metadata sets require_signed_request_object: true, select a proof mode that includes a signed Request Object. Assertion-only and TLS-only PAR then fail before acceptance. Request Object signers and verification also follow the effective request_object_signing_alg and request_object_signing_alg_values_supported declarations. An omitted optional declaration adds no restriction. Supply effective providerMetadata to either provider processing method when Superiors complete or override its publication.

Successful automatic-registration and PAR results include authenticationExpiresAt. It is the earliest applicable authentication or trust deadline; JWT clock tolerance does not extend the Trust Chain. The library checks this deadline after asynchronous verification and again after adapter validation, before entering onRegistration. Starting that callback is the persistence acceptance boundary. The host owns transaction semantics and should cap any PAR request URI lifetime appropriately.

Replay, policy, and adapter work use the existing per-operation httpTimeoutMs and cancellation settings. A timeout cannot undo work already performed by a host callback. Automatic registration retains its existing exception behavior for adapter and persistence failures; the PAR method returns an error result. After a persistence timeout, reconcile the storage outcome before retrying.

These rules implement PAR §§2.3 and 3, JAR §§4 and 6, and Resource Indicators §2. Callback timeouts are library availability controls, not a protocol-defined duration.

Next: 15.6. Expire and renew federation registrations

View source on GitHub