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
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<object>, IQueryable<TResult>>The query to execute.
cancellationTokenCancellationTokenThe 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
TResultThe 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
descriptorOpenIddictApplicationDescriptorThe application descriptor.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application to create.
secretstringThe client secret associated with the application, if applicable.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
CreateAsync(object, CancellationToken)
Creates a new application.
ValueTask CreateAsync(object application, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application to create.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
DeleteAsync(object, CancellationToken)
Removes an existing application.
ValueTask DeleteAsync(object application, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application to delete.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
FindByClientIdAsync(string, CancellationToken)
Retrieves an application using its client identifier.
ValueTask<object?> FindByClientIdAsync(string identifier, CancellationToken cancellationToken = default)
Parameters
identifierstringThe client identifier associated with the application.
cancellationTokenCancellationTokenThe 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
identifierstringThe unique identifier associated with the application.
cancellationTokenCancellationTokenThe 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
uristringThe post_logout_redirect_uri associated with the applications.
cancellationTokenCancellationTokenThe 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
uristringThe redirect_uri associated with the applications.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<object>, IQueryable<TResult>>The query to execute.
cancellationTokenCancellationTokenThe 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
TResultThe 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
queryFunc<IQueryable<object>, TState, IQueryable<TResult>>The query to execute.
stateTStateThe optional state.
cancellationTokenCancellationTokenThe 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
TStateThe state type.
TResultThe result type.
GetClientIdAsync(object, CancellationToken)
Retrieves the client identifier associated with an application.
ValueTask<string?> GetClientIdAsync(object application, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cultureCultureInfoThe culture (typically CurrentUICulture).
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
typestringThe expected application type.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application.
typestringThe expected client type.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application.
typestringThe expected consent type.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application.
permissionstringThe permission.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application.
requirementstringThe requirement.
cancellationTokenCancellationTokenThe 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
countint?The number of results to return.
offsetint?The number of results to skip.
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<object>, IQueryable<TResult>>The query to execute.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TResult>
All the elements returned when executing the specified query.
Type Parameters
TResultThe 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
queryFunc<IQueryable<object>, TState, IQueryable<TResult>>The query to execute.
stateTStateThe optional state.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TResult>
All the elements returned when executing the specified query.
Type Parameters
TStateThe state type.
TResultThe 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
descriptorOpenIddictApplicationDescriptorThe descriptor.
applicationobjectThe application.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
PopulateAsync(object, OpenIddictApplicationDescriptor, CancellationToken)
Populates the application using the specified descriptor.
ValueTask PopulateAsync(object application, OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application.
descriptorOpenIddictApplicationDescriptorThe descriptor.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(object, OpenIddictApplicationDescriptor, CancellationToken)
Updates an existing application.
ValueTask UpdateAsync(object application, OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application to update.
descriptorOpenIddictApplicationDescriptorThe descriptor used to update the application.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application to update.
secretstringThe client secret associated with the application.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(object, CancellationToken)
Updates an existing application.
ValueTask UpdateAsync(object application, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application to update.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
ValidateAsync(object, CancellationToken)
Validates the application to ensure it's in a consistent state.
IAsyncEnumerable<ValidationResult> ValidateAsync(object application, CancellationToken cancellationToken = default)
Parameters
applicationobjectThe application.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
secretstringThe secret that should be compared to the client_secret stored in the database.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
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
applicationobjectThe application.
uristringThe URI that should be compared to one of the post_logout_redirect_uri stored in the database.
cancellationTokenCancellationTokenThe 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
applicationobjectThe application.
uristringThe URI that should be compared to one of the redirect_uri stored in the database.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.