Interface IOpenIddictScopeManager
- Namespace
- OpenIddict.Abstractions
- Assembly
- OpenIddict.Abstractions.dll
Provides methods allowing to manage the scopes stored in the store. Note: this interface is not meant to be implemented by custom managers, that should inherit from the generic OpenIddictScopeManager class. It is primarily intended to be used by services that cannot easily depend on the generic scope manager. The actual scope entity type is automatically determined at runtime based on the OpenIddict core options.
public interface IOpenIddictScopeManager
Methods
CountAsync(CancellationToken)
Determines the number of scopes that exist in the database.
ValueTask<long> CountAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe 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 scopes in the database.
CountAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>>, CancellationToken)
Determines the number of scopes 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
CancellationTokenThe 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 scopes that match the specified query.
Type Parameters
TResult
The result type.
CreateAsync(OpenIddictScopeDescriptor, CancellationToken)
Creates a new scope based on the specified descriptor.
ValueTask<object> CreateAsync(OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
descriptor
OpenIddictScopeDescriptorThe scope descriptor.
cancellationToken
CancellationTokenThe 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 scope.
CreateAsync(object, CancellationToken)
Creates a new scope.
ValueTask CreateAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope to create.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
DeleteAsync(object, CancellationToken)
Removes an existing scope.
ValueTask DeleteAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope to delete.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
FindByIdAsync(string, CancellationToken)
Retrieves a scope using its unique identifier.
ValueTask<object?> FindByIdAsync(string identifier, CancellationToken cancellationToken = default)
Parameters
identifier
stringThe unique identifier associated with the scope.
cancellationToken
CancellationTokenThe 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 scope corresponding to the identifier.
FindByNameAsync(string, CancellationToken)
Retrieves a scope using its name.
ValueTask<object?> FindByNameAsync(string name, CancellationToken cancellationToken = default)
Parameters
name
stringThe name associated with the scope.
cancellationToken
CancellationTokenThe 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 scope corresponding to the specified name.
FindByNamesAsync(ImmutableArray<string>, CancellationToken)
Retrieves a list of scopes using their name.
IAsyncEnumerable<object> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken = default)
Parameters
names
ImmutableArray<string>The names associated with the scopes.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<object>
The scopes corresponding to the specified names.
FindByResourceAsync(string, CancellationToken)
Retrieves all the scopes that contain the specified resource.
IAsyncEnumerable<object> FindByResourceAsync(string resource, CancellationToken cancellationToken = default)
Parameters
resource
stringThe resource associated with the scopes.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<object>
The scopes associated with the specified resource.
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
CancellationTokenThe 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
TStateThe optional state.
cancellationToken
CancellationTokenThe 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.
GetDescriptionAsync(object, CancellationToken)
Retrieves the description associated with a scope.
ValueTask<string?> GetDescriptionAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 description associated with the specified scope.
GetDescriptionsAsync(object, CancellationToken)
Retrieves the localized descriptions associated with an scope.
ValueTask<ImmutableDictionary<CultureInfo, string>> GetDescriptionsAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 descriptions associated with the scope.
GetDisplayNameAsync(object, CancellationToken)
Retrieves the display name associated with a scope.
ValueTask<string?> GetDisplayNameAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 scope.
GetDisplayNamesAsync(object, CancellationToken)
Retrieves the localized display names associated with an scope.
ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 scope.
GetIdAsync(object, CancellationToken)
Retrieves the unique identifier associated with a scope.
ValueTask<string?> GetIdAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 scope.
GetLocalizedDescriptionAsync(object, CultureInfo, CancellationToken)
Retrieves the localized description associated with an scope 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?> GetLocalizedDescriptionAsync(object scope, CultureInfo culture, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
culture
CultureInfoThe culture (typically CurrentUICulture).
cancellationToken
CancellationTokenThe 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 description associated with the scope.
GetLocalizedDescriptionAsync(object, CancellationToken)
Retrieves the localized description associated with an scope 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?> GetLocalizedDescriptionAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 description associated with the scope.
GetLocalizedDisplayNameAsync(object, CultureInfo, CancellationToken)
Retrieves the localized display name associated with an scope 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 scope, CultureInfo culture, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
culture
CultureInfoThe culture (typically CurrentUICulture).
cancellationToken
CancellationTokenThe 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 scope.
GetLocalizedDisplayNameAsync(object, CancellationToken)
Retrieves the localized display name associated with an scope 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 scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 scope.
GetNameAsync(object, CancellationToken)
Retrieves the name associated with a scope.
ValueTask<string?> GetNameAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 name associated with the specified scope.
GetPropertiesAsync(object, CancellationToken)
Retrieves the additional properties associated with a scope.
ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 scope.
GetResourcesAsync(object, CancellationToken)
Retrieves the resources associated with a scope.
ValueTask<ImmutableArray<string>> GetResourcesAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe 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 resources associated with the scope.
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
CancellationTokenThe 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
CancellationTokenThe 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
TStateThe optional state.
cancellationToken
CancellationTokenThe 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.
ListResourcesAsync(ImmutableArray<string>, CancellationToken)
Lists all the resources associated with the specified scopes.
IAsyncEnumerable<string> ListResourcesAsync(ImmutableArray<string> scopes, CancellationToken cancellationToken = default)
Parameters
scopes
ImmutableArray<string>The scopes.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<string>
All the resources associated with the specified scopes.
PopulateAsync(OpenIddictScopeDescriptor, object, CancellationToken)
Populates the specified descriptor using the properties exposed by the scope.
ValueTask PopulateAsync(OpenIddictScopeDescriptor descriptor, object scope, CancellationToken cancellationToken = default)
Parameters
descriptor
OpenIddictScopeDescriptorThe descriptor.
scope
objectThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
PopulateAsync(object, OpenIddictScopeDescriptor, CancellationToken)
Populates the scope using the specified descriptor.
ValueTask PopulateAsync(object scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
descriptor
OpenIddictScopeDescriptorThe descriptor.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(object, OpenIddictScopeDescriptor, CancellationToken)
Updates an existing scope.
ValueTask UpdateAsync(object scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope to update.
descriptor
OpenIddictScopeDescriptorThe descriptor used to update the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(object, CancellationToken)
Updates an existing scope.
ValueTask UpdateAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope to update.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
ValidateAsync(object, CancellationToken)
Validates the scope to ensure it's in a consistent state.
IAsyncEnumerable<ValidationResult> ValidateAsync(object scope, CancellationToken cancellationToken = default)
Parameters
scope
objectThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<ValidationResult>
The validation error encountered when validating the scope.