ReplayCacheServiceCollectionExtensions Class
Wires the replay cache that remembers the identifiers of single-use tokens already accepted.
public static class ReplayCacheServiceCollectionExtensionsInheritance System.Object → ReplayCacheServiceCollectionExtensions
Methods
ReplayCacheServiceCollectionExtensions.AddDistributedReplayCache(this IServiceCollection) Method
Registers the replay cache over the host's IDistributedCache, or over an in-process one when the host
registers none, as the IReplayCache.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDistributedReplayCache(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);Parameters
services Microsoft.Extensions.DependencyInjection.IServiceCollection
The service collection.
Returns
Microsoft.Extensions.DependencyInjection.IServiceCollection
Remarks
The registration of the store made by every receiver of Security Event Tokens or logout tokens, so a host running several of them shares one store under one prefix. The OpenID Connect server in the same host puts its store over the host's entity storage in place of this one, whichever of them registers first, and the receivers reserve there. TryAdd, so a store the host registered before wins.
A package with a policy of its own decorates the registered store rather than registering another, so every package in the host keeps reserving in one store. Beside the OpenID Connect server, a decoration made before the server registers is kept as the host's own store, and the server reserves in it too.
The cache itself is the host's choice. Without one the reservations are kept in this process, which is enough for a single instance; several instances need a shared cache, Redis or another backend, or a token refused by one is accepted by the next.