Table of Contents

Interface IAuthorizationCodeStore

Namespace
Fdyay.IdentityServer.Services
Assembly
Fdyay.IdentityServer.Core.dll

Stores and retrieves authorization codes.

public interface IAuthorizationCodeStore

Methods

GetAuthorizationCodeAsync(string, CancellationToken)

The authorization code a handle names, or null.

Task<AuthorizationCode?> GetAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)

Parameters

code string

The handle the client presented.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<AuthorizationCode>

The code, or null when none is stored under the handle or it has expired.

RemoveAuthorizationCodeAsync(string, CancellationToken)

Removes the authorization code a handle names, so it cannot be redeemed again.

Task RemoveAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)

Parameters

code string

The handle the client presented.

cancellationToken CancellationToken

Cancels the removal.

Returns

Task

StoreAuthorizationCodeAsync(AuthorizationCode, CancellationToken)

Stores an authorization code and returns the handle the client is given for it.

Task<string> StoreAuthorizationCodeAsync(AuthorizationCode code, CancellationToken cancellationToken = default)

Parameters

code AuthorizationCode

The code's contents.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<string>

The handle — the code value the authorize response carries.

TryRemoveAuthorizationCodeAsync(string, CancellationToken)

Removes the authorization code a handle names, saying whether this call is the one that removed it.

Task<bool> TryRemoveAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)

Parameters

code string

The handle the client presented.

cancellationToken CancellationToken

Cancels the removal.

Returns

Task<bool>

True when the code was there and this call removed it; false when it was already gone.

Remarks

What the token endpoint redeems a code by, so of two requests presenting one code at the same moment only one is answered with tokens (RFC 6749 §4.1.2: a code is used once). Ours (security), 0.176.0; Duende reads the code and then removes it. The default store takes it in one step through TryRemoveAsync(string, CancellationToken); this default, for a code store of a host's own written before 0.176.0, removes and answers true, as before.