Table of Contents

Interface IOpenIddictApplicationManager

Namespace
OpenIddict.Abstractions
Assembly
OpenIddict.Abstractions.dll

Provides methods allowing to manage the applications stored in the store. Note: this interface is not meant to be implemented by custom managers, that should inherit from the generic OpenIddictApplicationManager class. It is primarily intended to be used by services that cannot easily depend on the generic application manager. The actual application entity type is automatically determined at runtime based on the OpenIddict core options.

public interface IOpenIddictApplicationManager

Methods

CountAsync(CancellationToken)

Determines the number of applications that exist in the database.

ValueTask<long> CountAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<long>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns the number of applications in the database.

CountAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>>, CancellationToken)

Determines the number of applications that match the specified query.

ValueTask<long> CountAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default)

Parameters

query Func<IQueryable<object>, IQueryable<TResult>>

The query to execute.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<long>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns the number of applications that match the specified query.

Type Parameters

TResult

The result type.

CreateAsync(OpenIddictApplicationDescriptor, CancellationToken)

Creates a new application based on the specified descriptor. Note: the default implementation automatically hashes the client secret before storing it in the database, for security reasons.

ValueTask<object> CreateAsync(OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default)

Parameters

descriptor OpenIddictApplicationDescriptor

The application descriptor.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<object>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the application.

CreateAsync(object, string?, CancellationToken)

Creates a new application. Note: the default implementation automatically hashes the client secret before storing it in the database, for security reasons.

ValueTask CreateAsync(object application, string? secret, CancellationToken cancellationToken = default)

Parameters

application object

The application to create.

secret string

The client secret associated with the application, if applicable.

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.

CreateAsync(object, CancellationToken)

Creates a new application.

ValueTask CreateAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application to create.

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.

DeleteAsync(object, CancellationToken)

Removes an existing application.

ValueTask DeleteAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application to delete.

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.

FindByClientIdAsync(string, CancellationToken)

Retrieves an application using its client identifier.

ValueTask<object?> FindByClientIdAsync(string identifier, CancellationToken cancellationToken = default)

Parameters

identifier string

The client identifier associated with the application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<object>

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

FindByIdAsync(string, CancellationToken)

Retrieves an application using its unique identifier.

ValueTask<object?> FindByIdAsync(string identifier, CancellationToken cancellationToken = default)

Parameters

identifier string

The unique identifier associated with the application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<object>

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

FindByPostLogoutRedirectUriAsync(string, CancellationToken)

Retrieves all the applications associated with the specified post_logout_redirect_uri.

IAsyncEnumerable<object> FindByPostLogoutRedirectUriAsync(string uri, CancellationToken cancellationToken = default)

Parameters

uri string

The post_logout_redirect_uri associated with the applications.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<object>

The client applications corresponding to the specified post_logout_redirect_uri.

FindByRedirectUriAsync(string, CancellationToken)

Retrieves all the applications associated with the specified redirect_uri.

IAsyncEnumerable<object> FindByRedirectUriAsync(string uri, CancellationToken cancellationToken = default)

Parameters

uri string

The redirect_uri associated with the applications.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<object>

The client applications corresponding to the specified redirect_uri.

GetApplicationTypeAsync(object, CancellationToken)

Retrieves the application type associated with an application.

ValueTask<string?> GetApplicationTypeAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the application type of the application (by default, "web").

GetAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>>, CancellationToken)

Executes the specified query and returns the first element.

ValueTask<TResult?> GetAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default)

Parameters

query Func<IQueryable<object>, IQueryable<TResult>>

The query to execute.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<TResult>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.

Type Parameters

TResult

The result type.

GetAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>>, TState, CancellationToken)

Executes the specified query and returns the first element.

ValueTask<TResult?> GetAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = default)

Parameters

query Func<IQueryable<object>, TState, IQueryable<TResult>>

The query to execute.

state TState

The optional state.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<TResult>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.

Type Parameters

TState

The state type.

TResult

The result type.

GetClientIdAsync(object, CancellationToken)

Retrieves the client identifier associated with an application.

ValueTask<string?> GetClientIdAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the client identifier associated with the application.

GetClientTypeAsync(object, CancellationToken)

Retrieves the client type associated with an application.

ValueTask<string?> GetClientTypeAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the client type of the application (by default, "public").

