Skip to main content

IEntityStorage Interface

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.Storages

IEntityStorage Interface

Key/value storage abstraction over short-lived OIDC entities (authorization codes, PAR requests, CIBA/device authorization records, JWT statuses, rate-limit counters). Each entry has an expiration policy expressed via StorageOptions; implementations may be in-process or distributed.

public interface IEntityStorage

Derived
DistributedCacheStorage

Remarks

Implementations must support atomic get-and-remove semantics when removeOnRetrieval is true so that single-use credentials (authorization codes, PAR request URIs) cannot be replayed across concurrent token requests.

Methods

IEntityStorage.GetAsync<T>(string, bool, Nullable<CancellationToken>) Method

Retrieves the entity stored under key, optionally deleting it atomically as part of the same operation to enforce single-use semantics.

System.Threading.Tasks.Task<T?> GetAsync<T>(string key, bool removeOnRetrieval, System.Nullable<System.Threading.CancellationToken> token=null);

Type parameters

T

The type of the entity to retrieve.

Parameters

key System.String

The key associated with the entity.

removeOnRetrieval System.Boolean

When true, the entry must be removed atomically with the read so that a concurrent caller cannot observe the same value.

token System.Nullable<System.Threading.CancellationToken>

An optional cancellation token.

Returns

System.Threading.Tasks.Task<T>
The stored entity, or null when no entry is present or it has expired.

IEntityStorage.RemoveAsync(string, Nullable<CancellationToken>) Method

Removes the entity stored under key; succeeds silently when no entry is present.

System.Threading.Tasks.Task RemoveAsync(string key, System.Nullable<System.Threading.CancellationToken> token=null);

Parameters

key System.String

The key of the entity to remove.

token System.Nullable<System.Threading.CancellationToken>

An optional cancellation token.

Returns

System.Threading.Tasks.Task
A task that completes once the removal request has been processed.

IEntityStorage.SetAsync<T>(string, T, StorageOptions, Nullable<CancellationToken>) Method

Stores an entity under key, replacing any existing value, with the expiration behavior described by options.

System.Threading.Tasks.Task SetAsync<T>(string key, T value, Abblix.Oidc.Server.Features.Storages.StorageOptions options, System.Nullable<System.Threading.CancellationToken> token=null);

Type parameters

T

The type of the entity to store.

Parameters

key System.String

The unique key used to store and later retrieve the value.

value T

The entity to store.

options StorageOptions

Expiration policy for the stored entry.

token System.Nullable<System.Threading.CancellationToken>

An optional cancellation token.

Returns

System.Threading.Tasks.Task
A task that completes once the entity has been written.