Table of Contents

Class ValidatingClientStore<T>

Namespace
Fdyay.IdentityServer.Stores
Assembly
Fdyay.IdentityServer.Core.dll

Answers a client registration its validator refuses as no client at all.

public sealed class ValidatingClientStore<T> : IClientStore where T : IClientStore

Type Parameters

T
Inheritance
ValidatingClientStore<T>
Implements
Inherited Members

Remarks

Duende 8.0.1's ValidatingClientStore<T>, measured. Put in front of a host's store by AddClientStore<T> and AddInMemoryClients, as Duende puts it there, and in front of the Dapper client store; a store registered as IClientStore by hand is not validated, as it is not there.

An invalid registration reads as no registration, the answer every caller already handles — the token endpoint answers invalid_client, the authorize endpoint shows its error page — rather than a client served until the misconfiguration surfaces as a 500 or, worse, as a client that works in a way it was not meant to. The reason goes to the log and to InvalidClientConfigurationEvent, on every read.

Constructors

ValidatingClientStore(T, IClientConfigurationValidator, IEventService, ILogger<ValidatingClientStore<T>>)

Validation in front of inner.

public ValidatingClientStore(T inner, IClientConfigurationValidator validator, IEventService events, ILogger<ValidatingClientStore<T>> logger)

Parameters

inner T

The store the client registrations are read from.

validator IClientConfigurationValidator

What decides whether a registration can be served.

events IEventService

Where InvalidClientConfigurationEvent is raised for a refused registration.

logger ILogger<ValidatingClientStore<T>>

Where a refused registration is logged.

Methods

FindClientByIdAsync(string, CancellationToken)

Finds a client by id, or returns null if not found.

public Task<Client?> FindClientByIdAsync(string clientId, CancellationToken cancellationToken = default)

Parameters

clientId string
cancellationToken CancellationToken

Returns

Task<Client>

Remarks

Null when the inner store has no such client, and when it has one the validator refuses.

GetAllClientsAsync(CancellationToken)

The inner store's clients, each validated as it is reached; a refused one is skipped. Duende's.

public IAsyncEnumerable<Client> GetAllClientsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

IAsyncEnumerable<Client>

Remarks

A refused client is logged and raises its event here as it does for a lookup.