GetConsentTypeAsync(object, CancellationToken)

Retrieves the consent type associated with an application.

ValueTask<string?> GetConsentTypeAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the consent type of the application (by default, "explicit").

GetDisplayNameAsync(object, CancellationToken)

Retrieves the display name associated with an application.

ValueTask<string?> GetDisplayNameAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the display name associated with the application.

GetDisplayNamesAsync(object, CancellationToken)

Retrieves the localized display names associated with an application.

ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableDictionary<CultureInfo, string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the localized display names associated with the application.

GetIdAsync(object, CancellationToken)

Retrieves the unique identifier associated with an application.

ValueTask<string?> GetIdAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the application.

GetJsonWebKeySetAsync(object, CancellationToken)

Retrieves the JSON Web Key Set associated with an application.

ValueTask<JsonWebKeySet?> GetJsonWebKeySetAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<JsonWebKeySet>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the JSON Web Key Set associated with the application.

GetLocalizedDisplayNameAsync(object, CultureInfo, CancellationToken)

Retrieves the localized display name associated with an application and corresponding to the specified culture or one of its parents. If no matching value can be found, the non-localized value is returned.

ValueTask<string?> GetLocalizedDisplayNameAsync(object application, CultureInfo culture, CancellationToken cancellationToken = default)

Parameters

application object

The application.

culture CultureInfo

The culture (typically CurrentUICulture).

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching localized display name associated with the application.

GetLocalizedDisplayNameAsync(object, CancellationToken)

Retrieves the localized display name associated with an application and corresponding to the current UI culture or one of its parents. If no matching value can be found, the non-localized value is returned.

ValueTask<string?> GetLocalizedDisplayNameAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<string>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching localized display name associated with the application.

GetPermissionsAsync(object, CancellationToken)

Retrieves the permissions associated with an application.

ValueTask<ImmutableArray<string>> GetPermissionsAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableArray<string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the permissions associated with the application.

GetPostLogoutRedirectUrisAsync(object, CancellationToken)

Retrieves the post-logout redirect URIs associated with an application.

ValueTask<ImmutableArray<string>> GetPostLogoutRedirectUrisAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableArray<string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the post_logout_redirect_uri associated with the application.

GetPropertiesAsync(object, CancellationToken)

Retrieves the additional properties associated with an application.

ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableDictionary<string, JsonElement>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the additional properties associated with the application.

GetRedirectUrisAsync(object, CancellationToken)

Retrieves the redirect URIs associated with an application.

ValueTask<ImmutableArray<string>> GetRedirectUrisAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableArray<string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the redirect_uri associated with the application.

GetRequirementsAsync(object, CancellationToken)

Retrieves the requirements associated with an application.

ValueTask<ImmutableArray<string>> GetRequirementsAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableArray<string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the requirements associated with the application.

GetSettingsAsync(object, CancellationToken)

Retrieves the settings associated with an application.

ValueTask<ImmutableDictionary<string, string>> GetSettingsAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<ImmutableDictionary<string, string>>

A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the settings associated with the application.

HasApplicationTypeAsync(object, string, CancellationToken)

Determines whether a given application has the specified application type.

ValueTask<bool> HasApplicationTypeAsync(object application, string type, CancellationToken cancellationToken = default)

Parameters

application object

The application.

type string

The expected application type.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

true if the application has the specified application type, false otherwise.

HasClientTypeAsync(object, string, CancellationToken)

Determines whether a given application has the specified client type.

ValueTask<bool> HasClientTypeAsync(object application, string type, CancellationToken cancellationToken = default)

Parameters

application object

The application.

type string

The expected client type.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

true if the application has the specified client type, false otherwise.

HasConsentTypeAsync(object, string, CancellationToken)

Determines whether a given application has the specified consent type.

ValueTask<bool> HasConsentTypeAsync(object application, string type, CancellationToken cancellationToken = default)

Parameters

application object

The application.

type string

The expected consent type.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

true if the application has the specified consent type, false otherwise.

HasPermissionAsync(object, string, CancellationToken)

Determines whether the specified permission has been granted to the application.

ValueTask<bool> HasPermissionAsync(object application, string permission, CancellationToken cancellationToken = default)

Parameters

application object

The application.

permission string

The permission.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

true if the application has been granted the specified permission, false otherwise.

