Skip to main content

BackChannelRequestStorage Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.BackChannelAuthentication

BackChannelRequestStorage Class

Implements the storage of backchannel authentication requests, allowing for persistence and retrieval of authentication request data in the context of Client-Initiated Backchannel Authentication (CIBA).

public class BackChannelRequestStorage : Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IBackChannelRequestStorage

Inheritance System.Object → BackChannelRequestStorage

Implements IBackChannelRequestStorage

Constructors

BackChannelRequestStorage(IEntityStorage, IAuthenticationRequestIdGenerator, IEntityStorageKeyFactory) Constructor

Implements the storage of backchannel authentication requests, allowing for persistence and retrieval of authentication request data in the context of Client-Initiated Backchannel Authentication (CIBA).

public BackChannelRequestStorage(Abblix.Oidc.Server.Features.Storages.IEntityStorage storage, Abblix.Oidc.Server.Features.BackChannelAuthentication.Interfaces.IAuthenticationRequestIdGenerator authenticationRequestIdGenerator, Abblix.Oidc.Server.Features.Storages.IEntityStorageKeyFactory keyFactory);

Parameters

storage IEntityStorage

The storage system used for persisting authentication requests.

authenticationRequestIdGenerator IAuthenticationRequestIdGenerator

Generator for creating unique authentication request IDs.

keyFactory IEntityStorageKeyFactory

The factory for generating standardized storage keys.

Methods

BackChannelRequestStorage.StoreAsync(BackChannelAuthenticationRequest, TimeSpan) Method

Asynchronously stores a backchannel authentication request and generates a unique identifier for it. This method also sets an expiration duration for the stored request.

public System.Threading.Tasks.Task<string> StoreAsync(Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationRequest authenticationRequest, System.TimeSpan expiresIn);

Parameters

authenticationRequest BackChannelAuthenticationRequest

The backchannel authentication request to store.

expiresIn System.TimeSpan

The duration after which the stored request will expire.

Implements StoreAsync(BackChannelAuthenticationRequest, TimeSpan)

Returns

System.Threading.Tasks.Task<System.String>
A task that returns the unique ID of the stored authentication request.

BackChannelRequestStorage.TryGetAsync(string) Method

Tries to retrieve a backchannel authentication request by its unique identifier.

public System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationRequest?> TryGetAsync(string authenticationRequestId);

Parameters

authenticationRequestId System.String

The unique identifier of the authentication request to retrieve.

Implements TryGetAsync(string)

Returns

System.Threading.Tasks.Task<BackChannelAuthenticationRequest>
A task that returns the authentication request if found; otherwise, null.

BackChannelRequestStorage.TryRemoveAsync(string) Method

Atomically retrieves and removes a backchannel authentication request from storage. This prevents race conditions in poll mode where concurrent requests could both retrieve the same authentication request before removal, leading to duplicate token issuance.

public System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationRequest?> TryRemoveAsync(string authenticationRequestId);

Parameters

authenticationRequestId System.String

The unique identifier of the authentication request to remove.

Implements TryRemoveAsync(string)

Returns

System.Threading.Tasks.Task<BackChannelAuthenticationRequest>
A task that returns the authentication request if it existed and was successfully removed; otherwise, null if the request was not found or already removed by another concurrent request.

BackChannelRequestStorage.UpdateAsync(string, BackChannelAuthenticationRequest, TimeSpan) Method

Updates an existing backchannel authentication request in storage. Used in ping mode to update request status when user completes authentication.

public System.Threading.Tasks.Task UpdateAsync(string requestId, Abblix.Oidc.Server.Features.BackChannelAuthentication.BackChannelAuthenticationRequest request, System.TimeSpan expiresIn);

Parameters

requestId System.String

The unique identifier of the authentication request to update.

request BackChannelAuthenticationRequest

The updated authentication request data.

expiresIn System.TimeSpan

The duration after which the request expires.

Implements UpdateAsync(string, BackChannelAuthenticationRequest, TimeSpan)

Returns

System.Threading.Tasks.Task
A task that completes when the request is updated in storage.