Show / Hide Table of Contents

# Class OpenIddictTokenManager<TToken>

Provides methods allowing to manage the tokens stored in the store.

##### Inheritance

System.Object
OpenIddictTokenManager<TToken>

###### Namespace: OpenIddict.Core

###### Assembly: cs.temp.dll.dll

##### Syntax

    public class OpenIddictTokenManager<TToken> : IOpenIddictTokenManager where TToken : class

##### Type Parameters

Name | Description
--- | ---
TToken | The type of the Token entity.

##### Remarks

Applications that do not want to depend on a specific entity type can use the non-generic instead, for which the actual entity type is resolved at runtime based on the default entity type registered in the core options.

### Constructors

#### OpenIddictTokenManager(IOpenIddictTokenCache<TToken>, ILogger<OpenIddictTokenManager<TToken>>, IOptionsMonitor<OpenIddictCoreOptions>, IOpenIddictTokenStoreResolver)

##### Declaration

    public OpenIddictTokenManager(IOpenIddictTokenCache<TToken> cache, ILogger<OpenIddictTokenManager<TToken>> logger, IOptionsMonitor<OpenIddictCoreOptions> options, IOpenIddictTokenStoreResolver resolver)

##### Parameters

Type | Name | Description
--- | --- | ---
IOpenIddictTokenCache<TToken> | cache |
ILogger<OpenIddictTokenManager<TToken>> | logger |
IOptionsMonitor<OpenIddictCoreOptions> | options |
IOpenIddictTokenStoreResolver | resolver |

### Properties

#### Cache

Gets the cache associated with the current manager.

##### Declaration

    protected IOpenIddictTokenCache<TToken> Cache { get; }

##### Property Value

Type | Description
--- | ---
IOpenIddictTokenCache<TToken> |

#### Logger

Gets the logger associated with the current manager.

##### Declaration

    protected ILogger Logger { get; }

##### Property Value

Type | Description
--- | ---
ILogger |

#### Options

Gets the options associated with the current manager.

##### Declaration

    protected IOptionsMonitor<OpenIddictCoreOptions> Options { get; }

##### Property Value

Type | Description
--- | ---
IOptionsMonitor<OpenIddictCoreOptions> |

#### Store

Gets the store associated with the current manager.

##### Declaration

    protected IOpenIddictTokenStore<TToken> Store { get; }

##### Property Value

Type | Description
--- | ---
IOpenIddictTokenStore<TToken> |

### Methods

#### CountAsync(CancellationToken)

Determines the number of tokens that exist in the database.

