41 changed files with 2372 additions and 495 deletions
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace OpenIddict.Core |
namespace OpenIddict.Abstractions |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Represents an OpenIddict application descriptor.
|
/// Represents an OpenIddict application descriptor.
|
||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace OpenIddict.Core |
namespace OpenIddict.Abstractions |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Represents an OpenIddict scope descriptor.
|
/// Represents an OpenIddict scope descriptor.
|
||||
@ -0,0 +1,421 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Immutable; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace OpenIddict.Abstractions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 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.
|
||||
|
/// </summary>
|
||||
|
public interface IOpenIddictApplicationManager |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Determines the number of applications that exist in the database.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of applications in the database.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines the number of applications that match the specified query.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of applications that match the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 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.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The application descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the unique identifier associated with the application.
|
||||
|
/// </returns>
|
||||
|
Task<object> CreateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to create.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task CreateAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new application.
|
||||
|
/// Note: the default implementation automatically hashes the client
|
||||
|
/// secret before storing it in the database, for security reasons.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to create.</param>
|
||||
|
/// <param name="secret">The client secret associated with the application, if applicable.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task CreateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes an existing application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to delete.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task DeleteAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves an application using its client identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The client identifier associated with the application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the client application corresponding to the identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByClientIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves an application using its unique identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The unique identifier associated with the application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the client application corresponding to the identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves all the applications associated with the specified post_logout_redirect_uri.
|
||||
|
/// </summary>
|
||||
|
/// <param name="address">The post_logout_redirect_uri associated with the applications.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result
|
||||
|
/// returns the client applications corresponding to the specified post_logout_redirect_uri.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindByPostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves all the applications associated with the specified redirect_uri.
|
||||
|
/// </summary>
|
||||
|
/// <param name="address">The redirect_uri associated with the applications.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result
|
||||
|
/// returns the client applications corresponding to the specified redirect_uri.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindByRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the client identifier associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the client identifier associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetClientIdAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the client type associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the client type of the application (by default, "public").
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetClientTypeAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the consent type associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the consent type of the application (by default, "explicit").
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetConsentTypeAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the display name associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the display name associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetDisplayNameAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the unique identifier associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the unique identifier associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetIdAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the permissions associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the permissions associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<ImmutableArray<string>> GetPermissionsAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the logout callback addresses associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the post_logout_redirect_uri associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<ImmutableArray<string>> GetPostLogoutRedirectUrisAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the callback addresses associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the redirect_uri associated with the application.
|
||||
|
/// </returns>
|
||||
|
ValueTask<ImmutableArray<string>> GetRedirectUrisAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether the specified permission has been granted to the application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="permission">The permission.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the application has been granted the specified permission, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> HasPermissionAsync([NotNull] object application, [NotNull] string permission, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether an application is a confidential client.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the application is a confidential client, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsConfidentialAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether an application is a hybrid client.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the application is a hybrid client, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsHybridAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether an application is a public client.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the application is a public client, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsPublicAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <param name="count">The number of results to return.</param>
|
||||
|
/// <param name="offset">The number of results to skip.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> ListAsync([CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the specified descriptor using the properties exposed by the application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, [NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the application using the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to update.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to update.</param>
|
||||
|
/// <param name="descriptor">The descriptor used to update the application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 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.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application to update.</param>
|
||||
|
/// <param name="secret">The client secret associated with the application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the application to ensure it's in a consistent state.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the validation error encountered when validating the application.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<ValidationResult>> ValidateAsync([NotNull] object application, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the client_secret associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="secret">The secret that should be compared to the client_secret stored in the database.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>A <see cref="Task"/> that can be used to monitor the asynchronous operation.</returns>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns a boolean indicating whether the client secret was valid.
|
||||
|
/// </returns>
|
||||
|
Task<bool> ValidateClientSecretAsync([NotNull] object application, string secret, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the specified post_logout_redirect_uri.
|
||||
|
/// </summary>
|
||||
|
/// <param name="address">The address that should be compared to the post_logout_redirect_uri stored in the database.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result
|
||||
|
/// returns a boolean indicating whether the post_logout_redirect_uri was valid.
|
||||
|
/// </returns>
|
||||
|
Task<bool> ValidatePostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the redirect_uri to ensure it's associated with an application.
|
||||
|
/// </summary>
|
||||
|
/// <param name="application">The application.</param>
|
||||
|
/// <param name="address">The address that should be compared to one of the redirect_uri stored in the database.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns a boolean indicating whether the redirect_uri was valid.
|
||||
|
/// </returns>
|
||||
|
Task<bool> ValidateRedirectUriAsync([NotNull] object application, [NotNull] string address, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,419 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Immutable; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Security.Claims; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace OpenIddict.Abstractions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Provides methods allowing to manage the authorizations stored in the store.
|
||||
|
/// Note: this interface is not meant to be implemented by custom managers,
|
||||
|
/// that should inherit from the generic OpenIddictAuthorizationManager class.
|
||||
|
/// It is primarily intended to be used by services that cannot easily depend
|
||||
|
/// on the generic authorization manager. The actual authorization entity type
|
||||
|
/// is automatically determined at runtime based on the OpenIddict core options.
|
||||
|
/// </summary>
|
||||
|
public interface IOpenIddictAuthorizationManager |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Determines the number of authorizations that exist in the database.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of authorizations in the database.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines the number of authorizations that match the specified query.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of authorizations that match the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new permanent authorization based on the specified parameters.
|
||||
|
/// </summary>
|
||||
|
/// <param name="principal">The principal associated with the authorization.</param>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="client">The client associated with the authorization.</param>
|
||||
|
/// <param name="type">The authorization type.</param>
|
||||
|
/// <param name="scopes">The minimal scopes associated with the authorization.</param>
|
||||
|
/// <param name="properties">The authentication properties associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization.
|
||||
|
/// </returns>
|
||||
|
Task<object> CreateAsync([NotNull] ClaimsPrincipal principal, [NotNull] string subject, [NotNull] string client, [NotNull] string type, ImmutableArray<string> scopes, [CanBeNull] ImmutableDictionary<string, string> properties, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new authorization based on the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The authorization descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization.
|
||||
|
/// </returns>
|
||||
|
Task<object> CreateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The application to create.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task CreateAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes an existing authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization to delete.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task DeleteAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the authorizations corresponding to the specified
|
||||
|
/// subject and associated with the application identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="client">The client associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorizations corresponding to the subject/client.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindAsync([NotNull] string subject, [NotNull] string client, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the authorizations matching the specified parameters.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="client">The client associated with the authorization.</param>
|
||||
|
/// <param name="status">The authorization status.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorizations corresponding to the criteria.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindAsync([NotNull] string subject, [NotNull] string client, [NotNull] string status, CancellationToken cancellationToken); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the authorizations matching the specified parameters.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="client">The client associated with the authorization.</param>
|
||||
|
/// <param name="status">The authorization status.</param>
|
||||
|
/// <param name="type">The authorization type.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorizations corresponding to the criteria.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindAsync([NotNull] string subject, [NotNull] string client, [NotNull] string status, [NotNull] string type, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the authorizations matching the specified parameters.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="client">The client associated with the authorization.</param>
|
||||
|
/// <param name="status">The authorization status.</param>
|
||||
|
/// <param name="type">The authorization type.</param>
|
||||
|
/// <param name="scopes">The minimal scopes associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorizations corresponding to the criteria.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindAsync([NotNull] string subject, [NotNull] string client, [NotNull] string status, [NotNull] string type, ImmutableArray<string> scopes, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves an authorization using its unique identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The unique identifier associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorization corresponding to the identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves all the authorizations corresponding to the specified subject.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorizations corresponding to the specified subject.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the optional application identifier associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the application identifier associated with the authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetApplicationIdAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the unique identifier associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the unique identifier associated with the authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetIdAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the scopes associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the scopes associated with the specified authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<ImmutableArray<string>> GetScopesAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the status associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the status associated with the specified authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetStatusAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the subject associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the subject associated with the specified authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetSubjectAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the type associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the type associated with the specified authorization.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetTypeAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether the specified scopes are included in the authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="scopes">The scopes.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the scopes are included in the authorization, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> HasScopesAsync([NotNull] object authorization, ImmutableArray<string> scopes, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given authorization is ad hoc.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the authorization is ad hoc, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsAdHocAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given authorization is permanent.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the authorization is permanent, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsPermanentAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given authorization has been revoked.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the authorization has been revoked, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsRevokedAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given authorization is valid.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the authorization is valid, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsValidAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <param name="count">The number of results to return.</param>
|
||||
|
/// <param name="offset">The number of results to skip.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> ListAsync([CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the specified descriptor using the properties exposed by the authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, [NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the authorization using the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes the ad-hoc authorizations that are marked as invalid or have no valid token attached.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PruneAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Revokes an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization to revoke.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>A <see cref="Task"/> that can be used to monitor the asynchronous operation.</returns>
|
||||
|
Task RevokeAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the application identifier associated with an authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="identifier">The unique identifier associated with the client application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task SetApplicationIdAsync([NotNull] object authorization, [CanBeNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization to update.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing authorization.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization to update.</param>
|
||||
|
/// <param name="descriptor">The descriptor used to update the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the authorization to ensure it's in a consistent state.
|
||||
|
/// </summary>
|
||||
|
/// <param name="authorization">The authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the validation error encountered when validating the authorization.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<ValidationResult>> ValidateAsync([NotNull] object authorization, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,290 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Immutable; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace OpenIddict.Abstractions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 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.
|
||||
|
/// </summary>
|
||||
|
public interface IOpenIddictScopeManager |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Determines the number of scopes that exist in the database.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of scopes in the database.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines the number of scopes that match the specified query.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of scopes that match the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new scope based on the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The scope descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope.
|
||||
|
/// </returns>
|
||||
|
Task<object> CreateAsync([NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope to create.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task CreateAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes an existing scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope to delete.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task DeleteAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves a scope using its unique identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The unique identifier associated with the scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the scope corresponding to the identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves a scope using its name.
|
||||
|
/// </summary>
|
||||
|
/// <param name="name">The name associated with the scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the scope corresponding to the specified name.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByNameAsync([NotNull] string name, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves a list of scopes using their name.
|
||||
|
/// </summary>
|
||||
|
/// <param name="names">The names associated with the scopes.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the scopes corresponding to the specified names.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the description associated with a scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the description associated with the specified scope.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetDescriptionAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the display name associated with a scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the display name associated with the scope.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetDisplayNameAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the unique identifier associated with a scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the unique identifier associated with the scope.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetIdAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the name associated with a scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the name associated with the specified scope.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetNameAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the resources associated with a scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the resources associated with the scope.
|
||||
|
/// </returns>
|
||||
|
ValueTask<ImmutableArray<string>> GetResourcesAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <param name="count">The number of results to return.</param>
|
||||
|
/// <param name="offset">The number of results to skip.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> ListAsync([CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Lists all the resources associated with the specified scopes.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scopes">The scopes.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the resources associated with the specified scopes.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<string>> ListResourcesAsync(ImmutableArray<string> scopes, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the specified descriptor using the properties exposed by the scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] OpenIddictScopeDescriptor descriptor, [NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the scope using the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope to update.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing scope.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope to update.</param>
|
||||
|
/// <param name="descriptor">The descriptor used to update the scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the scope to ensure it's in a consistent state.
|
||||
|
/// </summary>
|
||||
|
/// <param name="scope">The scope.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the validation error encountered when validating the scope.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<ValidationResult>> ValidateAsync([NotNull] object scope, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,452 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Immutable; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace OpenIddict.Abstractions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Provides methods allowing to manage the tokens stored in the store.
|
||||
|
/// Note: this interface is not meant to be implemented by custom managers,
|
||||
|
/// that should inherit from the generic OpenIddictTokenManager class.
|
||||
|
/// It is primarily intended to be used by services that cannot easily
|
||||
|
/// depend on the generic token manager. The actual token entity type is
|
||||
|
/// automatically determined at runtime based on the OpenIddict core options.
|
||||
|
/// </summary>
|
||||
|
public interface IOpenIddictTokenManager |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Determines the number of tokens that exist in the database.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of tokens in the database.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines the number of tokens that match the specified query.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the number of tokens that match the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<long> CountAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new token based on the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The token descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token.
|
||||
|
/// </returns>
|
||||
|
Task<object> CreateAsync([NotNull] OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Creates a new token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task CreateAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes an existing token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token to delete.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task DeleteAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Extends the specified token by replacing its expiration date.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="date">The date on which the token will no longer be considered valid.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task ExtendAsync([NotNull] object token, [CanBeNull] DateTimeOffset? date, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the list of tokens corresponding to the specified application identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The application identifier associated with the tokens.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the tokens corresponding to the specified application.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the list of tokens corresponding to the specified authorization identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The authorization identifier associated with the tokens.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the tokens corresponding to the specified authorization.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindByAuthorizationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves a token using its unique identifier.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The unique identifier associated with the token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the token corresponding to the unique identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the list of tokens corresponding to the specified reference identifier.
|
||||
|
/// Note: the reference identifier may be hashed or encrypted for security reasons.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The reference identifier associated with the tokens.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the tokens corresponding to the specified reference identifier.
|
||||
|
/// </returns>
|
||||
|
Task<object> FindByReferenceIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the list of tokens corresponding to the specified subject.
|
||||
|
/// </summary>
|
||||
|
/// <param name="subject">The subject associated with the tokens.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the tokens corresponding to the specified subject.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the optional application identifier associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the application identifier associated with the token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetApplicationIdAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns the first element.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the first element returned when executing the query.
|
||||
|
/// </returns>
|
||||
|
Task<TResult> GetAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the optional authorization identifier associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the authorization identifier associated with the token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetAuthorizationIdAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the creation date associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the creation date associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<DateTimeOffset?> GetCreationDateAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the expiration date associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the expiration date associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<DateTimeOffset?> GetExpirationDateAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the unique identifier associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the unique identifier associated with the token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetIdAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the payload associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the payload associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetPayloadAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the reference identifier associated with a token.
|
||||
|
/// Note: depending on the manager used to create the token,
|
||||
|
/// the reference identifier may be hashed for security reasons.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the reference identifier associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetReferenceIdAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the status associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the status associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetStatusAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the subject associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the subject associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetSubjectAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Retrieves the token type associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="ValueTask{TResult}"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the token type associated with the specified token.
|
||||
|
/// </returns>
|
||||
|
ValueTask<string> GetTokenTypeAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given token has already been redemeed.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the token has already been redemeed, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsRedeemedAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given token has been revoked.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the token has been revoked, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsRevokedAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Determines whether a given token is valid.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns><c>true</c> if the token is valid, <c>false</c> otherwise.</returns>
|
||||
|
Task<bool> IsValidAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <param name="count">The number of results to return.</param>
|
||||
|
/// <param name="offset">The number of results to skip.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<object>> ListAsync([CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TResult>([NotNull] Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Executes the specified query and returns all the corresponding elements.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TState">The state type.</typeparam>
|
||||
|
/// <typeparam name="TResult">The result type.</typeparam>
|
||||
|
/// <param name="query">The query to execute.</param>
|
||||
|
/// <param name="state">The optional state.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns all the elements returned when executing the specified query.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<TResult>> ListAsync<TState, TResult>([NotNull] Func<IQueryable<object>, TState, IQueryable<TResult>> query, [CanBeNull] TState state, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Obfuscates the specified reference identifier so it can be safely stored in a database.
|
||||
|
/// By default, this method returns a simple hashed representation computed using SHA256.
|
||||
|
/// </summary>
|
||||
|
/// <param name="identifier">The client identifier.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task<string> ObfuscateReferenceIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the specified descriptor using the properties exposed by the token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] OpenIddictTokenDescriptor descriptor, [NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Populates the token using the specified descriptor.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="descriptor">The descriptor.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PopulateAsync([NotNull] object token, [NotNull] OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Removes the tokens that are marked as expired or invalid.
|
||||
|
/// </summary>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task PruneAsync(CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Redeems a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token to redeem.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>A <see cref="Task"/> that can be used to monitor the asynchronous operation.</returns>
|
||||
|
Task RedeemAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Revokes a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token to revoke.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>A <see cref="Task"/> that can be used to monitor the asynchronous operation.</returns>
|
||||
|
Task RevokeAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the application identifier associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="identifier">The unique identifier associated with the client application.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task SetApplicationIdAsync([NotNull] object token, [CanBeNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the authorization identifier associated with a token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="identifier">The unique identifier associated with the authorization.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task SetAuthorizationIdAsync([NotNull] object token, [CanBeNull] string identifier, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token to update.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Updates an existing token.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token to update.</param>
|
||||
|
/// <param name="descriptor">The descriptor used to update the token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
||||
|
/// </returns>
|
||||
|
Task UpdateAsync([NotNull] object token, [NotNull] OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Validates the token to ensure it's in a consistent state.
|
||||
|
/// </summary>
|
||||
|
/// <param name="token">The token.</param>
|
||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
||||
|
/// <returns>
|
||||
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
||||
|
/// whose result returns the validation error encountered when validating the token.
|
||||
|
/// </returns>
|
||||
|
Task<ImmutableArray<ValidationResult>> ValidateAsync([NotNull] object token, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue