Table of Contents

Class CachingIdentityProviderStore<T>

Namespace
Fdyay.IdentityServer.Hosting
Assembly
Fdyay.IdentityServer.AspNetCore.dll

Holds what a store says about identity providers, for a duration, in a HybridCache.

public sealed class CachingIdentityProviderStore<T> : IIdentityProviderStore where T : IIdentityProviderStore

Type Parameters

T
Inheritance
CachingIdentityProviderStore<T>
Implements
Inherited Members

Remarks

Duende 8.0.1's CachingIdentityProviderStore<T>, measured: a provider and the list of names, each held for the duration with an absolute expiration, in the HybridCache keyed ConfigurationStoreCacheKey — the host's, when it registers one, and otherwise an in-memory one private to the process. AddIdentityProviderStoreCache<T> puts it in front of the validating decorator, so what is held has been validated — a refused row is held as no row, and is refused again only when it expires.

An edit to a row reaches this server within the duration, not at once. When it does, the handler options built from the old row are dropped by DynamicAuthenticationSchemeProvider, as they are for an uncached store; Duende does that inside this decorator, and here it is done where every store registration reaches it.

Takes its duration as an argument, from AddIdentityProviderStoreCache<T>(duration), where Duende reads CachingOptions.IdentityProviderCacheDuration: this server has no Caching group, and puts a cache's duration where the cache is switched on, as AddCorsPolicyCache(duration) does.

Constructors

CachingIdentityProviderStore(T, HybridCache, TimeSpan)

Puts the cache in front of inner.

public CachingIdentityProviderStore(T inner, HybridCache cache, TimeSpan duration)

Parameters

inner T

The store whose answers are held.

cache HybridCache

The HybridCache the answers are held in.

duration TimeSpan

How long each answer is held before the store is asked again, as an absolute expiration.

Exceptions

ArgumentOutOfRangeException

duration is zero or negative.

Methods

GetAllSchemeNamesAsync(CancellationToken)

Every provider, in the shape the sign-in page needs to list them.

public Task<IEnumerable<IdentityProviderName>> GetAllSchemeNamesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IEnumerable<IdentityProviderName>>

GetBySchemeAsync(string, CancellationToken)

One provider in full, or null when this server has never heard of the scheme.

public Task<IdentityProvider?> GetBySchemeAsync(string scheme, CancellationToken cancellationToken = default)

Parameters

scheme string
cancellationToken CancellationToken

Returns

Task<IdentityProvider>