Interface IOpenIddictTokenStore<TToken>
Provides methods allowing to manage the tokens stored in a database.
Namespace: OpenIddict.Abstractions
Assembly: cs.temp.dll.dll
Syntax
public interface IOpenIddictTokenStore<TToken>
where TToken : class
Type Parameters
Name | Description |
---|---|
TToken | The type of the Token entity. |
Methods
CountAsync(CancellationToken)
Determines the number of tokens that exist in the database.
Declaration
ValueTask<long> CountAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Int64> | A |
CountAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>>, CancellationToken)
Determines the number of tokens that match the specified query.
Declaration
ValueTask<long> CountAsync<TResult>(Func<IQueryable<TToken>, IQueryable<TResult>> query, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TToken>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Int64> | A |
Type Parameters
Name | Description |
---|---|
TResult | The result type. |
CreateAsync(TToken, CancellationToken)
Creates a new token.
Declaration
ValueTask CreateAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token to create. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
DeleteAsync(TToken, CancellationToken)
Removes a token.
Declaration
ValueTask DeleteAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token to delete. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
FindAsync(String, String, CancellationToken)
Retrieves the tokens corresponding to the specified subject and associated with the application identifier.
Declaration
IAsyncEnumerable<TToken> FindAsync(string subject, string client, CancellationToken cancellationToken)
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 |
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
IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, CancellationToken cancellationToken)
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 |
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
IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken)
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 |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TToken> | The tokens corresponding to the criteria. |
FindByApplicationIdAsync(String, CancellationToken)
Retrieves the list of tokens corresponding to the specified application identifier.
Declaration
IAsyncEnumerable<TToken> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The application identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
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
IAsyncEnumerable<TToken> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The authorization identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TToken> | The tokens corresponding to the specified authorization. |
FindByIdAsync(String, CancellationToken)
Retrieves a token using its unique identifier.
Declaration
ValueTask<TToken> FindByIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The unique identifier associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TToken> | A |
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
ValueTask<TToken> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The reference identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TToken> | A |
FindBySubjectAsync(String, CancellationToken)
Retrieves the list of tokens corresponding to the specified subject.
Declaration
IAsyncEnumerable<TToken> FindBySubjectAsync(string subject, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the tokens. |
CancellationToken | cancellationToken | The |
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
ValueTask<string> GetApplicationIdAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns the first element.
Declaration
ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TToken>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TResult> | A |
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
ValueTask<string> GetAuthorizationIdAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetCreationDateAsync(TToken, CancellationToken)
Retrieves the creation date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetCreationDateAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Nullable<System.DateTimeOffset>> | A |
GetExpirationDateAsync(TToken, CancellationToken)
Retrieves the expiration date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetExpirationDateAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Nullable<System.DateTimeOffset>> | A |
GetIdAsync(TToken, CancellationToken)
Retrieves the unique identifier associated with a token.
Declaration
ValueTask<string> GetIdAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetPayloadAsync(TToken, CancellationToken)
Retrieves the payload associated with a token.
Declaration
ValueTask<string> GetPayloadAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetPropertiesAsync(TToken, CancellationToken)
Retrieves the additional properties associated with a token.
Declaration
ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<ImmutableDictionary<System.String, JsonElement>> | A |
GetRedemptionDateAsync(TToken, CancellationToken)
Retrieves the redemption date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetRedemptionDateAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Nullable<System.DateTimeOffset>> | A |
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
ValueTask<string> GetReferenceIdAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetStatusAsync(TToken, CancellationToken)
Retrieves the status associated with a token.
Declaration
ValueTask<string> GetStatusAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetSubjectAsync(TToken, CancellationToken)
Retrieves the subject associated with a token.
Declaration
ValueTask<string> GetSubjectAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetTypeAsync(TToken, CancellationToken)
Retrieves the token type associated with a token.
Declaration
ValueTask<string> GetTypeAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
InstantiateAsync(CancellationToken)
Instantiates a new token.
Declaration
ValueTask<TToken> InstantiateAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TToken> | A |
ListAsync(Nullable<Int32>, Nullable<Int32>, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TToken> ListAsync(int? count, int? offset, CancellationToken cancellationToken)
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 |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TToken> | All the elements returned when executing the specified query. |
ListAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TToken>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TToken>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
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. |
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
ValueTask PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.DateTimeOffset | threshold | The date before which tokens are not pruned. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetApplicationIdAsync(TToken, String, CancellationToken)
Sets the application identifier associated with a token.
Declaration
ValueTask SetApplicationIdAsync(TToken token, string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | identifier | The unique identifier associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetAuthorizationIdAsync(TToken, String, CancellationToken)
Sets the authorization identifier associated with a token.
Declaration
ValueTask SetAuthorizationIdAsync(TToken token, string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | identifier | The unique identifier associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetCreationDateAsync(TToken, Nullable<DateTimeOffset>, CancellationToken)
Sets the creation date associated with a token.
Declaration
ValueTask SetCreationDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.Nullable<System.DateTimeOffset> | date | The creation date. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetExpirationDateAsync(TToken, Nullable<DateTimeOffset>, CancellationToken)
Sets the expiration date associated with a token.
Declaration
ValueTask SetExpirationDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.Nullable<System.DateTimeOffset> | date | The expiration date. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetPayloadAsync(TToken, String, CancellationToken)
Sets the payload associated with a token.
Declaration
ValueTask SetPayloadAsync(TToken token, string payload, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | payload | The payload associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetPropertiesAsync(TToken, ImmutableDictionary<String, JsonElement>, CancellationToken)
Sets the additional properties associated with a token.
Declaration
ValueTask SetPropertiesAsync(TToken token, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
ImmutableDictionary<System.String, JsonElement> | properties | The additional properties associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetRedemptionDateAsync(TToken, Nullable<DateTimeOffset>, CancellationToken)
Sets the redemption date associated with a token.
Declaration
ValueTask SetRedemptionDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.Nullable<System.DateTimeOffset> | date | The redemption date. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetReferenceIdAsync(TToken, String, CancellationToken)
Sets 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
ValueTask SetReferenceIdAsync(TToken token, string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | identifier | The reference identifier associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetStatusAsync(TToken, String, CancellationToken)
Sets the status associated with a token.
Declaration
ValueTask SetStatusAsync(TToken token, string status, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | status | The status associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetSubjectAsync(TToken, String, CancellationToken)
Sets the subject associated with a token.
Declaration
ValueTask SetSubjectAsync(TToken token, string subject, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | subject | The subject associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetTypeAsync(TToken, String, CancellationToken)
Sets the token type associated with a token.
Declaration
ValueTask SetTypeAsync(TToken token, string type, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token. |
System.String | type | The token type associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
UpdateAsync(TToken, CancellationToken)
Updates an existing token.
Declaration
ValueTask UpdateAsync(TToken token, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TToken | token | The token to update. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |