Перейти к содержимому
Abblix
Эта страница ещё не переведена.

ClientJwksConfigurationExtensions Class

Configuration-time extensions that populate Jwks from raw configuration sections by binding into JsonWebKeySetSettings (a flat DTO that Microsoft.Extensions.Configuration can handle natively) and mapping to the polymorphic JsonWebKey hierarchy.

C#
public static class ClientJwksConfigurationExtensions

Inheritance System.Object → ClientJwksConfigurationExtensions

Remarks

The same primitive is exposed at two layers so the host can apply the fix as close to the source binding as practical:

  • settings.Clients.WithJwksFromConfiguration(section) — eager, runs right after configuration.Get<Settings>(), so every later consumer of settings.Clients sees populated Jwks.
  • options.AddClientJwksFromConfiguration(section) — convenience inside the AddOidcServices options lambda, equivalent to mutating options.Clients through WithJwksFromConfiguration.

Methods

ClientJwksConfigurationExtensions.AddClientJwksFromConfiguration(this OidcOptions, IConfigurationSection) Method

Convenience wrapper for use inside the AddOidcServices options lambda: equivalent to options.Clients = options.Clients.WithJwksFromConfiguration(section).

C#
public static void AddClientJwksFromConfiguration(this Abblix.Oidc.Server.Common.Configuration.OidcOptions options, Microsoft.Extensions.Configuration.IConfigurationSection clientsSection);

Parameters

options OidcOptions
clientsSection Microsoft.Extensions.Configuration.IConfigurationSection

ClientJwksConfigurationExtensions.WithJwksFromConfiguration<T>(this IEnumerable<T>, IConfigurationSection) Method

Returns the same client collection with Jwks populated for each entry whose configuration counterpart includes an inline Jwks sub-section. Mutates in place when the input is already a T array; otherwise materialises a fresh array.

C#
public static T[] WithJwksFromConfiguration<T>(this System.Collections.Generic.IEnumerable<T> clients, Microsoft.Extensions.Configuration.IConfigurationSection clientsSection)
    where T : Abblix.Oidc.Server.Features.ClientInformation.ClientInfo;

Type parameters

T

A concrete client type — either ClientInfo directly or a host-supplied derived type (e.g. carrying app-specific metadata). The return type preserves T so the host can assign the result back to its own strongly-typed Clients array without casting.

Parameters

clients System.Collections.Generic.IEnumerable<T>

The clients whose Jwks should be populated.

clientsSection Microsoft.Extensions.Configuration.IConfigurationSection

The configuration section that holds the Clients tree — typically configuration.GetSection("Clients").

Returns

T[]
The same clients (as an array) with any newly populated Jwks.

Exceptions

System.InvalidOperationException
A Jwks sub-section contains a key with a missing or unsupported kty discriminator.

System.FormatException
A byte-array member of a JWK is not valid base64url.

Remarks

Per-client self-correcting: an entry whose Jwks is already non-null (because the host populated it programmatically or a future TFM's binder gained native polymorphic support) is skipped.

Configuration entries without a matching ClientId in clients are silently skipped, so the same appsettings.json can declare clients that only some deployments load.