Interface IOpenIddictAuthorizationStore<TAuthorization>
Provides methods allowing to manage the authorizations stored in a database.
Namespace: OpenIddict.Abstractions
Assembly: cs.temp.dll.dll
Syntax
public interface IOpenIddictAuthorizationStore<TAuthorization>
where TAuthorization : class
Type Parameters
Name | Description |
---|---|
TAuthorization | The type of the Authorization entity. |
Methods
CountAsync(CancellationToken)
Determines the number of authorizations 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<TAuthorization>, IQueryable<TResult>>, CancellationToken)
Determines the number of authorizations that match the specified query.
Declaration
ValueTask<long> CountAsync<TResult>(Func<IQueryable<TAuthorization>, IQueryable<TResult>> query, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TAuthorization>, 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(TAuthorization, CancellationToken)
Creates a new authorization.
Declaration
ValueTask CreateAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization to create. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
DeleteAsync(TAuthorization, CancellationToken)
Removes an existing authorization.
Declaration
ValueTask DeleteAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization to delete. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
FindAsync(String, String, CancellationToken)
Retrieves the authorizations corresponding to the specified subject and associated with the application identifier.
Declaration
IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the authorization. |
System.String | client | The client associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the subject/client. |
FindAsync(String, String, String, CancellationToken)
Retrieves the authorizations matching the specified parameters.
Declaration
IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the authorization. |
System.String | client | The client associated with the authorization. |
System.String | status | The authorization status. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the criteria. |
FindAsync(String, String, String, String, CancellationToken)
Retrieves the authorizations matching the specified parameters.
Declaration
IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the authorization. |
System.String | client | The client associated with the authorization. |
System.String | status | The authorization status. |
System.String | type | The authorization type. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the criteria. |
FindAsync(String, String, String, String, ImmutableArray<String>, CancellationToken)
Retrieves the authorizations matching the specified parameters.
Declaration
IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, string type, ImmutableArray<string> scopes, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the authorization. |
System.String | client | The client associated with the authorization. |
System.String | status | The authorization status. |
System.String | type | The authorization type. |
ImmutableArray<System.String> | scopes | The minimal scopes associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the criteria. |
FindByApplicationIdAsync(String, CancellationToken)
Retrieves the list of authorizations corresponding to the specified application identifier.
Declaration
IAsyncEnumerable<TAuthorization> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The application identifier associated with the authorizations. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the specified application. |
FindByIdAsync(String, CancellationToken)
Retrieves an authorization using its unique identifier.
Declaration
ValueTask<TAuthorization> FindByIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The unique identifier associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TAuthorization> | A |
FindBySubjectAsync(String, CancellationToken)
Retrieves all the authorizations corresponding to the specified subject.
Declaration
IAsyncEnumerable<TAuthorization> FindBySubjectAsync(string subject, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | subject | The subject associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TAuthorization> | The authorizations corresponding to the specified subject. |
GetApplicationIdAsync(TAuthorization, CancellationToken)
Retrieves the optional application identifier associated with an authorization.
Declaration
ValueTask<string> GetApplicationIdAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns the first element.
Declaration
ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TAuthorization>, 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. |
GetCreationDateAsync(TAuthorization, CancellationToken)
Retrieves the creation date associated with an authorization.
Declaration
ValueTask<DateTimeOffset?> GetCreationDateAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.Nullable<System.DateTimeOffset>> | A |
GetIdAsync(TAuthorization, CancellationToken)
Retrieves the unique identifier associated with an authorization.
Declaration
ValueTask<string> GetIdAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetPropertiesAsync(TAuthorization, CancellationToken)
Retrieves the additional properties associated with an authorization.
Declaration
ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<ImmutableDictionary<System.String, JsonElement>> | A |
GetScopesAsync(TAuthorization, CancellationToken)
Retrieves the scopes associated with an authorization.
Declaration
ValueTask<ImmutableArray<string>> GetScopesAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<ImmutableArray<System.String>> | A |
GetStatusAsync(TAuthorization, CancellationToken)
Retrieves the status associated with an authorization.
Declaration
ValueTask<string> GetStatusAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetSubjectAsync(TAuthorization, CancellationToken)
Retrieves the subject associated with an authorization.
Declaration
ValueTask<string> GetSubjectAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
GetTypeAsync(TAuthorization, CancellationToken)
Retrieves the type associated with an authorization.
Declaration
ValueTask<string> GetTypeAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<System.String> | A |
InstantiateAsync(CancellationToken)
Instantiates a new authorization.
Declaration
ValueTask<TAuthorization> InstantiateAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask<TAuthorization> | A |
ListAsync(Nullable<Int32>, Nullable<Int32>, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TAuthorization> 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<TAuthorization> | All the elements returned when executing the specified query. |
ListAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TAuthorization>, 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 authorizations that are marked as invalid and the ad-hoc ones that have no token attached.
Only authorizations 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 authorizations are not pruned. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
Remarks
To ensure ad-hoc authorizations that no longer have any valid/non-expired token attached are correctly removed, the tokens should always be pruned first.
SetApplicationIdAsync(TAuthorization, String, CancellationToken)
Sets the application identifier associated with an authorization.
Declaration
ValueTask SetApplicationIdAsync(TAuthorization authorization, string identifier, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
System.String | identifier | The unique identifier associated with the client application. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetCreationDateAsync(TAuthorization, Nullable<DateTimeOffset>, CancellationToken)
Sets the creation date associated with an authorization.
Declaration
ValueTask SetCreationDateAsync(TAuthorization authorization, DateTimeOffset? date, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
System.Nullable<System.DateTimeOffset> | date | The expiration date. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetPropertiesAsync(TAuthorization, ImmutableDictionary<String, JsonElement>, CancellationToken)
Sets the additional properties associated with an authorization.
Declaration
ValueTask SetPropertiesAsync(TAuthorization authorization, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
ImmutableDictionary<System.String, JsonElement> | properties | The additional properties associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetScopesAsync(TAuthorization, ImmutableArray<String>, CancellationToken)
Sets the scopes associated with an authorization.
Declaration
ValueTask SetScopesAsync(TAuthorization authorization, ImmutableArray<string> scopes, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
ImmutableArray<System.String> | scopes | The scopes associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetStatusAsync(TAuthorization, String, CancellationToken)
Sets the status associated with an authorization.
Declaration
ValueTask SetStatusAsync(TAuthorization authorization, string status, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
System.String | status | The status associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetSubjectAsync(TAuthorization, String, CancellationToken)
Sets the subject associated with an authorization.
Declaration
ValueTask SetSubjectAsync(TAuthorization authorization, string subject, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
System.String | subject | The subject associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
SetTypeAsync(TAuthorization, String, CancellationToken)
Sets the type associated with an authorization.
Declaration
ValueTask SetTypeAsync(TAuthorization authorization, string type, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization. |
System.String | type | The type associated with the authorization. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |
UpdateAsync(TAuthorization, CancellationToken)
Updates an existing authorization.
Declaration
ValueTask UpdateAsync(TAuthorization authorization, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TAuthorization | authorization | The authorization to update. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
ValueTask | A |