Show / Hide Table of Contents

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 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 authorizations in the database.

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 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 authorizations that match the specified query.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 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 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 that can be used to abort the operation.

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 that can be used to abort the operation.

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 that can be used to abort the operation.

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 that can be used to abort the operation.

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 that can be used to abort the operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask<TAuthorization>

A that can be used to monitor the asynchronous operation, whose result returns the authorization corresponding to the identifier.

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 that can be used to abort the operation.

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 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 authorization.

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 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.

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 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 authorization.

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 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 authorization.

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 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 authorization.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask<ImmutableArray<System.String>>

A that can be used to monitor the asynchronous operation, whose result returns the scopes associated with the specified authorization.

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 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 authorization.

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 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 authorization.

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 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 type associated with the specified authorization.

InstantiateAsync(CancellationToken)

Instantiates a new authorization.

Declaration
ValueTask<TAuthorization> InstantiateAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

The that can be used to abort the operation.

Returns
Type Description
ValueTask<TAuthorization>

A that can be used to monitor the asynchronous operation, whose result returns the instantiated authorization, that can be persisted in the database.

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 that can be used to abort the operation.

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 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.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

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 that can be used to abort the operation.

Returns
Type Description
ValueTask

A that can be used to monitor the asynchronous operation.

In This Article
Back to top Generated by DocFX