Class DefaultAuthorizationCodeStore
- Namespace
- Fdyay.IdentityServer.Services
- Assembly
- Fdyay.IdentityServer.Core.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public sealed class DefaultAuthorizationCodeStore : IAuthorizationCodeStore
- Inheritance
-
DefaultAuthorizationCodeStore
- Implements
- Inherited Members
Constructors
DefaultAuthorizationCodeStore(IPersistedGrantStore, TimeProvider, IHandleGenerationService)
A code store over store.
public DefaultAuthorizationCodeStore(IPersistedGrantStore store, TimeProvider time, IHandleGenerationService handles)
Parameters
storeIPersistedGrantStoreThe persisted grant store the codes are kept in, keyed by the handle's hash.
timeTimeProviderThe clock a code's expiry is checked against.
handlesIHandleGenerationServiceWhat mints each code's handle.
Methods
GetAuthorizationCodeAsync(string, CancellationToken)
The authorization code a handle names, or null.
public Task<AuthorizationCode?> GetAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)
Parameters
codestringThe handle the client presented.
cancellationTokenCancellationTokenCancels 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.
public Task RemoveAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)
Parameters
codestringThe handle the client presented.
cancellationTokenCancellationTokenCancels the removal.
Returns
StoreAuthorizationCodeAsync(AuthorizationCode, CancellationToken)
Stores an authorization code and returns the handle the client is given for it.
public Task<string> StoreAuthorizationCodeAsync(AuthorizationCode code, CancellationToken cancellationToken = default)
Parameters
codeAuthorizationCodeThe code's contents.
cancellationTokenCancellationTokenCancels the write.
Returns
TryRemoveAuthorizationCodeAsync(string, CancellationToken)
Removes the authorization code a handle names, saying whether this call is the one that removed it.
public Task<bool> TryRemoveAuthorizationCodeAsync(string code, CancellationToken cancellationToken = default)
Parameters
codestringThe handle the client presented.
cancellationTokenCancellationTokenCancels the removal.
Returns
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.