# Upgrading to 3.1

A 2.x deployment applies [Upgrading to 3.0](https://www.abblix.com/en/docs/upgrading-to-3.0) first, then the items below.

Version 3.1 is not a drop-in replacement for 3.0. Interfaces a host implements gain members and parameters, many constructors change and some members are removed; some tenants and clients 3.0 served are refused; and some behavior changes with no error. [Before you upgrade](#before-upgrading) gathers what decides the rollout, what a host's own store changes in its records, the log records an alert moves to, and the checks to run in staging.

The changes fall into three groups: [what fails to build](#build), [what stops the host at startup or leaves a stored tenant unserved](#startup), and [what behaves differently at runtime with no error](#runtime). The last group is the one to read closely, because nothing in the build or the log points at it; where a startup item loses a setting without an error, the runtime group points back to it.

## Before you upgrade {#before-upgrading}

### Rollout and rollback {#rollout}

Replace all instances at once, rather than in a rolling update that mixes 3.0 and 3.1 nodes, when the deployment:

- uses resource indicators or token exchange audiences: 3.0 reads a refresh token issued by 3.1 as granting no resource and naming no audience ([below](#runtime-sessions));
- registers `client_secret_jwt` clients: a 3.0 node cannot authenticate one that 3.1 registered, since 3.1 keeps the value of its secret only as an encrypted copy ([below](#client-secret-encryption));
- serves dynamic registration with a client store the nodes share. A 3.0 node handling a registration or an RFC 7592 update rebuilds the client from its 3.0 model and writes the whole record, so the members 3.0 does not know are lost: `Trust` (the client then reads as trusted), `SoftwareStatement` (later updates stop applying it), the encrypted copy of a client secret 3.1 registered (`client_secret_jwt` then fails for that client on every node) and `CrossClientSubjectTokenExchange`. A deployment that rolls routes the registration and client configuration endpoints to 3.1 nodes only, from the moment a 3.1 node writes a client. A store that patches the stored JSON rather than rewriting the record keeps these members.

3.1 reserves the single-use identifier (`jti`) of a client assertion, a DPoP proof and a JWT bearer grant assertion under new keys and reads none of the keys 3.0 used, so a value 3.0 accepted just before the switch is accepted once more by 3.1 while it is still valid: a client assertion up to its `exp`, capped by `OidcOptions.ClientAssertionMaxLifetime` (one hour by default), a DPoP proof within `OidcOptions.DPoP.IssuedAtTolerance` (one minute by default), a JWT bearer assertion up to its `exp`, or one hour without one. During a rolling update the two versions do not see each other's reservations for the whole rollout. Replace every node at once; to close the window, lower `ClientAssertionMaxLifetime`, and `DPoP.IssuedAtTolerance` where needed, before the switch, and restore them once the values accepted before it have expired. Authorization codes, pushed authorization request URIs, device and CIBA records, revocation records and back-channel logout tokens keep their keys.

A rollback to 3.0 leaves the `client_secret_jwt` clients registered by 3.1 unable to authenticate ([below](#client-secret-encryption)) and reads the refresh tokens 3.1 issued as granting no resource, so a deployment with either does not roll back while they are alive.

### Stored client records {#stored-client-records}

A host keeping clients in a store of its own (a tenant store or an `ITenantClientRegistrationStore`) checks its records before the upgrade:

- A client with `AllowCrossClientSubjectTokenExchange` set to `true` gets `CrossClientSubjectTokenExchange` `Any`, or `AddressedToClient` ([below](#cross-client-exchange)).
- A hash stored only under `Sha256HashBase64`, `Sha512HashBase64`, `Sha256HashHex` or `Sha512HashHex` moves to `Sha256Hash` or `Sha512Hash`: under an alias it reads as no hash ([below](#runtime-registration)).
- A hash 3.0 computed for a secret with non-ASCII characters is computed again, or the secret is issued anew ([below](#runtime-client-auth)).
- A null where a value is required, such as a client's `TokenEndpointAuthMethod`, gets a value ([below](#nulls)).
- A client registered while registration was open gets `"Trust": "untrusted"`. A host that cannot tell which clients those are writes it into every dynamically registered record and sets `Trusted` on the clients it has checked. Read one migrated client back through the store and check `ClientInfo.Trust`: a record written in camelCase and read with the default options reads as trusted ([below](#runtime-authorization)).
- Members the store does not know itself, `Trust`, `SoftwareStatement` and `ClientSecret.EncryptedValue` among them, are kept, and a record is written and read with the same JSON serializer options.
- Redirect URIs that 3.1 refuses or no longer matches are found before an end user meets them: an `http` or private-use URI of a client that is not native, a query naming a parameter of the authorization response, and a URI a client sends in another spelling, such as another host case, a default port written out or a trailing slash ([below](#redirect-uris), [below](#runtime-authorization)).
- The store looks a client up by its identifier exactly as written, letter case included. A record it returns for an identifier in another case is taken as no client, answered `invalid_client`. Two registrations whose identifiers differ only in case are the store's to refuse ([below](#client-ids)).

### Alerts keyed on event ids {#alerts}

- 2015 is no longer logged; its refusals are logged under 2014 ([below](#runtime-tokens)).
- 3094 is no longer logged; its refusals are logged under 3018 and 3027 ([below](#runtime-client-auth)).
- New warnings: 10660, a client secret that no longer decrypts ([below](#client-secret-encryption)), and 10780, a public client declaring refresh token reuse without DPoP ([below](#runtime-sessions)).
- New errors: 10700 and 10701, a stored tenant left out ([below](#stored-tenants)).
- New Information records: 11120, 11121, 10680, 10681, 10682 and 10628, one per token response, per registration change and per client resolved from a metadata document ([below](#runtime-observability)).

### Checks in staging {#staging-checks}

- Start 3.1 against a copy of the tenant store and search the log for `left out of the tenants served`.
- Compare each tenant's discovery document with 3.0: `token_endpoint_auth_methods_supported` keeps only the methods the security profile admits, and `tls_client_auth` only where the tenant lists certificate authorities.
- Sign a test user in and out in the browser, and check that a refresh token of that session is refused, unless the deployment sets `RevokeSessionTokensOnLogout` to false.
- Renew a refresh token issued by 3.0, and run one token exchange of a token issued to another client.
- Authenticate a `private_key_jwt` client whose keys come from its `jwks_uri`. Without the proxy setting a fetch the network refuses logs event 6005, and an address the guard refuses 6004 ([below](#runtime-outbound)).
- Register a test client with every grant type and resource the deployment's clients use, and read one dynamically registered client back to check its `Trust`.
- Call registration, pushed authorization requests and introspection from a browser origin, where the deployment serves them: they need `app.UseCors()` ([below](#runtime-registration)).
- Set `OidcOptions.FingerprintKey` to the same value on every node, and check that one end user's records carry one fingerprint across nodes ([below](#runtime-observability)).

## What fails to build {#build}

A host that constructs the library's classes itself passes the new constructor arguments listed below.

- `SubjectTokenContext` gains the required `SessionId` and `AuthenticationTime` and the optional `IdentityProvider`, `AuthContextClassRef` and `AuthenticationMethodReferences`. A host's `ISubjectTokenResolver` sets the two required members or does not compile (CS9035).
- `TokenExchangeGrantHandler` takes only an `IServiceProvider`. `RefreshTokenSubjectTokenResolver` takes `(IAuthServiceJwtReader, IRefreshTokenService, IRevocationCutoffChecker)`, and `JwtSubjectTokenResolver` no longer takes an `IClientInfoProvider`. `IntrospectionRequestValidator` and `RevocationRequestValidator` take an `IAuthServiceJwtReader` where they took an `IAuthServiceJwtValidator`. `RevocationRequestProcessor` takes a `RegistrationAccessTokenRevocation` as its third parameter.
- `ReadClientRequestProcessor` takes an `IClientSecretEncryptor` as its last constructor parameter. `RegisterClientRequestProcessor` and `UpdateClientRequestProcessor` no longer take `NewClientOptions` and end with an `IClientSecretEncryptor` followed by an `IOptionsMonitor<OidcOptions>`, and `UpdateClientRequestProcessor` and `RemoveClientRequestProcessor` take an `ILogger` of their own type as their first parameter. `ClientCredentialFactory` takes an `IOptionsMonitor<OidcOptions>` in place of `NewClientOptions`, and `OfflineAccessValidator` has one constructor, taking an `IOptionsMonitor<OidcOptions>`.
- `NewClientOptions` is no longer a service of its own: the server reads it only from `OidcOptions.NewClientOptions`. A host that configured or resolved the service sets `OidcOptions.NewClientOptions` instead, through `AddOidcServices` or `Configure<OidcOptions>`. `NewClientOptions.AllowedResources` is a non-nullable array, so code assigning `null` to it does not compile ([below](#runtime-registration)).
- `BackChannelClientAuthenticationCheck` is removed, so a host that registered or constructed it drops that line. The shared check of the grants a public client may not hold ([below](#public-client-grants)) covers the backchannel grant.
- `IClientInfoProvider.TryFindClientAsync` is replaced by `FindClientAsync`, which returns the client or why it is absent: `Unknown`, or `Refused` and `TemporarilyUnavailable`, which come only from Client ID Metadata Documents and are experimental (`ABX9001`). The request's client lookup now reaches the client store, `IClientAuthenticator`, `IClientJwtValidator`, the authorization request fetchers, the authorization and pushed authorization request validators, the authorization response encoder and the response JWT builder, so a host that implements, decorates or calls any of them changes its code.
- `ConfirmationValidator` takes an `ISessionClientRegistry`. The MVC `EndSessionResponseFormatter` takes `IFrontChannelLogoutService`, `ITenantAccessor` and `IUriResolver`, the Minimal API one `IFrontChannelLogoutService`, `ITenantAccessor` and `IHttpContextAccessor`.
- The mutual TLS authenticators take a `TimeProvider`. The JWT assertion authenticators and `SigningAlgorithmsValidator` take an `IOptionsMonitor<OidcOptions>`. `ClientJwtValidator`, `ClientEncryptionKeyResolver` and `EncryptedResponseAlgorithmsValidator` take an `IClientSecretEncryptor`. `AuthorizationHandler` takes an `IRedirectUriTrustPolicy` ([below](#runtime-authorization)), an `IAuthSessionService` and an `IRevocationCutoffChecker`.
- `IClientJwtValidator` gains `ValidateSecretSignedAsync`, which a host implementing the interface adds.
- `JwtAssertionAuthenticatorBase` gains the protected abstract `Reads`, which a host's own subclass implements: it answers from the assertion's JOSE header alone whether the authenticator judges that assertion. The `client_secret_jwt` authenticator reads an assertion signed with HS256, HS384 or HS512 and a JWE; the `private_key_jwt` one reads an assertion signed with its asymmetric algorithms, a JWE, and one whose algorithm no method claims. An assertion an authenticator does not read is left to the other method, without a log line.
- Token reading takes the request's client lookup as a parameter: `IAuthServiceJwtValidator.ValidateAsync` and `IAuthServiceJwtReader.ReadAuthenticAsync` take an `IClientInfoProvider` after the client, and `IAuthServiceJwtReader.ReadRecordsAsync`, `TokenStatusCheck.CheckAsync` and `IRevocationCutoffChecker.CheckAsync` take one after the tenant. So do `IAuthorizationGrantHandler.AuthorizeAsync`, after the client, and `ISubjectTokenResolver.ResolveAsync`, after the client, which a host's own grant handler or subject token resolver changes too.
- The constructors of `AuthServiceJwtValidator` and `RevocationCutoffChecker` no longer take an `IClientInfoProvider`, and those of `IdTokenHintParser`, `RegistrationAccessTokenValidator` and `InitialAccessTokenValidator` gain one. `GrantRevocation` takes only an `ITokenRegistry`, and its `RevokeAsync` takes the refresh token's client instead of looking it up. `RefreshTokenGrantHandler` takes `(IAuthServiceJwtReader, IRefreshTokenService)`, and `IntrospectionRequestProcessor` only an `ISubjectTypeConverter`. `ValidRevocationRequest` takes the authenticated client, and `ValidIntrospectionRequest` the token's client too, as its new `TokenClient`.
- `TokenValidationContext` gains `Clients`, which the token endpoint's `ClientValidator` sets; reading it before then throws, so a host replacing that validator sets it.
- `ClientInfo.AllowCrossClientSubjectTokenExchange` is replaced by `ClientInfo.CrossClientSubjectTokenExchange`: `false` becomes `Refused`, the default, and `true` becomes `Any` ([below](#cross-client-exchange)).
- `SubjectTokenContext` also gains `ActorChainWith`, and `Audiences`, `ProofKeyThumbprint` and `CertificateSha256Thumbprint`, which a host's own subject token resolver sets. `Audiences` is the subject token's audience, which `AddressedToClient` matches to exchange another client's token addressed to the presenting client ([below](#cross-client-exchange)). The two thumbprints name the DPoP key or client certificate a token of this server is bound to, which the client the token was issued to proves to exchange it ([below](#runtime-token-exchange)).
- A host's own `IRefreshTokenService` implements `Rotates`, and `RefreshTokenRotationPolicy.Rotates` takes the payload of the presented refresh token. `AuthorizationCodeReusePreventingDecorator` takes a `GrantRevocation` and a `TimeProvider`, and `RefreshTokenReusePolicyCheck` a logger.
- `SecurityProfileRequirements.RequireAccessTokenOutsideQuery` and `HttpResponseExtensions.AddPrivateCacheDirective` are removed; a host that uses them drops those lines.
- `SecurityProfileRequirements.RequireMatchingClientIdentifiers` is removed, so a host that sets it drops that line: the server refuses a `client_id` naming a different client from the one the credentials identify, for every client ([below](#runtime-client-auth)).
- `TokenStatusCheck`, `RegistrationAccessTokenRevocation` and `ClientRequestValidator` take a `RegistrationAccessTokenBinding` in their constructors, `ClientRequestValidator` in place of an `IClientInfoManager`.
- `AuthorizationError` gains `Refusal`.
- `UserInfoRequest.AccessTokenInQuery` and `UserInfoRequest.AccessToken` are removed; read `AccessTokenInForm` ([below](#runtime-tokens)).
- The token endpoint's `ClientValidator` takes an `IAuthServiceJwtReader`.
- `OidcError` gains `BasicChallengeOwed`. A host replacing a producer of `invalid_client` sets it to keep the Basic challenge ([below](#runtime-client-auth)).
- `ClientRegistrationResponse.SoftwareStatement` moves to its base `RegisteredClientMetadata` under the same name and JSON member, so code setting it on a `ClientRegistrationResponse` still compiles.
- `JwtBearerOptions.StrictAudienceValidation` is `[Obsolete]` and changes nothing. Delete the line that assigns it: under `TreatWarningsAsErrors` it fails the build with CS0618.

## What stops the host at startup or leaves a stored tenant unserved {#startup}

### Tenants read from a store {#stored-tenants}

A tenant read from a tenant store that fails any check of the tenant list is not served after the upgrade. Requests to it are answered as if no tenant matched, while the other tenants are served, so the host starts and a health check of it stays green.

Before production, start 3.1 in staging against a copy of the tenant store and search the log for `left out of the tenants served`: the errors logged under event id 10700 (refused by a check, with the tenant ids and the reason) and 10701 (a tenant that could not be readied). A tenant declared in the settings that fails a check stops the host at startup instead. A tenant catalog of the host's own gets none of these checks.

### Client secret encryption for dynamic registration {#client-secret-encryption}

A host serving dynamic client registration (`AddDynamicClientRegistration()`) sets `TenantDefinition.ClientSecretEncryption` on every tenant. A tenant in the settings without it stops the host at startup, naming the tenant and the setting; a tenant read from a store without it is left out. A tenant catalog of the host's own is not checked, so a tenant it hands out carries the setting, or registrations at that tenant fail.

- `Key` is a base64-encoded random value of at least 32 bytes, for example the output of `openssl rand -base64 32`. Keep it in a secret store, and use a key of its own rather than the pairwise salt.
- `HashAlgorithm` is `SHA256` (the default when absent), `SHA384` or `SHA512`.

Each client secret the tenant issues at registration is then kept encrypted beside its hash, so a read or an update of the registration returns `client_secret`, as [RFC 7592, Appendix A.1](https://datatracker.ietf.org/doc/html/rfc7592#appendix-A.1) requires of a read or update response. `client_secret_basic` and `client_secret_post` still compare the hash; `client_secret_jwt` keys its HMAC with the decrypted copy. `ClientSecret` gains `EncryptedValue`, which a host's client store keeps exactly as given; JSON stored by 3.0 reads unchanged.

- A client registered before 3.1 holds only the hash of its secret, so a read of its registration answers without `client_secret`, since the server holds no copy it could return.
- Replacing `ClientSecretEncryption.Key`, or changing `HashAlgorithm`, leaves a `client_secret_jwt` client registered by 3.1 or later unable to authenticate or to receive JWTs encrypted with a symmetric key, and a read of its registration answers without `client_secret`; event id 10660 is logged as a warning. Clients stored with a plaintext secret are not affected.
- A node on an earlier version cannot authenticate a `client_secret_jwt` client registered by 3.1, because such a client keeps the value of its secret only as the encrypted copy, so these clients do not survive a rollback. `client_secret_basic` and `client_secret_post` clients compare the stored hash and keep working.

### Open registration with consent granted to every client {#open-registration-consent}

A host that grants every client everything it asks for, with the consent provider `AddConsentGrantedForEveryClient()` registers, while dynamic registration is open does not start. Registration is open when `RequireInitialAccessToken` is false and no software statement from a trusted issuer is required (`SoftwareStatement.RequireSoftwareStatement` together with `SoftwareStatement.TrustedIssuers`): anybody could then register a client and obtain an end user's tokens without the end user being asked. Keep the initial access token, require such a software statement, or register an `IUserConsentsProvider` that asks the end user. The same holds while Client ID Metadata Documents are on with no `AllowedClientIdPrefixes`, since any URL could then name itself a client.

### Token settings for new clients {#new-client-token-settings}

An empty `NewClientOptions.AllowedGrantTypes`, or one holding a blank value, stops the start of a host that calls `AddDynamicClientRegistration()` or `AddClientIdMetadataDocuments()`, naming the setting, since a document client's grant types are cut to it too; an empty `ClientIdMetadataDocuments.AllowedGrantTypes` stops the start of a host that calls `AddClientIdMetadataDocuments()` ([below](#runtime-registration)).

`NewClientOptions.AccessTokenExpiresIn`, `NewClientOptions.SingleResourceAccessTokens` and `NewClientOptions.RefreshToken` set these values for clients registered dynamically and clients resolved from a metadata document; an RFC 7592 update keeps what the client was given. A lifetime of zero or less, or longer than ten years, stops the host at startup.

### Redirect URIs {#redirect-uris}

A client declared in the tenant settings whose `RedirectUris` or `PostLogoutRedirectUris` hold a relative URI, a URI with a fragment, or a `javascript`, `data` or `vbscript` URI stops the host at startup, naming the client. A tenant read from a store with such a client is left out, with an error in the log. The library does not drop the invalid entry, even beside a working absolute URI: the host removes it before upgrading. [RFC 6749, section 3.1.2](https://datatracker.ietf.org/doc/html/rfc6749#section-3.1.2) requires a redirection endpoint to be an absolute URI without a fragment.

A client that is not native and is declared in the settings with an `http` redirect URI, `localhost` included, or with a private-use scheme stops the host at startup; a stored tenant with one is not served, and a client from the host's own store with one is refused at the authorization endpoint. [RFC 9700, section 2.6](https://datatracker.ietf.org/doc/html/rfc9700#section-2.6) forbids `http` redirect URIs except for native clients using loopback redirection, and [RFC 8252, section 7.1](https://datatracker.ietf.org/doc/html/rfc8252#section-7.1) describes private-use schemes as a redirect for native apps.

A redirect URI whose query names a parameter of the authorization response (`code`, `state`, `iss`, `error`, `error_description`, `error_uri`, `id_token`, `access_token`, `token_type`, `expires_in`, `scope`, `session_state` or `response`) stops the host at startup for a client in the settings; dynamic registration and client ID metadata documents answer it with `invalid_redirect_uri`, and the authorization endpoint refuses it for a client from the host's own store. Post-logout redirect URIs are not affected. [OAuth 2.1, section 2.3](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-2.3) forbids the parameters of the authorization response in the query of a redirect URI, and the server holds the parameters OpenID Connect, the implicit flow and JARM add to the same rule.

### Certificate authorities for tls_client_auth {#tls-client-auth}

A tenant serving `tls_client_auth` lists the certificate authorities that issue its clients' certificates, intermediates included, in `TenantDefinition.TlsClientAuthCertificateAuthorities`, each as base64-encoded DER; a self-signed certificate there is a trust anchor. A tenant listing none does not serve `tls_client_auth` or advertise it in discovery, and registration refuses the method, so its clients using it stop authenticating with no error at startup. [RFC 8705, section 2.1](https://datatracker.ietf.org/doc/html/rfc8705#section-2.1) describes this method as relying on a validated certificate chain. An entry that is not a readable base64 DER certificate, an entry that is not a certificate authority certificate, and a list without a self-signed anchor each stop the host at startup for a tenant in the settings, and leave a stored tenant out while the other tenants are served.

### Security profiles that leave no client authentication method {#profile-auth-methods}

A tenant whose security profile leaves none of the server's client authentication methods usable at its token endpoint stops the host at startup when declared in the settings, and is left out when read from a store. Examples are FAPI 2.0 on a host offering only shared-secret methods, and `tls_client_auth` as the only method of a tenant without `TlsClientAuthCertificateAuthorities`. The refusal names the tenant, its profile and why each method is unusable.

### Cross-client token exchange {#cross-client-exchange}

`ClientInfo.CrossClientSubjectTokenExchange` decides whether a client may exchange a subject token issued to another client. `Refused` is the default and `Any` admits every such token. `AddressedToClient` admits another client's access token only when its `aud` names one of the presenting client's `ResourceLocations`, compared as exact strings, as [RFC 7519, section 2](https://datatracker.ietf.org/doc/html/rfc7519#section-2) compares a StringOrURI value. A client whose `ResourceLocations` name the issuer, or one set to `AddressedToClient` with no `ResourceLocations`, stops the host at startup; a tenant read from a store with such a client is left out, and the other tenants are served.

A client declared in the settings or kept in a store that still carries `AllowCrossClientSubjectTokenExchange` loses it without an error: no part of 3.1 reads that key, and no startup check names it. The client takes `Refused`, and its exchanges of tokens issued to other clients are refused. Set `CrossClientSubjectTokenExchange` to `Any` for each client that had `AllowCrossClientSubjectTokenExchange` set to `true` to keep the behavior of 3.0, or to `AddressedToClient` when the tokens it exchanges are addressed to it.

### Native clients {#native-clients}

A native client (`ApplicationType` `native`) declared in the tenant settings starts only with `TokenEndpointAuthMethod` `none` (the default is `client_secret_basic`) and with redirect and post-logout redirect URIs on a private-use scheme containing a period (`com.example.app:/cb`), on `https`, or on `http` to a loopback host. Credentials of each installation reach the server through dynamic registration or an `ITenantClientRegistrationStore`. A tenant read from a store with a native client that breaks these rules is left out, and the other tenants are served.

Dynamic registration of a native client refuses a private-use scheme without a period, and a claimed `https` redirect registers as a web client with `token_endpoint_auth_method` `none`.

A native client may use only response types that include `code` and not `token`, or `none`, so `code token` and `code id_token token` are refused as `token` and `id_token token` are. Another one stops the host at startup for a client in the settings, is refused at registration, and is refused at the authorization endpoint. [RFC 8252, section 8.2](https://datatracker.ietf.org/doc/html/rfc8252#section-8.2) recommends against the implicit flow for native apps, and [RFC 9700, section 2.1.2](https://datatracker.ietf.org/doc/html/rfc9700#section-2.1.2) recommends against it for every client.

[RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252) sets these rules. [Section 7.1](https://datatracker.ietf.org/doc/html/rfc8252#section-7.1) requires a private-use scheme based on a domain name the app controls, in reverse order, and [section 8.4](https://datatracker.ietf.org/doc/html/rfc8252#section-8.4) recommends that a server reject one without a period. Claimed `https` redirects are [section 7.2](https://datatracker.ietf.org/doc/html/rfc8252#section-7.2), loopback redirects [section 7.3](https://datatracker.ietf.org/doc/html/rfc8252#section-7.3). A secret built into an app distributed to many users is not a confidential secret, and [section 8.5](https://datatracker.ietf.org/doc/html/rfc8252#section-8.5) requires the server to treat such a client as public.

### Grants a public client may not hold {#public-client-grants}

A client authenticating with `none` may not hold the `client_credentials`, `password`, `urn:ietf:params:oauth:grant-type:jwt-bearer` or `urn:openid:params:grant-type:ciba` grant. Such a client declared in the tenant settings stops the host at startup, naming the client; a tenant read from a store with one is left out, and the other tenants are served. Move the client to a method that authenticates it, or drop the grant.

A dynamic registration or an RFC 7592 update asking for such a grant is refused with `invalid_client_metadata`, and the token endpoint, like the backchannel authentication endpoint for the backchannel grant, refuses it to a public client from the host's own store with `unauthorized_client`.

A client ID metadata document of such a client loses these grants, and its backchannel delivery mode and notification endpoint too, whether it declares the backchannel grant or not, so the client is served without the flow rather than refused, unless it is pairwise and took its sector through that mode (from its `jwks_uri` in poll or ping mode, from its notification endpoint in push mode).

[RFC 6749, section 4.4](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4) requires that only confidential clients use `client_credentials`. [CIBA Core 1.0](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html) requires the client to authenticate at the backchannel authentication endpoint ([section 7.1](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.7.1)) and at the token endpoint in poll and ping mode ([section 10.1](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.10.1)). The server holds the password and JWT bearer grants to the same rule.

### Client identifiers compared exactly {#client-ids}

A client is recognized only by its `client_id` exactly as it was declared or registered, letter case included, in a registration store of the host's own too. Two clients in the settings whose ids differ only in case stop the host at startup, and a tenant read from a store with two such clients is left out. The server also refuses a registration whose id differs only in case from a client it holds; a host's own registration store keeps that rule itself, and looks a client up by its id exactly as written: a record it returns for an id in another case is taken as no client.

Dynamic registration assigns every `client_id`: a `client_id` in the registration request is replaced by one the server generates, so a registrant that sends one gets 201 with a different one. [RFC 9700, section 4.15.1](https://datatracker.ietf.org/doc/html/rfc9700#section-4.15.1) recommends against letting clients influence their `client_id` where client and user identifiers share a namespace, and [RFC 7591, section 3.1](https://datatracker.ietf.org/doc/html/rfc7591#section-3.1) describes the identifier as assigned by the server. A host that lets registrants choose sets `NewClientOptions.AcceptProposedClientId` (false by default). Registration then refuses a proposed id that differs only in case from a registered one, answered as already registered, and, while Client ID Metadata Documents are enabled, one that is an `https` URL. An RFC 7592 update keeps the client's own `client_id`.

### Nulls in a tenant definition {#nulls}

A tenant holding a null where its types declare a value (a member or a collection element whose nullable annotation rules null out) is refused alone, with `Tenant '<id>': <path> is null, where a value is required.` From the settings it stops the host at startup; from a store it is left out and the other tenants are served. Every endpoint of a left-out tenant answers 404, discovery and the key set included, until a reading of the store (every `RefreshTenantsEvery`, one minute by default) finds it fixed. Members 3.0 accepted as null count, such as a client's `TokenEndpointAuthMethod` written as null in a stored definition.

### Client assertion lifetime {#client-assertion-lifetime}

`OidcOptions.ClientAssertionMaxLifetime` of zero or less stops the host at startup ([below](#runtime-client-auth)).

### Binding message length {#binding-message-length}

`BackChannelAuthenticationOptions.MaximumBindingMessageLength` of zero or less stops the host at startup ([below](#runtime-backchannel)).

### Outbound proxy and allowed destinations {#outbound-proxy-settings}

A `SecureHttpFetchOptions.OutboundProxy` or `SharedSignalsTransmitterOptions.OutboundProxy` that is not an absolute `http`, `https`, `socks4`, `socks4a`, `socks5` or `socks5h` address without a path, query or fragment, with a port where the scheme has no default one, stops the host at startup, and so does an invalid `SecureHttpFetchOptions.AllowedDestinations` entry.

## What behaves differently at runtime, with no error {#runtime}

### Sessions and refresh tokens {#runtime-sessions}

- Ending a session revokes the tokens issued in it: `OidcOptions.RevokeSessionTokensOnLogout` is now `true` by default. After the end user signs out, or signs in as someone else in the same browser, every refresh token of that session is refused, and so is its access token at introspection and at the UserInfo endpoint. This includes native clients that signed in through that browser, and device or CIBA grants the host recorded under that session. An authorization code issued in the session and not yet redeemed is refused too, and so is any of its tokens presented to a token exchange. A deployment whose native applications stay signed in after a browser sign-out sets `options.RevokeSessionTokensOnLogout = false` in `AddOidcServices`.
- A client gets a refresh token only when two conditions hold. First, its `ClientInfo.OfflineAccess` allows offline access: a client the host declares has it `Disabled` unless set, and a dynamically registered client takes `NewClientOptions.OfflineAccess`, `ConsentRequired` by default, which gives offline access only to an authorization request with `prompt=consent`. Second, it may redeem one: its `AllowedGrantTypes` include `refresh_token`, or token exchange with `TokenExchangeAllowedSubjectTokenTypes` admitting the refresh token type.
- A client with no `AllowedGrantTypes`, and a registered client without `grant_types`, take `authorization_code` only, so they get no refresh token until `refresh_token` is added. For a client that may not redeem one, `offline_access` is dropped at the authorization, device authorization and backchannel authentication requests and at the token endpoint, so the end user is not asked to consent to it and no access token carries it. A host's `IUserDeviceAuthenticationHandler` shows the end user `ValidBackChannelAuthenticationRequest.Scope`, which leaves a dropped `offline_access` out, rather than `Model.Scope`.
- A public client's refresh token rotates on every use unless it is bound to a DPoP key, whatever `RefreshTokenReusePolicy` the client declares. A public client declaring reuse without `RequireDPoP` is still served, and event id 10780 is logged as a warning naming the tenant and the client. [RFC 9700, section 2.2.2](https://datatracker.ietf.org/doc/html/rfc9700#section-2.2.2) requires a public client's refresh tokens to be sender-constrained or rotated. Such a client presenting a refresh token that was already replaced loses the whole grant, since the server reads it as a replay and revokes every token of that grant, so a retried refresh or two browser tabs sharing one token sign the user out of the client.
- When the presented refresh token rotates, a refresh request naming a narrower scope gets a new refresh token with the scope of the presented one, as [RFC 6749, section 6](https://datatracker.ietf.org/doc/html/rfc6749#section-6) requires.
- A refresh token is addressed to the issuer: its `aud` is the issuer identifier, and the resources and token exchange audiences of the grant travel in claims only the server reads. A deployment using resource indicators or token exchange audiences replaces all its instances at once rather than in a rolling update that mixes 3.0 and 3.1, and does not roll back to 3.0 while refresh tokens issued by 3.1 are alive, because 3.0 reads such a token as granting no resource and naming no audience. A refresh token issued by 3.0 keeps renewing for the resources and audiences it was issued for: 3.1 reads them from its `aud` when the server's own claims are absent.
- A refresh token older than its client's current absolute lifetime (`RefreshToken.AbsoluteExpiresIn`) is refused: with `invalid_grant` at the refresh token grant, and with `invalid_request` as the `subject_token` of a token exchange.
- A reused authorization code revokes the refresh token family its first redemption started, and a code whose stored grant records no family revokes the tokens recorded with it. [RFC 6749, section 4.1.2](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2) recommends revoking the tokens issued on a code used more than once, and [RFC 9700, section 4.2.4](https://datatracker.ietf.org/doc/html/rfc9700#section-4.2.4) repeats that recommendation.
- An ID token carries `sid` only for a client with `BackChannelLogout` set, or with `FrontChannelLogout` whose `RequiresSessionId` is true. An ID token without `sid` is refused as the `subject_token` or `actor_token` of a token exchange ([below](#runtime-token-exchange)).
- A logout request whose `id_token_hint` carries no `sid` ends the session without asking when the hint names the signed-in end user, carries that session's authentication time and was issued to a client that signed in to it. Otherwise the end user is asked to confirm. [RP-Initiated Logout 1.0, section 2](https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout) requires the question when no `id_token_hint` is given or the ID token does not belong to the current session with that client, and [section 6](https://openid.net/specs/openid-connect-rpinitiated-1_0.html#Security) gives the reason: a logout request without a valid hint can force a sign-out.
- With the new `TenantDefinition.LogoutConfirmationUri` set, the end session endpoint sends the browser to that page to ask (303, with the request's parameters and the confirmation value, and `Referrer-Policy: no-referrer`) instead of answering 400 with JSON. The host builds that page. When the end user declines, it must not follow the `post_logout_redirect_uri` from its query: [section 3](https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RedirectionAfterLogout) forbids post-logout redirection to an address that does not exactly match one the client registered. The page asks and sends the answer back to the end session endpoint, by GET or POST. Left unset, the endpoint answers 400 `confirmation_required` with the confirmation value, as before.

### Reading and validating tokens {#runtime-tokens}

- The UserInfo endpoint answers only access tokens issued for an end user, as [OpenID Connect Core 1.0, section 5.3](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo) describes it; a token from the client credentials grant gets 401 `invalid_token`.
- A token from the client credentials grant carries `idp` `client_credentials`, and introspection shows that `idp` to every authorized caller; an end user's `idp` stays withheld from other clients. A resource server tells a client's own token from an end user's by `idp`, not by `sub` equal to `client_id`: for a pairwise client `sub` is the client's pseudonym.
- The UserInfo endpoint reads the access token from the `Authorization` header or the form-encoded body and ignores an `access_token` in the query, as [OAuth 2.1, section 5.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-5.1) requires of a resource server. A request carrying one beside a token in the header or the body is answered with that token, where it was refused with `invalid_request`, and a repeated or empty `access_token` in the query is ignored too. A token in the query alone is answered as a request without a token: 401 with a bare `Bearer` challenge, which [RFC 6750, section 3.1](https://datatracker.ietf.org/doc/html/rfc6750#section-3.1) recommends for a request without authentication.
- A token request naming a grant type the server has no handler for is answered `unsupported_grant_type` even when the client is not allowed that type, where such a client got `unauthorized_client`. Grant types are compared exactly, so one differing only in letter case is unsupported.
- A `code_verifier` that is not 43 to 128 characters from the unreserved set (`A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, `~`), as [OAuth 2.1, section 4.1.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-4.1.1) defines it, and a `code_verifier` sent for a code issued without a `code_challenge`, are answered `invalid_request` where they got `invalid_grant` ([section 3.2.4](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-3.2.4)). A missing or mismatching `code_verifier` stays `invalid_grant`. A `plain` code challenge shorter than 43 characters can no longer be redeemed, since its verifier is the challenge itself.
- A token request for a code issued with a `code_challenge` may leave out `redirect_uri`, whether or not the authorization request named one, as [OAuth 2.1, section 10.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-10.2) describes; one that is sent is identical to the URI the code was issued at. For a code issued without PKCE the rule of RFC 6749 stays, and a missing `redirect_uri` there is answered `invalid_request` where it got `invalid_grant`.
- Revocation, introspection, the refresh token grant and the token exchange of a refresh token read tokens through `IAuthServiceJwtReader`, which `AuthServiceJwtValidator` implements and which is registered apart from `IAuthServiceJwtValidator`. A host that replaced or decorated `IAuthServiceJwtValidator` registers the same behavior for `IAuthServiceJwtReader`, or those four read tokens without it, with no error: a check the host added there no longer runs at them.
- A signed request object (authorization, pushed authorization and backchannel authentication endpoints) and a CIBA `login_hint_token` that carry an `aud` must name the issuer identifier exactly as `TenantDefinition.Issuer` writes it. An `aud` naming only the endpoint address is refused. An object without `aud` is accepted. [RFC 9101, section 4](https://datatracker.ietf.org/doc/html/rfc9101#section-4) recommends the issuer identifier as the audience of a request object.
- The JWT bearer grant ([RFC 7523](https://datatracker.ietf.org/doc/html/rfc7523) authorization grant) accepts an `aud` naming the issuer identifier, the token endpoint on the issuer's scheme, host and port, or its mutual TLS alias where the tenant has one. [RFC 10070, section 4](https://datatracker.ietf.org/doc/html/rfc10070#section-4), which replaces this rule of RFC 7523, allows an authorization grant to identify the server by either its issuer identifier or its token endpoint URL. This assertion is a different one from the JWT a client authenticates with: the same section requires that JWT to name the issuer identifier as its only audience and forbids the token endpoint URL there ([Upgrading to 3.0](https://www.abblix.com/en/docs/upgrading-to-3.0#behavior-clients)). Every audience refusal of the grant is logged under event id 2014, whose message carries the accepted token endpoint spellings as a list and no `{ApplicationUri}`; event id 2015 is not logged, so an alert keyed on it moves to 2014. A host constructing `JwtBearerAssertionPolicy` itself with the six-parameter constructor accepts only the issuer identifier; the constructor taking an `IServiceProvider` accepts the token endpoint too.
- A native client (`ApplicationType` `native`) and a public client (`TokenEndpointAuthMethod` `none`) use PKCE whatever `ClientInfo.PkceRequired` says: `ClientInfo.EffectivePkceRequired` is true for them, so the authorization endpoint refuses their code request without a `code_challenge`, clients in the host's own store included. Registration refuses `pkce_required: false` for such a client. A confidential web client keeps the opt-out. [RFC 9700, section 2.1.1](https://datatracker.ietf.org/doc/html/rfc9700#section-2.1.1) requires PKCE from public clients.
- At the authorization endpoint, a request object naming an unknown client is answered `unauthorized_client`, and a request object or `request_uri` naming a client whose metadata document is refused is answered `invalid_client`. Neither is redirected to the client.
- Only `AuthorizationCodeGrantHandler` compares the token request's `redirect_uri` with the grant's `AuthorizationContext.RedirectUri`; a host's own `IAuthorizationGrantHandler` that sets `RedirectUri` and needs the comparison makes it itself.

### Client authentication {#runtime-client-auth}

- With `client_secret_basic`, the server decodes the client id and secret as `application/x-www-form-urlencoded`, the encoding [RFC 6749, section 2.3.1](https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1) describes for the client: `+` is a space, `%XX` a byte, and a `%` without two hex digits refuses the credential. A client whose id or secret holds `%` or `+` sends it encoded. `client_secret_post` was form-decoded before, and `client_secret_jwt` is not affected.
- `IHashService` hashes the UTF-8 bytes of a secret. A hash 3.0 computed for a secret with non-ASCII characters no longer matches, because 3.0 hashed each such character as `?`, and the client gets `invalid_client` until the secret is hashed again or issued anew. Generated secrets and secrets of ASCII characters only are not affected.
- A `client_id` parameter naming a different client from the one the credentials identify is refused, at the pushed authorization request endpoint with `invalid_client`. [RFC 7521, section 4.2](https://datatracker.ietf.org/doc/html/rfc7521#section-4.2) requires a `client_id` sent beside an assertion to identify the client the assertion authenticates.
- `OidcOptions.ClientAssertionMaxLifetime` (one hour by default) bounds a `private_key_jwt` or `client_secret_jwt` assertion: one whose `exp` lies further than that past its `iat`, or past the current time and the client's forward clock skew, is refused. A value of zero or less stops the host at startup. [RFC 7523, section 3](https://datatracker.ietf.org/doc/html/rfc7523#section-3) notes that the server may reject an `exp` unreasonably far in the future.
- `private_key_jwt` refuses an assertion signed with an HMAC algorithm. [OpenID Connect Core 1.0, section 9](https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication) has a `private_key_jwt` client sign with the key it registered; an HMAC over the client secret is `client_secret_jwt`.
- `client_secret_jwt` accepts only the HS algorithms its secret is long enough to key: [RFC 7518, section 3.2](https://datatracker.ietf.org/doc/html/rfc7518#section-3.2) requires a key at least as long as the hash output. A generated secret is 64 bytes by default; a secret under 32 bytes the host declares keys no algorithm.
- `self_signed_tls_client_auth` refuses a certificate outside its validity period.
- Under a security profile requiring sender-constrained tokens, a client registered for certificate-bound access tokens that presents no client certificate at the token endpoint, for example at the top-level endpoint instead of its mutual TLS alias, is refused with `invalid_client`, and the description names the certificate and the alias. A client that expects `invalid_dpop_proof` for that request gets the new code. RFC 8705 defines no error for this case; the server answers it as [RFC 8705, section 2](https://datatracker.ietf.org/doc/html/rfc8705#section-2) describes for a missing certificate in mutual TLS client authentication.
- A refusal of client authentication (`invalid_client`) is answered 401 with `WWW-Authenticate: Basic` when the request itself authenticated with HTTP Basic in the `Authorization` header, as [OAuth 2.1, section 3.2.4](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-3.2.4) requires, whatever method the client is registered for. Any other request, from a `client_secret_basic` client that sent its credential elsewhere or sent none included, gets 400 without a challenge at the token, revocation, pushed authorization request and device authorization endpoints, which the section allows, where it got 401 with a Basic challenge. The backchannel authentication endpoint ([CIBA Core 1.0, section 13](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.13)) and the introspection endpoint ([RFC 7662, section 2.3](https://datatracker.ietf.org/doc/html/rfc7662#section-2.3)) keep 401, without a challenge. A client that reads the status rather than the `error` member changes.
- A refresh token request with no client credential and no `client_id` is authenticated as the client its refresh token was issued to, so a public client may leave `client_id` out, as [OAuth 2.1, sections 3.2.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-3.2.2) and [4.3.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-4.3.1) allow; such a request got `invalid_client` before. A confidential client still authenticates, and a request whose refresh token cannot be read stays `invalid_client`.
- A tenant without `TlsClientAuthCertificateAuthorities` no longer serves `tls_client_auth`, and its clients using it stop authenticating with no error at startup ([above](#tls-client-auth)).
- Event id 3094 is no longer logged; its refusals are logged under 3018 and 3027, so an alert keyed on it moves.

### Authorization endpoint {#runtime-authorization}

- Every client carries `ClientInfo.Trust`, `Trusted` or `Untrusted`, decided once when the client is created and stored with it as the JSON string `trusted` or `untrusted`, so every replica reads the same value. A client declared in the tenant settings is trusted unless the host sets `Untrusted`. A client registered dynamically while registration is open ([above](#open-registration-consent)) is untrusted, and one registered while it is closed is trusted. A client from a metadata document is untrusted unless `AllowedClientIdPrefixes` has entries. A registrant cannot set or change it: it is not registration metadata, registration responses do not return it, and an RFC 7592 update keeps it.
- A client record stored by 3.0 names no trust and reads as trusted. A host that ran dynamic registration without an initial access token writes `"Trust": "untrusted"` into the records of those clients, or their authorization errors keep being redirected after a login. The store writes and reads the record with the same JSON serializer options: a record written in camelCase and read with the default options reads `trust` as absent, that is, trusted.
- Changing `RequireInitialAccessToken` later leaves the clients registered before as they were. A host that decides to trust a client writes its `Trust` to its store, and replicas see it on the next lookup of a registration, at the next reading of the tenant store (`RefreshTenantsEvery`) for a declared client, and within `ClientIdMetadataDocuments.MaximumCacheDuration` for a client from a metadata document.
- An authorization error for an untrusted client is answered by the server with 400 at once, whether an end user is signed in or not, instead of being redirected. A host that trusts such clients sets their `Trust` to `Trusted` or registers its own `IRedirectUriTrustPolicy`. [RFC 9700, section 4.11.2](https://datatracker.ietf.org/doc/html/rfc9700#section-4.11.2) recommends redirecting automatically only to a redirection URI the server trusts.
- An authorization error that will be redirected to a trusted client while nobody is signed in, other than for `prompt=none`, first sends the end user to the login page, which receives the request as it receives a valid one; the error is redirected when the page sends the request back after the login. A login page that reads the pending request meets requests the server is going to refuse. The same section requires the server to authenticate the end user before redirecting.
- An authorization request without the `openid` scope may leave out `redirect_uri` when the client has exactly one registered redirect URI, as [OAuth 2.1, section 4.1.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-4.1.1) allows; the server answers at that URI. OpenID Connect requests, requests of a client with several registered redirect URIs and requests of a client held to a FAPI profile still name it. A host that relied on the server refusing such a request now sees it served.
- A `code_challenge` that is not 43 to 128 characters from the unreserved set is refused with `invalid_request` at the redirect URI ([OAuth 2.1, section 4.1.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-4.1.1), [RFC 7636, section 4.2](https://datatracker.ietf.org/doc/html/rfc7636#section-4.2)), where a code was issued for it before; a `plain` challenge shorter than 43 characters is refused the same way.
- A `code_challenge` without `code_challenge_method` in a request that issues a code is `plain`, as [RFC 7636, section 4.3](https://datatracker.ietf.org/doc/html/rfc7636#section-4.3) defines, and is refused unless the client allows `plain`. A request that issues no code keeps no method.
- Discovery lists `plain` in `code_challenge_methods_supported` ([RFC 8414, section 2](https://datatracker.ietf.org/doc/html/rfc8414#section-2)) only for a tenant that declares a client allowed to use it. Clients registered dynamically or resolved from metadata documents never get `plain`, and discovery does not see the clients of a host's own store.
- The authorization and token endpoints match a redirect URI only as it was written: a different host case, an explicit default port, a percent-encoded unreserved character or a trailing slash on an empty path is a different URI. [RFC 9700, section 4.1.3](https://datatracker.ietf.org/doc/html/rfc9700#section-4.1.3) requires simple string comparison. A loopback redirect URI on `127.0.0.1` or `[::1]` still takes any port, as [RFC 8252, section 7.3](https://datatracker.ietf.org/doc/html/rfc8252#section-7.3) requires; one on `localhost` needs its exact port, since [section 8.3](https://datatracker.ietf.org/doc/html/rfc8252#section-8.3) recommends against `localhost` and section 7.3 gives the port exception to the loopback IP literals.

### Token exchange {#runtime-token-exchange}

- A client that still carries `AllowCrossClientSubjectTokenExchange` takes `Refused`, with no error and no log record, and its exchanges of tokens issued to other clients are refused ([above](#cross-client-exchange)). Search the settings and the client store for that key before upgrading.
- A host's own subject token resolver returns `Subject` and every `sub` of `Act` as real identifiers, never a pairwise pseudonym.
- A client exchanging its own subject token bound to a DPoP key or a client certificate presents a DPoP proof of that key, or that certificate. An exchange of another client's subject token ([above](#cross-client-exchange)) is not held to the holder's key. A public client's refresh token is accepted as `subject_token` only when bound to a DPoP key, otherwise the exchange is refused with `invalid_request`: an exchange issues no refresh token, so it cannot rotate one, which [RFC 9700, section 2.2.2](https://datatracker.ietf.org/doc/html/rfc9700#section-2.2.2) requires of an unbound one.
- A token issued by token exchange belongs to the session of its subject token, carries that sign-in's `auth_time`, `acr` and `amr`, and expires no later than the subject token, so revoking the session revokes the exchanged token too. A JWT subject or actor token without `sid` or `auth_time` is refused. A token exchanged again without an `actor_token` keeps the subject token's `act`.
- A failure a subject token resolver returns reaches the client as `invalid_request`, its description prefixed with `subject_token:` or `actor_token:`; only `server_error` and `temporarily_unavailable` pass as the resolver wrote them. A subject token too close to its expiry to give the new token any lifetime is refused with `invalid_request` too.
- A token issued to a pairwise client carries every `sub` of its `act` as that client's pseudonym, as it carries `sub`, so a delegated access token issued to such a client by 3.0 is refused until it expires. Introspection by a caller other than the token's client returns `act`: with the caller's own pseudonyms for a pairwise caller, and without any `sub` for another caller.

### Discovery and registration {#runtime-registration}

- Discovery publishes every endpoint on the scheme, host and port of the tenant's `Issuer`, whatever host the document was fetched by, and the register, read and update responses of RFC 7592 return `registration_client_uri` the same way. A consumer inside the deployment that fetches discovery by an internal name (a Docker Compose service, a cluster service name) reads the issuer's public addresses: it fetches discovery at the issuer, or names the endpoints itself.
- Discovery publishes only the client authentication methods the tenant's security profile admits (a FAPI profile leaves out `client_secret_basic`, `client_secret_post` and `client_secret_jwt`, and `tls_client_auth` appears only where the tenant lists certificate authorities), adds the lists of the revocation and introspection endpoints, leaves out an empty list, and publishes a list of signing algorithms only beside a method that uses a JWT. A client that chose its method from discovery may choose another one.
- `RegistrationClientUriBuilder.Build` reads the tenant from `HttpContext.RequestServices`, so a host calling it over an `HttpContext` it built itself supplies request services.
- The compiler-generated equality of `ClientRegistrationRequest` compares whether `offline_access` was stated, so a request without the member is not equal to one stating `consent_required`, although both read `OfflineAccess` as `ConsentRequired`.
- The aliases `Sha256HashBase64`, `Sha512HashBase64`, `Sha256HashHex` and `Sha512HashHex` of `ClientSecret` are read from configuration only and are `[JsonIgnore]`, so JSON carries each hash once, as `Sha256Hash` or `Sha512Hash`. JSON written by 3.0 reads to the same hashes. System.Text.Json skips an alias on reading too, so a stored client whose JSON names a hash only through an alias holds no hash.
- Introspection answers `active` false for a registration access token once it is revoked, replaced by an update or its client is deleted; a read of the registration keeps the token. [RFC 7592, section 2.3](https://datatracker.ietf.org/doc/html/rfc7592#section-2.3) describes a deletion invalidating the client's registration access token, and [Appendix A.1](https://datatracker.ietf.org/doc/html/rfc7592#appendix-A.1) describes replacing it at a read or an update.
- `NewClientOptions.AllowedGrantTypes` names the grant types a dynamically registered client may take. Left unset, it admits `authorization_code` and `refresh_token`; a list the host sets, in code or in configuration, is taken as written. It holds in every registration mode: open registration, an initial access token and a required trusted software statement alike, and every RFC 7592 update. A registration or update asking for another grant type, such as `client_credentials`, `password`, `implicit` or the device, CIBA, JWT bearer or token exchange grant, is refused with `invalid_client_metadata`. A 3.0 host whose clients register with such a grant, even while presenting an initial access token or a trusted statement, lists it there.
- `NewClientOptions.AllowedResources` names the resources a dynamically registered client may reach, none by default. A client that names no `allowed_resources` gets this list, so by default it gets access tokens for no resource, and one naming a resource outside it is refused. A host whose registered clients get access tokens for resources lists those resources there.
- A client from a metadata document takes the grant types that `ClientIdMetadataDocuments.AllowedGrantTypes` (`authorization_code` and `refresh_token` when unset), `NewClientOptions.AllowedGrantTypes` and the server all admit, so a host giving such clients another grant names it in both lists; its resources come from `NewClientOptions.AllowedResources`.
- A client registered before the upgrade keeps its grant types and resources until its next RFC 7592 update, which is judged against these lists.
- The registration endpoints (registration, and reading, updating and deleting a client), the pushed authorization request endpoint and the introspection endpoint apply the library's CORS policy on both adapters, as the token, revocation, UserInfo and discovery endpoints already did, since [OAuth 2.1, section 3.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-17#section-3.2) requires CORS headers for browser-based clients. A host serving any of them calls `app.UseCors()`. With `OidcCorsOptions` left empty, any origin may read their responses; a host restricting origins sets `OidcCorsOptions.AllowedOrigins` or defines its own policy of that name.
- A `client_id` in a registration request is replaced by one the server generates, unless the host sets `NewClientOptions.AcceptProposedClientId` ([above](#client-ids)).
- Dynamic registration accepts a `token_endpoint_auth_method` exactly when discovery lists it for the tenant.
- An RFC 7592 update carrying a `client_secret` other than the one issued to the client is refused with `invalid_client_metadata`; an update carrying none is applied as before.
- Where a trusted software statement names a member, the client is registered with the statement's value rather than the request body's, as [RFC 7591, section 2](https://datatracker.ietf.org/doc/html/rfc7591#section-2) requires, and an RFC 7592 update cannot replace those members. Another statement presented at an update is validated in full and sets only the members it carries that the registered statement does not; it is neither stored nor returned. A host extension reading `ClientRegistrationRequest.AdditionalMembers` sees the statement's value for a member both carry. `SoftwareStatementValidator` runs first among the metadata checks, so a host composing the checks by position finds it moved.
- `ClientInfo` gains `SoftwareStatement`, the statement the client was registered with. A store keeping `ClientInfo` as JSON keeps one more member, and a record without it reads as a client registered without a statement. The read and update responses of RFC 7592 return `software_statement`, as the registration response does; [RFC 7591, section 3.2.1](https://datatracker.ietf.org/doc/html/rfc7591#section-3.2.1) requires the statement in the response unmodified.

### Backchannel authentication {#runtime-backchannel}

- A `binding_message` longer than `BackChannelAuthenticationOptions.MaximumBindingMessageLength` (128 code points by default), or carrying a code point of the Unicode categories Cc, Cf, Co, Cs, Cn, Zl or Zp, is refused with 400 `invalid_binding_message`, the error [CIBA Core 1.0, section 13](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.13) defines. A bidirectional override or a zero-width character would make the device show different text from what was sent; [section 7.1](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.7.1) recommends a relatively short message in a limited set of plain text characters. A short message with letters of any script passes, and so does a single emoji; emoji joined with U+200D do not.

### Log records and traces {#runtime-observability}

- The library writes Information records with stable event ids for what it hands out and changes: 11120 for the tokens a token request is answered with (every grant, CIBA push delivery included), 11121 for tokens the authorization endpoint hands out in the implicit and hybrid flows, 10680, 10681 and 10682 for a client registered, updated and removed through dynamic registration, and 10628 for a client resolved from its metadata document, once per document held. A host whose log filter keeps Information for the library's categories now receives one record per token response and per registration change; one that drops Information does not see them.
- The token records carry the tenant, the `client_id`, the grant type, the scope and the audiences, and those of the token endpoint the grant id too; the registration records carry the client's trust, grant types, scope and resources. The end user appears only as a fingerprint, and no record carries a token, a client secret or a registration access token. Set `OidcOptions.FingerprintKey` to the same value on every node so the fingerprints of one end user match across nodes and restarts; left unset, each process draws its own key.
- Endpoint spans carry `oauth.client_id` (`TelemetryTags.ClientId`) once the client is known. Measurements never name a client, and no span or measurement names the end user. A host whose trace backend must not receive client identifiers drops the attribute in its exporter or processor.

### Outbound requests to client-supplied addresses {#runtime-outbound}

- Outbound requests to addresses a client supplies (key sets, request objects, sector identifiers, back-channel logout and CIBA notifications, Shared Signals push delivery, client metadata documents) use no proxy unless one is named: neither the system proxy nor `HTTP_PROXY` and `HTTPS_PROXY`. A deployment that leaves its network through a forward proxy sets `SecureHttpFetchOptions.OutboundProxy`, and `SharedSignalsTransmitterOptions.OutboundProxy` for push delivery. With a proxy, the server still refuses an address its own lookup returns, but the proxy resolves the name again.
- These requests refuse HTTP/3: a request with `Version` 3.0 or higher, or with `VersionPolicy` `RequestVersionOrHigher`. With `BlockPrivateNetworks` on, they refuse every block of the IANA special-purpose address registries ([IPv4](https://www.iana.org/assignments/iana-ipv4-special-registry/), [IPv6](https://www.iana.org/assignments/iana-ipv6-special-registry/)), the documentation, benchmarking, AS112 and AMT blocks among them.
- They take their TLS options from `AddressValidatingHttpMessageHandler.SslOptions`, where a host sets a private certificate authority or a client certificate. By default they download no certificate the endpoint's chain names and check no revocation online, so an endpoint that serves its certificate without its intermediate certificates is refused, and on Windows so is one whose public root is not yet in the local store. A host that needs downloads sets its own `CertificateChainPolicy` there.
- A refused fetch is logged by the step that made it: event 6004 for an address the guard refuses, 6005 for a host it cannot reach, a missing intermediate certificate included, with the exception, 6003 for a timeout, 6023 added for a key set, and 10623 for a client metadata document. A refused key set or request object fails the client's request; a refused metadata document answers 503 while no valid copy is held.
- A class derived from `AddressValidatingHttpMessageHandler` judges the request URI in `GuardAsync` and the resolved addresses by the rule `AddressRuleFor` returns; one that overrides only `GuardAsync` connects without judging the address, so it overrides `AddressRuleFor` too. The handler under the guard is not an `HttpClientHandler`, and the synchronous `Send` throws `NotSupportedException`. A refused address arrives as `OutboundAddressRefusedException`, an `HttpRequestException`.
- The receiver address of push delivery is judged by the primary handler of the client named `PushDeliveryTransport.HttpClientName`. `ConfigurePrimaryHttpMessageHandler` or `UseSocketsHttpHandler` on that client, or on a client of the server's secure fetch, replaces the guard; add handlers with `AddHttpMessageHandler`. `PushDeliverySender.SendPendingAsync` returns a failed pass for a refused receiver instead of throwing: nothing is sent, the events stay queued, and a warning names the stream.

## Caches {#caches}

For each of `IMemoryCache` and `IDistributedCache` the host does not register, the library uses an in-process cache of its own, and a cache the host registers is used whatever order it is registered in; `Abblix.JWT` references `Microsoft.Extensions.Caching.Memory` for them. Only a cache registered without a key is found: one registered only as a keyed service is not, and the library keeps its state in process.

With a distributed cache keeping used `jti` values against replay, the values reserved before the upgrade stay under their earlier keys until they expire, and nothing in 3.1 reads them ([above](#rollout)).

## Client ID Metadata Documents {#client-id-metadata-documents}

Client ID Metadata Documents (`AddClientIdMetadataDocuments()`) are new and experimental in 3.1. The feature implements an IETF Internet-Draft, [draft-ietf-oauth-client-id-metadata-document-03](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-03), and its API may change in a minor release until the draft becomes an RFC; the compiler reports `ABX9001` wherever code uses it. The [Abblix.OIDC.Server package README](https://github.com/Abblix/Oidc.Server/blob/master/src/Abblix.Oidc.Server/README.md#client-id-metadata-documents) shows how to turn it on.

A client from a metadata document is held to the first `token_endpoint_auth_method` it declares that its tenant admits: a document listing `tls_client_auth` before `private_key_jwt` gets `private_key_jwt` at a tenant without certificate authorities. A document whose JSON strings do not decode is refused as invalid.

When a document cannot be fetched for a reason that may pass (a network error, a timeout, a 5xx answer, a name that does not resolve) and no valid copy is held, the token, pushed authorization request, revocation and introspection endpoints answer a client authentication that fails on it with 503, no body and no `Retry-After`. [Draft section 6.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-03#section-6.1) allows a 503 in place of `invalid_client` for a transient failure at the token and pushed authorization request endpoints, and [RFC 7009, section 2.2.1](https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1) describes a 503 at revocation. Introspection also answers 503 for a token its records refuse while the token's client cannot be resolved. Telemetry names this answer `client_metadata_unavailable`, while the 429 of the rate limit stays `temporarily_unavailable`. A token that is not the caller's is answered as it would be without the outage: 200 at revocation, inactive at introspection, `invalid_grant` at the token endpoint. A copy already held is served past its lifetime during such a failure. A document that was fetched and refused stays `invalid_client`, and the authorization endpoint answers `invalid_client` without a redirect in both cases. `ClientTemporarilyUnavailableError` is new and experimental (`ABX9001`).

`SoftwareStatement.RequireSoftwareStatement` applies to registration requests only, so it does not refuse metadata documents: the metadata document settings decide which documents are accepted, and a `software_statement` inside a document is not read. `ClientInfo.ResolvedFromMetadataDocument` lets a host's `IRedirectUriTrustPolicy` tell a client from a metadata document from one somebody registered; the server sets it, and it is never written to or read from JSON.
