Table of Contents

Class DapperPushedAuthorizationRequestStore

Namespace
Fdyay.IdentityServer.Dapper.Stores
Assembly
Fdyay.IdentityServer.Dapper.dll

Dapper-backed pushed authorization request store.

public sealed class DapperPushedAuthorizationRequestStore : IPushedAuthorizationRequestStore
Inheritance
DapperPushedAuthorizationRequestStore
Implements
Inherited Members

Remarks

A pushed request is written by whichever instance the client posted to and read by whichever instance the browser lands on, so this is the store a multi-instance deployment needs: the in-memory default would send the user to an instance that has never heard of the reference value.

The parameters data-protected since 0.177.0, as Duende's PushedAuthorizationSerializer protects them (measured: always, under the purpose PAR); here under PersistentGrants.DataProtectData, as every other operational row. A pushed request carries its login_hint, its request object and whatever a client pushed with it. A row written before is still read, through the protector's plaintext fallback.

Constructors

DapperPushedAuthorizationRequestStore(IDbConnectionFactory)

Creates a pushed request store over the PushedAuthorizationRequests table.

public DapperPushedAuthorizationRequestStore(IDbConnectionFactory connectionFactory)

Parameters

connectionFactory IDbConnectionFactory

Opens a connection for each operation and supplies the dialect's upsert.

Remarks

Writes the parameters unprotected, as before 0.177.0; the container builds the overload taking a protector.

DapperPushedAuthorizationRequestStore(IDbConnectionFactory, IGrantDataProtector)

Creates the store, protecting each request's parameters with protector.

public DapperPushedAuthorizationRequestStore(IDbConnectionFactory connectionFactory, IGrantDataProtector protector)

Parameters

connectionFactory IDbConnectionFactory

Opens a connection for each operation and supplies the dialect's upsert.

protector IGrantDataProtector

Protects the Parameters column as it does a persisted grant's Data, under PersistentGrants.DataProtectData, and reads a row written unprotected as it was written.

Methods

GetAsync(string, CancellationToken)

Reads a pushed request by the hash of its reference value.

public Task<PushedAuthorizationRequest?> GetAsync(string referenceValueHash, CancellationToken cancellationToken = default)

Parameters

referenceValueHash string
cancellationToken CancellationToken

Returns

Task<PushedAuthorizationRequest>

Null when the hash is unknown. Expiry is the caller's to enforce.

Remarks

Reads the PushedAuthorizationRequests row whose ReferenceValueHash matches. A miss returns null; an expired row is returned as stored, for the caller to refuse.

Exceptions

ArgumentException

referenceValueHash is null or empty.

RemoveAsync(string, CancellationToken)

Removes a pushed request, so a reference value cannot be redeemed twice.

public Task RemoveAsync(string referenceValueHash, CancellationToken cancellationToken = default)

Parameters

referenceValueHash string
cancellationToken CancellationToken

Returns

Task

Remarks

Deletes the PushedAuthorizationRequests row whose ReferenceValueHash matches. A miss deletes nothing and is not an error.

Exceptions

ArgumentException

referenceValueHash is null or empty.

StoreAsync(PushedAuthorizationRequest, CancellationToken)

Stores a pushed request, replacing any entry with the same hash.

public Task StoreAsync(PushedAuthorizationRequest request, CancellationToken cancellationToken = default)

Parameters

request PushedAuthorizationRequest
cancellationToken CancellationToken

Returns

Task

Remarks

Upserts the PushedAuthorizationRequests row keyed by ReferenceValueHash.

Exceptions

ArgumentNullException

request is null.