Skip to content

ServiceCollectionExtensions Class

Wires replay protection, which several unrelated features need and none of them owns: JWT-bearer assertions (RFC 7523 Section 3), client assertions, and DPoP proofs (RFC 9449 Section 11.1) all reserve identifiers in the same place.

C#
public static class ServiceCollectionExtensions

Inheritance System.Object → ServiceCollectionExtensions

Methods

ServiceCollectionExtensions.AddReplayPrevention(this IServiceCollection) Method

Registers the replay cache and the deprecated contract that still resolves to it.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddReplayPrevention(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);

Parameters

services Microsoft.Extensions.DependencyInjection.IServiceCollection

The service collection.

Returns

Microsoft.Extensions.DependencyInjection.IServiceCollection

Remarks

Idempotent and TryAdd throughout, because three unrelated feature registrations call it and a host may have decided any part of it beforehand.