##### Declaration

    public virtual ValueTask<long> CountAsync(CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> | A that can be used to monitor the asynchronous operation, whose result returns the number of tokens in the database.

#### CountAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>>, CancellationToken)

Determines the number of tokens that match the specified query.

##### Declaration

    public virtual ValueTask<long> CountAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TToken>, IQueryable<TResult>> | query | The query to execute.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> | A that can be used to monitor the asynchronous operation, whose result returns the number of tokens that match the specified query.

##### Type Parameters

Name | Description
--- | ---
TResult | The result type.

#### CreateAsync(TToken, CancellationToken)

Creates a new token.

##### Declaration

    public virtual ValueTask CreateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### CreateAsync(OpenIddictTokenDescriptor, CancellationToken)

Creates a new token based on the specified descriptor.

##### Declaration

    public virtual ValueTask<TToken> CreateAsync(OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
OpenIddictTokenDescriptor | descriptor | The token descriptor.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TToken> | A that can be used to monitor the asynchronous operation, whose result returns the token.

#### DeleteAsync(TToken, CancellationToken)

Removes an existing token.

##### Declaration

    public virtual ValueTask DeleteAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to delete.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### FindAsync(String, String, CancellationToken)

Retrieves the tokens corresponding to the specified subject and associated with the application identifier.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindAsync(string subject, string client, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the subject/client.

#### FindAsync(String, String, String, CancellationToken)

Retrieves the tokens matching the specified parameters.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
System.String | status | The token status.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the criteria.

#### FindAsync(String, String, String, String, CancellationToken)

Retrieves the tokens matching the specified parameters.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
System.String | status | The token status.
System.String | type | The token type.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | Tokens corresponding to the criteria.

#### FindByApplicationIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified application identifier.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The application identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified application.

#### FindByAuthorizationIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified authorization identifier.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The authorization identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified authorization.

#### FindByIdAsync(String, CancellationToken)

Retrieves a token using its unique identifier.

##### Declaration

    public virtual ValueTask<TToken> FindByIdAsync(string identifier, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The unique identifier associated with the token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TToken> | A that can be used to monitor the asynchronous operation, whose result returns the token corresponding to the unique identifier.

#### FindByReferenceIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified reference identifier. Note: the reference identifier may be hashed or encrypted for security reasons.

##### Declaration

    public virtual ValueTask<TToken> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The reference identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TToken> | A that can be used to monitor the asynchronous operation, whose result returns the tokens corresponding to the specified reference identifier.

#### FindBySubjectAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified subject.

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindBySubjectAsync(string subject, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified subject.

#### GetApplicationIdAsync(TToken, CancellationToken)

Retrieves the optional application identifier associated with a token.

##### Declaration

    public virtual ValueTask<string> GetApplicationIdAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the application identifier associated with the token.

#### GetAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>>, CancellationToken)

Executes the specified query and returns the first element.

##### Declaration

    public virtual ValueTask<TResult> GetAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TToken>, IQueryable<TResult>> | query | The query to execute.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TResult> | A that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.

##### Type Parameters

Name | Description
--- | ---
TResult | The result type.

#### GetAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>>, TState, CancellationToken)

Executes the specified query and returns the first element.

##### Declaration

    public virtual ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TToken>, TState, IQueryable<TResult>> | query | The query to execute.
TState | state | The optional state.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TResult> | A that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.

##### Type Parameters

Name | Description
--- | ---
TState | The state type.
TResult | The result type.

#### GetAuthorizationIdAsync(TToken, CancellationToken)

Retrieves the optional authorization identifier associated with a token.

##### Declaration

    public virtual ValueTask<string> GetAuthorizationIdAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the authorization identifier associated with the token.

#### GetCreationDateAsync(TToken, CancellationToken)

Retrieves the creation date associated with a token.

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetCreationDateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Nullable<System.DateTimeOffset>> | A that can be used to monitor the asynchronous operation, whose result returns the creation date associated with the specified token.

#### GetExpirationDateAsync(TToken, CancellationToken)

Retrieves the expiration date associated with a token.

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetExpirationDateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Nullable<System.DateTimeOffset>> | A that can be used to monitor the asynchronous operation, whose result returns the expiration date associated with the specified token.

#### GetIdAsync(TToken, CancellationToken)

Retrieves the unique identifier associated with a token.

##### Declaration

    public virtual ValueTask<string> GetIdAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the token.

#### GetPayloadAsync(TToken, CancellationToken)

Retrieves the payload associated with a token.

##### Declaration

    public virtual ValueTask<string> GetPayloadAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the payload associated with the specified token.

#### GetPropertiesAsync(TToken, CancellationToken)

Retrieves the additional properties associated with a token.

##### Declaration

    public virtual ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableDictionary<System.String, JsonElement>> | A that can be used to monitor the asynchronous operation, whose result returns all the additional properties associated with the token.

#### GetRedemptionDateAsync(TToken, CancellationToken)

Retrieves the redemption date associated with a token.

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetRedemptionDateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Nullable<System.DateTimeOffset>> | A that can be used to monitor the asynchronous operation, whose result returns the redemption date associated with the specified token.

#### GetReferenceIdAsync(TToken, CancellationToken)

Retrieves the reference identifier associated with a token. Note: depending on the manager used to create the token, the reference identifier may be hashed for security reasons.

##### Declaration

    public virtual ValueTask<string> GetReferenceIdAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the reference identifier associated with the specified token.

#### GetStatusAsync(TToken, CancellationToken)

Retrieves the status associated with a token.

##### Declaration

    public virtual ValueTask<string> GetStatusAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the status associated with the specified token.

#### GetSubjectAsync(TToken, CancellationToken)

Retrieves the subject associated with a token.

##### Declaration

    public virtual ValueTask<string> GetSubjectAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the subject associated with the specified token.

#### GetTypeAsync(TToken, CancellationToken)

Retrieves the token type associated with a token.

##### Declaration

    public virtual ValueTask<string> GetTypeAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation, whose result returns the token type associated with the specified token.

#### HasStatusAsync(TToken, String, CancellationToken)

Determines whether a given token has the specified status.

##### Declaration

    public virtual ValueTask<bool> HasStatusAsync(TToken token, string status, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
System.String | status | The expected status.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Boolean> | `true` if the token has the specified status, `false` otherwise.

#### HasTypeAsync(TToken, String, CancellationToken)

Determines whether a given token has the specified type.

##### Declaration

    public virtual ValueTask<bool> HasTypeAsync(TToken token, string type, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
System.String | type | The expected type.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Boolean> | `true` if the token has the specified type, `false` otherwise.

#### ListAsync(Nullable<Int32>, Nullable<Int32>, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    public virtual IAsyncEnumerable<TToken> ListAsync(int? count = default(int? ), int? offset = default(int? ), CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Nullable<System.Int32> | count | The number of results to return.
System.Nullable<System.Int32> | offset | The number of results to skip.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | All the elements returned when executing the specified query.

#### ListAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>>, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    public virtual IAsyncEnumerable<TResult> ListAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TToken>, IQueryable<TResult>> | query | The query to execute.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TResult> | All the elements returned when executing the specified query.

##### Type Parameters

Name | Description
--- | ---
TResult | The result type.

#### ListAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>>, TState, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    public virtual IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TToken>, TState, IQueryable<TResult>> | query | The query to execute.
TState | state | The optional state.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TResult> | All the elements returned when executing the specified query.

##### Type Parameters

Name | Description
--- | ---
TState | The state type.
TResult | The result type.

#### ObfuscateReferenceIdAsync(String, CancellationToken)

Obfuscates the specified reference identifier so it can be safely stored in a database. By default, this method returns a simple hashed representation computed using SHA256.

##### Declaration

    protected virtual ValueTask<string> ObfuscateReferenceIdAsync(string identifier, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The client identifier.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A that can be used to monitor the asynchronous operation.

#### PopulateAsync(TToken, OpenIddictTokenDescriptor, CancellationToken)

Populates the token using the specified descriptor.

##### Declaration

    public virtual ValueTask PopulateAsync(TToken token, OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
OpenIddictTokenDescriptor | descriptor | The descriptor.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### PopulateAsync(OpenIddictTokenDescriptor, TToken, CancellationToken)

Populates the specified descriptor using the properties exposed by the token.

##### Declaration

    public virtual ValueTask PopulateAsync(OpenIddictTokenDescriptor descriptor, TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
OpenIddictTokenDescriptor | descriptor | The descriptor.
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### PruneAsync(DateTimeOffset, CancellationToken)

Removes the tokens that are marked as invalid or whose attached authorization is no longer valid. Only tokens created before the specified `threshold` are removed.

##### Declaration

    public virtual ValueTask PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.DateTimeOffset | threshold | The date before which tokens are not pruned.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### TryRedeemAsync(TToken, CancellationToken)

Tries to redeem a token.

##### Declaration

    public virtual ValueTask<bool> TryRedeemAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to redeem.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Boolean> | `true` if the token was successfully redemeed, `false` otherwise.

#### TryRejectAsync(TToken, CancellationToken)

Tries to reject a token.

##### Declaration

    public virtual ValueTask<bool> TryRejectAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to reject.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Boolean> | `true` if the token was successfully redemeed, `false` otherwise.

#### TryRevokeAsync(TToken, CancellationToken)

Tries to revoke a token.

##### Declaration

    public virtual ValueTask<bool> TryRevokeAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to revoke.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Boolean> | `true` if the token was successfully revoked, `false` otherwise.

#### UpdateAsync(TToken, CancellationToken)

Updates an existing token.

##### Declaration

    public virtual ValueTask UpdateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to update.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### UpdateAsync(TToken, OpenIddictTokenDescriptor, CancellationToken)

Updates an existing token.

##### Declaration

    public virtual ValueTask UpdateAsync(TToken token, OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to update.
OpenIddictTokenDescriptor | descriptor | The descriptor used to update the token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### ValidateAsync(TToken, CancellationToken)

Validates the token to ensure it's in a consistent state.

##### Declaration

    public virtual IAsyncEnumerable<ValidationResult> ValidateAsync(TToken token, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<ValidationResult> | The validation error encountered when validating the token.