Skip to main content

IJwtReplayCache Interface

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.JwtBearer

IJwtReplayCache Interface

Legacy two-step replay-cache contract: a separate IsReplayedAsync(string) read followed by a MarkAsUsedAsync(string, Nullable<DateTimeOffset>) write. The shape leaks a read-then-write race window to concurrent presenters of the same jti.

public interface IJwtReplayCache

Derived
DistributedJwtReplayCache

Remarks

Replaced by TryAddAsync(string, Nullable<DateTimeOffset>), whose single-call shape lets atomic-capable backends close the race natively. This interface remains as a backward-compat alias so host code that DI-resolves the legacy type still receives a working instance during the transition window.

Methods

IJwtReplayCache.IsReplayedAsync(string) Method

Checks if a JWT with the specified JTI has already been used.

System.Threading.Tasks.Task<bool> IsReplayedAsync(string jti);

Parameters

jti System.String

The JWT ID (jti claim) to check.

Returns

System.Threading.Tasks.Task<System.Boolean>
A task that completes with true if the JWT has already been used (replay detected); false if this is the first time the JWT is being presented.

IJwtReplayCache.MarkAsUsedAsync(string, Nullable<DateTimeOffset>) Method

Marks a JWT as used by storing its JTI in the cache until the specified expiration time.

System.Threading.Tasks.Task MarkAsUsedAsync(string jti, System.Nullable<System.DateTimeOffset> expiresAt);

Parameters

jti System.String

The JWT ID (jti claim) to mark as used.

expiresAt System.Nullable<System.DateTimeOffset>

The time at which the JWT expires. The JTI will be stored until this time plus a small buffer. If null, a default expiration will be used.

Returns

System.Threading.Tasks.Task
A task that completes when the JTI has been stored.