HasRequirementAsync(object, string, CancellationToken)

Determines whether the specified requirement has been enforced for the specified application.

ValueTask<bool> HasRequirementAsync(object application, string requirement, CancellationToken cancellationToken = default)

Parameters

application object

The application.

requirement string

The requirement.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

true if the requirement has been enforced for the specified application, false otherwise.

ListAsync(int?, int?, CancellationToken)

Executes the specified query and returns all the corresponding elements.

IAsyncEnumerable<object> ListAsync(int? count = null, int? offset = null, CancellationToken cancellationToken = default)

Parameters

count int?

The number of results to return.

offset int?

The number of results to skip.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

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

IAsyncEnumerable<TResult> ListAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default)

Parameters

query Func<IQueryable<object>, IQueryable<TResult>>

The query to execute.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TResult>

All the elements returned when executing the specified query.

Type Parameters

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.

IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = default)

Parameters

query Func<IQueryable<object>, TState, IQueryable<TResult>>

The query to execute.

state TState

The optional state.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<TResult>

All the elements returned when executing the specified query.

Type Parameters

TState

The state type.

TResult

The result type.

PopulateAsync(OpenIddictApplicationDescriptor, object, CancellationToken)

Populates the specified descriptor using the properties exposed by the application.

ValueTask PopulateAsync(OpenIddictApplicationDescriptor descriptor, object application, CancellationToken cancellationToken = default)

Parameters

descriptor OpenIddictApplicationDescriptor

The descriptor.

application object

The application.

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.

PopulateAsync(object, OpenIddictApplicationDescriptor, CancellationToken)

Populates the application using the specified descriptor.

ValueTask PopulateAsync(object application, OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default)

Parameters

application object

The application.

descriptor OpenIddictApplicationDescriptor

The descriptor.

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.

UpdateAsync(object, OpenIddictApplicationDescriptor, CancellationToken)

Updates an existing application.

ValueTask UpdateAsync(object application, OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default)

Parameters

application object

The application to update.

descriptor OpenIddictApplicationDescriptor

The descriptor used to update the application.

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.

UpdateAsync(object, string, CancellationToken)

Updates an existing application and replaces the existing secret. Note: the default implementation automatically hashes the client secret before storing it in the database, for security reasons.

ValueTask UpdateAsync(object application, string secret, CancellationToken cancellationToken = default)

Parameters

application object

The application to update.

secret string

The client secret associated with the application.

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.

UpdateAsync(object, CancellationToken)

Updates an existing application.

ValueTask UpdateAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application to update.

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.

ValidateAsync(object, CancellationToken)

Validates the application to ensure it's in a consistent state.

IAsyncEnumerable<ValidationResult> ValidateAsync(object application, CancellationToken cancellationToken = default)

Parameters

application object

The application.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

IAsyncEnumerable<ValidationResult>

The validation error encountered when validating the application.

ValidateClientSecretAsync(object, string, CancellationToken)

Validates the client_secret associated with an application.

ValueTask<bool> ValidateClientSecretAsync(object application, string secret, CancellationToken cancellationToken = default)

Parameters

application object

The application.

secret string

The secret that should be compared to the client_secret stored in the database.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

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

ValidatePostLogoutRedirectUriAsync(object, string, CancellationToken)

Validates the post_logout_redirect_uri to ensure it's associated with an application.

ValueTask<bool> ValidatePostLogoutRedirectUriAsync(object application, string uri, CancellationToken cancellationToken = default)

Parameters

application object

The application.

uri string

The URI that should be compared to one of the post_logout_redirect_uri stored in the database.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns a boolean indicating whether the post_logout_redirect_uri was valid.

Remarks

Note: if no client_id parameter is specified in logout requests, this method may not be called.

ValidateRedirectUriAsync(object, string, CancellationToken)

Validates the redirect_uri to ensure it's associated with an application.

ValueTask<bool> ValidateRedirectUriAsync(object application, string uri, CancellationToken cancellationToken = default)

Parameters

application object

The application.

uri string

The URI that should be compared to one of the redirect_uri stored in the database.

cancellationToken CancellationToken

The CancellationToken that can be used to abort the operation.

Returns

ValueTask<bool>

A ValueTask that can be used to monitor the asynchronous operation, whose result returns a boolean indicating whether the redirect_uri was valid.