Skip to main content

JsonWebKeyExtensions Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Common

JsonWebKeyExtensions Class

Provides extensions for asynchronous operations on a sequence of JsonWebKey objects.

public static class JsonWebKeyExtensions

Inheritance System.Object → JsonWebKeyExtensions

Methods

JsonWebKeyExtensions.FirstByAlgorithmAsync(this IAsyncEnumerable<JsonWebKey>, string) Method

Asynchronously retrieves the first JsonWebKey with the specified algorithm from the sequence. Prioritizes keys with exact algorithm match, then falls back to algorithm-agnostic keys (Algorithm == null) per RFC 7517, which allows keys without 'alg' parameter to be used with any compatible algorithm.

public static System.Threading.Tasks.Task<Abblix.Jwt.JsonWebKey?> FirstByAlgorithmAsync(this System.Collections.Generic.IAsyncEnumerable<Abblix.Jwt.JsonWebKey> credentials, string? algorithm);

Parameters

credentials System.Collections.Generic.IAsyncEnumerable<JsonWebKey>

The asynchronous sequence of JsonWebKey objects.

algorithm System.String

The algorithm to match. Returns null if None is provided.

Returns

System.Threading.Tasks.Task<JsonWebKey>
The first JsonWebKey with the specified algorithm or null if not found.