Table of Contents

Interface IOpenIddictTokenCache<TToken>

Namespace
OpenIddict.Abstractions
Assembly
OpenIddict.Abstractions.dll

Provides methods allowing to cache tokens after retrieving them from the store.

public interface IOpenIddictTokenCache<TToken> where TToken : class

Type Parameters

TToken

The type of the Token entity.

Methods

AddAsync(TToken, CancellationToken)

Add the specified token to the cache.

ValueTask AddAsync(TToken token, CancellationToken cancellationToken)

Parameters

token TToken

The token to add to the cache.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask

A ValueTask that can be used to monitor the asynchronous operation.

FindAsync(string, string, string, string, CancellationToken)

Retrieves the tokens matching the specified parameters.

IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken)

Parameters

subject string

The subject associated with the token.

client string

The client associated with the token.

status string

The token status.

type string

The token type.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the criteria.

FindAsync(string, string, string, CancellationToken)

Retrieves the tokens matching the specified parameters.

IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, CancellationToken cancellationToken)

Parameters

subject string

The subject associated with the token.

client string

The client associated with the token.

status string

The token status.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the criteria.

FindAsync(string, string, CancellationToken)

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

IAsyncEnumerable<TToken> FindAsync(string subject, string client, CancellationToken cancellationToken)

Parameters

subject string

The subject associated with the token.

client string

The client associated with the token.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the subject/client.

FindByApplicationIdAsync(string, CancellationToken)

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

IAsyncEnumerable<TToken> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken)

Parameters

identifier string

The application identifier associated with the tokens.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the specified application.

FindByAuthorizationIdAsync(string, CancellationToken)

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

IAsyncEnumerable<TToken> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken)

Parameters

identifier string

The authorization identifier associated with the tokens.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the specified authorization.

FindByIdAsync(string, CancellationToken)

Retrieves a token using its unique identifier.

ValueTask<TToken?> FindByIdAsync(string identifier, CancellationToken cancellationToken)

Parameters

identifier string

The unique identifier associated with the token.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<TToken>

A ValueTask<TResult> 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.

ValueTask<TToken?> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken)

Parameters

identifier string

The reference identifier associated with the tokens.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<TToken>

A ValueTask<TResult> 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.

IAsyncEnumerable<TToken> FindBySubjectAsync(string subject, CancellationToken cancellationToken)

Parameters

subject string

The subject associated with the tokens.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TToken>

The tokens corresponding to the specified subject.

RemoveAsync(TToken, CancellationToken)

Removes the specified token from the cache.

ValueTask RemoveAsync(TToken token, CancellationToken cancellationToken)

Parameters

token TToken

The token to remove from the cache.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask

A ValueTask that can be used to monitor the asynchronous operation.