AuthorizationRequestStorage Class
Abblix.Oidc.Server
Abblix.Oidc.Server.Features.Storages
AuthorizationRequestStorage Class
Provides storage and retrieval services for OAuth 2.0 authorization requests using a distributed cache. This class is designed to handle the storage of AuthorizationRequest objects and facilitate their retrieval using unique request URIs, supporting scenarios such as the OAuth 2.0 Pushed Authorization Requests (PAR).
public class AuthorizationRequestStorage : Abblix.Oidc.Server.Features.Storages.IAuthorizationRequestStorage
Inheritance System.Object → AuthorizationRequestStorage
Implements IAuthorizationRequestStorage
Constructors
AuthorizationRequestStorage(IAuthorizationRequestUriGenerator, IEntityStorage, IEntityStorageKeyFactory) Constructor
Provides storage and retrieval services for OAuth 2.0 authorization requests using a distributed cache. This class is designed to handle the storage of AuthorizationRequest objects and facilitate their retrieval using unique request URIs, supporting scenarios such as the OAuth 2.0 Pushed Authorization Requests (PAR).
public AuthorizationRequestStorage(Abblix.Oidc.Server.Features.RandomGenerators.IAuthorizationRequestUriGenerator authorizationRequestUriGenerator, Abblix.Oidc.Server.Features.Storages.IEntityStorage storage, Abblix.Oidc.Server.Features.Storages.IEntityStorageKeyFactory keyFactory);
Parameters
authorizationRequestUriGenerator IAuthorizationRequestUriGenerator
The generator used to create unique URIs for each authorization request.
storage IEntityStorage
The persistent storage mechanism where authorization requests are stored.
keyFactory IEntityStorageKeyFactory
The factory for generating standardized storage keys.
Methods
AuthorizationRequestStorage.StoreAsync(AuthorizationRequest, TimeSpan) Method
Stores an authorization request in the distributed cache with a generated URI and a specified expiration time.
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Endpoints.PushedAuthorization.Interfaces.PushedAuthorizationResponse> StoreAsync(Abblix.Oidc.Server.Model.AuthorizationRequest request, System.TimeSpan expiresIn);
Parameters
request AuthorizationRequest
The authorization request to store.
expiresIn System.TimeSpan
The duration after which the stored request will expire and no longer be valid. This duration is typically dictated by the OAuth 2.0 server's configuration and the nature of the client's request.
Implements StoreAsync(AuthorizationRequest, TimeSpan)
Returns
System.Threading.Tasks.Task<PushedAuthorizationResponse>
A task that resolves to a PushedAuthorizationResponse, which includes the stored request
and its unique URI. This response is used to facilitate subsequent authorization processes that may require
accessing the request via its URI.
AuthorizationRequestStorage.TryGetAsync(Uri, bool) Method
Attempts to retrieve an authorization request from the distributed cache using its unique URI. Optionally removes the request from the cache depending on the shouldRemove parameter.
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Model.AuthorizationRequest?> TryGetAsync(System.Uri requestUri, bool shouldRemove=false);
Parameters
requestUri System.Uri
The URI associated with the authorization request.
shouldRemove System.Boolean
Whether to remove the request from the cache after retrieving it. This is typically true for operations where the request is intended for single retrieval, such as after redirecting a client to an authorization endpoint.
Implements TryGetAsync(Uri, bool)
Returns
System.Threading.Tasks.Task<AuthorizationRequest>
A task that resolves to the retrieved AuthorizationRequest if found; otherwise, null.
If the request is not found, it may have expired or been removed from the cache previously.