Skip to content

ClientIdMetadataDocumentOptions Class

How the server treats a client that identifies itself by the URL of its own metadata document instead of a registration (draft-ietf-oauth-client-id-metadata-document): which such URLs it accepts, how much of a document it reads and how long it holds one.

C#
public record ClientIdMetadataDocumentOptions : System.IEquatable<Abblix.Oidc.Server.Common.Configuration.ClientIdMetadataDocumentOptions>

Inheritance System.Object → ClientIdMetadataDocumentOptions

Implements System.IEquatable<ClientIdMetadataDocumentOptions>

Remarks

None of this applies until the host calls AddClientIdMetadataDocuments(). A client resolved from its document is held to NewClientOptions as a dynamically registered one is, its default scope, the resources and token exchange audiences it may name and the audiences of its assertions among them, because its metadata is as much the client's own word as a registration request is.

Properties

ClientIdMetadataDocumentOptions.AllowedClientIdPrefixes Property

The prefixes a client identifier URL must start with to be fetched, or null (the default) to fetch any URL the draft's rules allow.

C#
public string[]? AllowedClientIdPrefixes { get; init; }

Property Value

System.String[]

Remarks

Section 10.8 of the draft lets an authorization server "maintain allowlists of trusted domain patterns". Each entry is an absolute https URL whose path ends with a slash, such as https://apps.example.com/ or https://example.com/clients/, and a client identifier is compared with it character for character: section 3 has the server compare these URLs "using simple string comparison" and never normalize them, so https://example.com:443/ and https://Example.com/ admit nothing that https://example.com/ would. The closing slash is what keeps https://example.com/ from admitting https://example.com.attacker.test/; an entry without one, an empty list, an entry with a query, a fragment or user information, and one of any other scheme are refused at startup.

ClientIdMetadataDocumentOptions.AllowedGrantTypes Property

The grant types a client resolved from its document may use. Unset, those an end user takes part in, Abblix.Oidc.Server.Common.Configuration.NewClientOptions.SignInGrantTypes.

C#
public string[]? AllowedGrantTypes { get; init; }

Property Value

System.String[]

Remarks

A document is anybody's, so a grant no end user approves, such as client credentials, would give whoever wrote it tokens of its own. A document's grant types are narrowed to these, to those the server supports and to AllowedGrantTypes. Whatever this allows, a client authenticating with none is never given the client credentials, password or JWT bearer grant: RFC 6749 section 4.4 says "The client credentials grant type MUST only be used by confidential clients". A document's client given that grant gets tokens whose idp is client_credentials, which marks them as the client's own (RFC 9700 section 4.15.1). An empty list and a blank entry are refused at startup. Unset rather than holding the default, so a list bound from configuration is taken as written: the configuration binder adds to a list already there.

ClientIdMetadataDocumentOptions.DocumentAddresses Property

Which addresses a document may be fetched from. Default: PublicOnly.

C#
public Abblix.Oidc.Server.Common.Configuration.ClientIdMetadataDocumentAddresses DocumentAddresses { get; init; }

Property Value

ClientIdMetadataDocumentAddresses

Remarks

AllowLoopback lets a provider and a client running on one development machine try the feature, by the exception section 10.7 of the draft makes. A value naming no member is refused at startup.

ClientIdMetadataDocumentOptions.Enabled Property

Whether the server resolves clients from their metadata documents and advertises client_id_metadata_document_supported in its discovery document.

C#
public bool Enabled { get; }

Property Value

System.Boolean

Remarks

Set by AddClientIdMetadataDocuments() alone, never from configuration: the setter is not public, so a configuration file cannot advertise the feature in discovery while nothing resolves such a client.

ClientIdMetadataDocumentOptions.FetchTimeout Property

The longest a fetch of a document may take, its body included. Default: 5 seconds.

C#
public System.TimeSpan FetchTimeout { get; init; }

Property Value

System.TimeSpan

Remarks

The fetch runs while the authorization or token request naming the client waits, and anybody can name a URL whose server answers slowly, so this is shorter than the server's other outbound fetches take.

ClientIdMetadataDocumentOptions.MaxDocumentSize Property

The most of a metadata document the server reads, in bytes; a longer one is refused. Default: 5 KB.

C#
public int MaxDocumentSize { get; init; }

Property Value

System.Int32

Remarks

Section 10.11 of the draft: authorization servers "SHOULD limit the amount of data they read and process when fetching a Client ID Metadata Document", and "the recommended maximum size to read is 5 kilobytes".

ClientIdMetadataDocumentOptions.MaxHeldDocuments Property

The most documents held at once. Default: 10000. Read once, when the server starts.

C#
public int MaxHeldDocuments { get; init; }

Property Value

System.Int32

Remarks

Whoever sends an authorization request names the URL, so without a bound a host answering every path with a document naming that path would fill the server's memory for MaximumCacheDuration. A document arriving while the server holds this many is served to the request that fetched it and not held, so it is fetched again on its next use, which section 6.2 of the draft allows a server doing "to avoid repeatedly fetching" no less than it allows holding.

ClientIdMetadataDocumentOptions.MaximumCacheDuration Property

The longest a document is held, whatever its response asks for. Default: 1 hour.

C#
public System.TimeSpan MaximumCacheDuration { get; init; }

Property Value

System.TimeSpan

Remarks

Section 6.2 of the draft: the server "SHOULD enforce a maximum effective cache duration regardless of the cache directives in the response". This bounds how long a redirect URI or a key a client has removed from its document is still honored here. A document whose lifetime has passed is fetched again on the next request, and when that fetch fails for a reason that may pass, a network error, a timeout or a 5xx answer, the copy held is served until this much time has passed since it was fetched: section 6.1 has the server not "discard previously cached valid client metadata on transient failures".

ClientIdMetadataDocumentOptions.MinimumCacheDuration Property

How long a document is held when its response states no lifetime of its own. Default: 5 minutes.

C#
public System.TimeSpan MinimumCacheDuration { get; init; }

Property Value

System.TimeSpan

Remarks

Section 6.2 of the draft: the server "SHOULD respect HTTP cache headers [RFC9111]" and "SHOULD also enforce a minimum effective cache duration when none is otherwise indicated". So a response carrying max-age is held for that long, one carrying no-store or no-cache is not held at all, and this applies only to a response saying nothing about it.