Path: redb-identity/src/redb.Identity.Core/Services/IClientKeyResolver.cs
Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity
Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Core/Services/IClientKeyResolver.cs
----
using Microsoft.IdentityModel.Tokens;
using redb.Core.Models.Entities;
using redb.Identity.Core.Models;
namespace redb.Identity.Core.Services;
///
/// Resolves the public signing keys of a client application — the keys used to verify
/// something the client signed (a JAR request object per RFC 9101, a private_key_jwt
/// client assertion per RFC 7523).
///
/// Two sources, in this order:
///
/// - inline — the JWKS pasted into the client record;
/// - — an absolute HTTPS URL fetched and cached.
///
/// They are mutually exclusive by the admin UI's contract (see ),
/// but if both are present the inline set wins: it is operator-controlled and needs no network call.
///
///
/// Asymmetric only. HMAC (HS*) cannot be supported:
/// stores a BCrypt hash, and verifying an HMAC signature needs the original secret, which is
/// unrecoverable by design. FAPI 2.0 forbids HS* for request objects anyway and mandates
/// PS256/ES256, so this is a correctness boundary rather than a gap.
///
///
public interface IClientKeyResolver
{
///
/// Returns the client's public signing keys, or an empty collection when the client has
/// published none (no inline JWKS and no reachable jwks_uri).
///
/// The client application record.
///
/// When , bypasses the cached copy of a jwks_uri document and
/// re-fetches it. Used for a single retry after a kid miss, so that a client rotating
/// its keys does not break sign-in until the cache expires. Never set it on the first attempt —
/// an unauthenticated caller must not be able to trigger outbound fetches at will.
///
/// Keys suitable for signature verification; never .
ValueTask> GetSigningKeysAsync(
RedbObject application,
bool forceRefresh = false,
CancellationToken cancellationToken = default);
///
/// The same keys as , as the key set itself (inline, or the cached
/// jwks_uri document), or when the client has none. Used where a
/// is the expected shape, such as the application store for client assertions.
///
ValueTask GetJsonWebKeySetAsync(
RedbObject application,
bool forceRefresh = false,
CancellationToken cancellationToken = default);
}