IDeviceAuthorizationStorage Interface
Abblix.Oidc.Server
Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces
IDeviceAuthorizationStorage Interface
Defines the contract for a storage system responsible for persisting and retrieving device authorization requests as defined in RFC 8628.
public interface IDeviceAuthorizationStorage
Derived
↳ DeviceAuthorizationStorage
Methods
IDeviceAuthorizationStorage.RemoveAsync(string) Method
Removes a device authorization request from storage using its device code.
System.Threading.Tasks.Task RemoveAsync(string deviceCode);
Parameters
deviceCode System.String
The device code identifier.
Returns
System.Threading.Tasks.Task
A task that completes when the request is removed from storage.
IDeviceAuthorizationStorage.StoreAsync(string, DeviceAuthorizationRequest, TimeSpan) Method
Stores a device authorization request with the specified device code.
System.Threading.Tasks.Task StoreAsync(string deviceCode, Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest request, System.TimeSpan expiresIn);
Parameters
deviceCode System.String
The unique device code identifier.
request DeviceAuthorizationRequest
The device authorization request to store.
expiresIn System.TimeSpan
The duration after which the stored request will expire.
Returns
System.Threading.Tasks.Task
A task that completes when the request is stored.
IDeviceAuthorizationStorage.TryGetByDeviceCodeAsync(string) Method
Tries to retrieve a device authorization request by its device code. This is used by the client when polling the token endpoint.
System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest?> TryGetByDeviceCodeAsync(string deviceCode);
Parameters
deviceCode System.String
The device code identifier.
Returns
System.Threading.Tasks.Task<DeviceAuthorizationRequest>
A task that returns the device authorization request if found; otherwise, null.
IDeviceAuthorizationStorage.TryGetByUserCodeAsync(string) Method
Tries to retrieve a device authorization request by its user code. This is used during user verification to look up the pending request.
System.Threading.Tasks.Task<System.Nullable<(string DeviceCode,Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest Request)>> TryGetByUserCodeAsync(string userCode);
Parameters
userCode System.String
The user-friendly verification code.
Returns
System.Threading.Tasks.Task<System.Nullable<<System.String,DeviceAuthorizationRequest>>>
A task that returns the device code and request if found; otherwise, null.
IDeviceAuthorizationStorage.TryRemoveAsync(string, string) Method
Atomically attempts to remove a device authorization request by its device code. This operation is thread-safe and returns whether the removal was successful.
System.Threading.Tasks.Task<bool> TryRemoveAsync(string deviceCode, string userCode);
Parameters
deviceCode System.String
The device code identifier.
userCode System.String
The user code for cleaning up the secondary index mapping.
Returns
System.Threading.Tasks.Task<System.Boolean>
A task that returns true if the request was found and removed; false otherwise.
IDeviceAuthorizationStorage.UpdateAsync(string, DeviceAuthorizationRequest, TimeSpan) Method
Updates an existing device authorization request in storage, refreshing its cache entry with the caller-supplied remaining lifetime.
System.Threading.Tasks.Task UpdateAsync(string deviceCode, Abblix.Oidc.Server.Features.DeviceAuthorization.DeviceAuthorizationRequest request, System.TimeSpan expiresIn);
Parameters
deviceCode System.String
The device code identifier.
request DeviceAuthorizationRequest
The updated device authorization request.
expiresIn System.TimeSpan
The remaining lifetime to apply as the cache TTL. The caller derives it from the request's fixed expiry (RFC 8628 §3.2) so that repeated polling cannot extend the code.
Returns
System.Threading.Tasks.Task
A task that completes when the request is updated.