Interface IOpenIddictTokenManager
Provides methods allowing to manage the tokens stored in the store. Note: this interface is not meant to be implemented by custom managers, that should inherit from the generic OpenIddictTokenManager class. It is primarily intended to be used by services that cannot easily depend on the generic token manager. The actual token entity type is automatically determined at runtime based on the OpenIddict core options.
Namespace: OpenIddict.Abstractions
Assembly: cs.temp.dll.dll
Syntax
public interface IOpenIddictTokenManager
Methods
CountAsync(CancellationToken)
Determines the number of tokens that exist in the database.
Declaration
ValueTask<long> CountAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Int64> | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation, whose result returns the number of tokens in the database. |
CountAsync<TResult>(Func<IQueryable<Object>, IQueryable<TResult>>, CancellationToken)
Determines the number of tokens that match the specified query.
Declaration
ValueTask<long> CountAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<System.Object>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Int64> | A System.Threading.Tasks.ValueTask 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(OpenIddictTokenDescriptor, CancellationToken)
Creates a new token based on the specified descriptor.
Declaration
ValueTask<object> CreateAsync(OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OpenIddictTokenDescriptor | descriptor | The token descriptor. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Object> | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation, whose result returns the token. |
CreateAsync(Object, CancellationToken)
Creates a new token.
Declaration
ValueTask CreateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
DeleteAsync(Object, CancellationToken)
Removes an existing token.
Declaration
ValueTask DeleteAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to delete. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask 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
IAsyncEnumerable<object> 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 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the subject/client. |
FindAsync(String, String, String, CancellationToken)
Retrieves the tokens matching the specified parameters.
Declaration
IAsyncEnumerable<object> 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 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the criteria. |
FindAsync(String, String, String, String, CancellationToken)
Retrieves the tokens matching the specified parameters.
Declaration
IAsyncEnumerable<object> 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 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the criteria. |
FindByApplicationIdAsync(String, CancellationToken)
Retrieves the list of tokens corresponding to the specified application identifier.
Declaration
IAsyncEnumerable<object> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The application identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the specified application. |
FindByAuthorizationIdAsync(String, CancellationToken)
Retrieves the list of tokens corresponding to the specified authorization identifier.
Declaration
IAsyncEnumerable<object> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The authorization identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the specified authorization. |
FindByIdAsync(String, CancellationToken)
Retrieves a token using its unique identifier.
Declaration
ValueTask<object> FindByIdAsync(string identifier, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The unique identifier associated with the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Object> | A System.Threading.Tasks.ValueTask 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
ValueTask<object> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The reference identifier associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Object> | A System.Threading.Tasks.ValueTask 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
IAsyncEnumerable<object> FindBySubjectAsync(string subject, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the tokens. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | The tokens corresponding to the specified subject. |
GetApplicationIdAsync(Object, CancellationToken)
Retrieves the optional application identifier associated with a token.
Declaration
ValueTask<string> GetApplicationIdAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the application identifier associated with the token. |
GetAsync<TResult>(Func<IQueryable<Object>, IQueryable<TResult>>, CancellationToken)
Executes the specified query and returns the first element.
Declaration
ValueTask<TResult> GetAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<System.Object>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TResult> | A System.Threading.Tasks.ValueTask 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<Object>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns the first element.
Declaration
ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<System.Object>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TResult> | A System.Threading.Tasks.ValueTask 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(Object, CancellationToken)
Retrieves the optional authorization identifier associated with a token.
Declaration
ValueTask<string> GetAuthorizationIdAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the authorization identifier associated with the token. |
GetCreationDateAsync(Object, CancellationToken)
Retrieves the creation date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetCreationDateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Nullable<System.DateTimeOffset>> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the creation date associated with the specified token. |
GetExpirationDateAsync(Object, CancellationToken)
Retrieves the expiration date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetExpirationDateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Nullable<System.DateTimeOffset>> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the expiration date associated with the specified token. |
GetIdAsync(Object, CancellationToken)
Retrieves the unique identifier associated with a token.
Declaration
ValueTask<string> GetIdAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the token. |
GetPayloadAsync(Object, CancellationToken)
Retrieves the payload associated with a token.
Declaration
ValueTask<string> GetPayloadAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the payload associated with the specified token. |
GetPropertiesAsync(Object, CancellationToken)
Retrieves the additional properties associated with a token.
Declaration
ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<ImmutableDictionary<System.String, JsonElement>> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the additional properties associated with the token. |
GetRedemptionDateAsync(Object, CancellationToken)
Retrieves the redemption date associated with a token.
Declaration
ValueTask<DateTimeOffset?> GetRedemptionDateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Nullable<System.DateTimeOffset>> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the redemption date associated with the specified token. |
GetReferenceIdAsync(Object, 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(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the reference identifier associated with the specified token. |
GetStatusAsync(Object, CancellationToken)
Retrieves the status associated with a token.
Declaration
ValueTask<string> GetStatusAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the status associated with the specified token. |
GetSubjectAsync(Object, CancellationToken)
Retrieves the subject associated with a token.
Declaration
ValueTask<string> GetSubjectAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the subject associated with the specified token. |
GetTypeAsync(Object, CancellationToken)
Retrieves the token type associated with a token.
Declaration
ValueTask<string> GetTypeAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the token type associated with the specified token. |
HasStatusAsync(Object, String, CancellationToken)
Determines whether a given token has the specified status.
Declaration
ValueTask<bool> HasStatusAsync(object token, string status, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
System.String | status | The expected status. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Boolean> |
|
HasTypeAsync(Object, String, CancellationToken)
Determines whether a given token has the specified type.
Declaration
ValueTask<bool> HasTypeAsync(object token, string type, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
System.String | type | The expected type. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Boolean> |
|
ListAsync(Nullable<Int32>, Nullable<Int32>, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<object> 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 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.Object> | All the elements returned when executing the specified query. |
ListAsync<TResult>(Func<IQueryable<Object>, IQueryable<TResult>>, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TResult> ListAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<System.Object>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TResult> | All the elements returned when executing the specified query. |
Type Parameters
Name | Description |
---|---|
TResult | The result type. |
ListAsync<TState, TResult>(Func<IQueryable<Object>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<System.Object>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TResult> | All the elements returned when executing the specified query. |
Type Parameters
Name | Description |
---|---|
TState | The state type. |
TResult | The result type. |
PopulateAsync(OpenIddictTokenDescriptor, Object, CancellationToken)
Populates the specified descriptor using the properties exposed by the token.
Declaration
ValueTask PopulateAsync(OpenIddictTokenDescriptor descriptor, object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OpenIddictTokenDescriptor | descriptor | The descriptor. |
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
PopulateAsync(Object, OpenIddictTokenDescriptor, CancellationToken)
Populates the token using the specified descriptor.
Declaration
ValueTask PopulateAsync(object token, OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
OpenIddictTokenDescriptor | descriptor | The descriptor. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask 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
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 |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
TryRedeemAsync(Object, CancellationToken)
Tries to redeem a token.
Declaration
ValueTask<bool> TryRedeemAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to redeem. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Boolean> |
|
TryRejectAsync(Object, CancellationToken)
Tries to reject a token.
Declaration
ValueTask<bool> TryRejectAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to reject. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Boolean> |
|
TryRevokeAsync(Object, CancellationToken)
Tries to revoke a token.
Declaration
ValueTask<bool> TryRevokeAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to revoke. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Boolean> |
|
UpdateAsync(Object, CancellationToken)
Updates an existing token.
Declaration
ValueTask UpdateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to update. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
UpdateAsync(Object, OpenIddictTokenDescriptor, CancellationToken)
Updates an existing token.
Declaration
ValueTask UpdateAsync(object token, OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token to update. |
OpenIddictTokenDescriptor | descriptor | The descriptor used to update the token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
ValidateAsync(Object, CancellationToken)
Validates the token to ensure it's in a consistent state.
Declaration
IAsyncEnumerable<ValidationResult> ValidateAsync(object token, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | token | The token. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<ValidationResult> | The validation error encountered when validating the token. |