Class DefaultReplayCache
- Namespace
- Fdyay.IdentityServer.Services
- Assembly
- Fdyay.IdentityServer.Core.dll
The replay cache, kept in IDistributedCache so every instance sees what any has seen. Duende's.
public sealed class DefaultReplayCache : IReplayCache
- Inheritance
-
DefaultReplayCache
- Implements
- Inherited Members
Remarks
Duende 8.0.1's DefaultReplayCache, measured: an empty entry under a prefixed key, gone at the expiry given. The
default from 0.131.0, in place of InMemoryReplayCache, which kept each instance's to itself — a DPoP proof
or a client assertion replayed to a second instance was new there. With the distributed memory cache the server
registers, it is still one process's memory; a host running several registers a real IDistributedCache
(Redis, SQL Server) and every instance shares it, with no other change.
The key keeps a separator between purpose and handle, where Duende's runs them together, so a purpose that ends where another begins cannot meet it. An expiry already past is not stored: there is nothing left to refuse, and a distributed cache refuses an absolute expiry in the past.
Constructors
DefaultReplayCache(IDistributedCache, TimeProvider)
A replay cache in cache.
public DefaultReplayCache(IDistributedCache cache, TimeProvider time)
Parameters
cacheIDistributedCacheThe distributed cache the entries are kept in.
timeTimeProviderThe clock an entry's remaining lifetime is measured by.
Methods
AddAsync(string, string, DateTimeOffset, CancellationToken)
Records handle as used, until expiration.
public Task AddAsync(string purpose, string handle, DateTimeOffset expiration, CancellationToken cancellationToken = default)
Parameters
purposestringhandlestringexpirationDateTimeOffsetcancellationTokenCancellationToken
Returns
Remarks
An expiration already past stores nothing.
ExistsAsync(string, string, CancellationToken)
Whether handle has been recorded and has not yet expired.
public Task<bool> ExistsAsync(string purpose, string handle, CancellationToken cancellationToken = default)
Parameters
purposestringhandlestringcancellationTokenCancellationToken