|
|
|
@ -47,7 +47,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the number of applications in the database.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<long> CountAsync(CancellationToken cancellationToken) |
|
|
|
public virtual Task<long> CountAsync(CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return Store.CountAsync(cancellationToken); |
|
|
|
} |
|
|
|
@ -62,7 +62,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<long> CountAsync<TResult>([NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken) |
|
|
|
public virtual Task<long> CountAsync<TResult>( |
|
|
|
[NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (query == null) |
|
|
|
{ |
|
|
|
@ -81,7 +82,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the unique identifier associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return CreateAsync(application, /* secret: */ null, cancellationToken); |
|
|
|
} |
|
|
|
@ -100,7 +101,7 @@ namespace OpenIddict.Core |
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<TApplication> CreateAsync( |
|
|
|
[NotNull] TApplication application, |
|
|
|
[CanBeNull] string secret, CancellationToken cancellationToken) |
|
|
|
[CanBeNull] string secret, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -162,7 +163,8 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the unique identifier associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<TApplication> CreateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken) |
|
|
|
public virtual async Task<TApplication> CreateAsync( |
|
|
|
[NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (descriptor == null) |
|
|
|
{ |
|
|
|
@ -195,7 +197,7 @@ namespace OpenIddict.Core |
|
|
|
/// <returns>
|
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task DeleteAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual async Task DeleteAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -224,7 +226,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the client application corresponding to the identifier.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<TApplication> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken) |
|
|
|
public virtual Task<TApplication> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(identifier)) |
|
|
|
{ |
|
|
|
@ -243,7 +245,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the client application corresponding to the identifier.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<TApplication> FindByClientIdAsync([NotNull] string identifier, CancellationToken cancellationToken) |
|
|
|
public virtual Task<TApplication> FindByClientIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(identifier)) |
|
|
|
{ |
|
|
|
@ -262,7 +264,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<ImmutableArray<TApplication>> FindByPostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<TApplication>> FindByPostLogoutRedirectUriAsync( |
|
|
|
[NotNull] string address, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(address)) |
|
|
|
{ |
|
|
|
@ -281,7 +284,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<ImmutableArray<TApplication>> FindByRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<TApplication>> FindByRedirectUriAsync( |
|
|
|
[NotNull] string address, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(address)) |
|
|
|
{ |
|
|
|
@ -301,7 +305,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<TResult> GetAsync<TResult>([NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken) |
|
|
|
public virtual Task<TResult> GetAsync<TResult>( |
|
|
|
[NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return GetAsync((applications, state) => state(applications), query, cancellationToken); |
|
|
|
} |
|
|
|
@ -320,7 +325,7 @@ namespace OpenIddict.Core |
|
|
|
/// </returns>
|
|
|
|
public virtual Task<TResult> GetAsync<TState, TResult>( |
|
|
|
[NotNull] Func<IQueryable<TApplication>, TState, IQueryable<TResult>> query, |
|
|
|
[CanBeNull] TState state, CancellationToken cancellationToken) |
|
|
|
[CanBeNull] TState state, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (query == null) |
|
|
|
{ |
|
|
|
@ -339,7 +344,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the client identifier associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<string> GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<string> GetClientIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -358,7 +363,8 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the client type of the application (by default, "public").
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<string> GetClientTypeAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual async Task<string> GetClientTypeAsync( |
|
|
|
[NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -388,7 +394,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the display name associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<string> GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<string> GetDisplayNameAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -407,7 +413,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns the unique identifier associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<string> GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<string> GetIdAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -426,7 +432,8 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns all the permissions associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<ImmutableArray<string>> GetPermissionsAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<string>> GetPermissionsAsync( |
|
|
|
[NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -445,7 +452,8 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose
|
|
|
|
/// result returns all the post_logout_redirect_uri associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<ImmutableArray<string>> GetPostLogoutRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<string>> GetPostLogoutRedirectUrisAsync( |
|
|
|
[NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -464,7 +472,8 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
|
|
|
|
/// whose result returns all the redirect_uri associated with the application.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<ImmutableArray<string>> GetRedirectUrisAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<string>> GetRedirectUrisAsync( |
|
|
|
[NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -481,7 +490,8 @@ namespace OpenIddict.Core |
|
|
|
/// <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>
|
|
|
|
public virtual async Task<bool> HasPermissionAsync([NotNull] TApplication application, [NotNull] string permission, CancellationToken cancellationToken) |
|
|
|
public virtual async Task<bool> HasPermissionAsync( |
|
|
|
[NotNull] TApplication application, [NotNull] string permission, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -497,7 +507,7 @@ namespace OpenIddict.Core |
|
|
|
/// <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>
|
|
|
|
public async Task<bool> IsConfidentialAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public async Task<bool> IsConfidentialAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -519,7 +529,7 @@ namespace OpenIddict.Core |
|
|
|
/// <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>
|
|
|
|
public async Task<bool> IsHybridAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public async Task<bool> IsHybridAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -541,7 +551,7 @@ namespace OpenIddict.Core |
|
|
|
/// <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>
|
|
|
|
public async Task<bool> IsPublicAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public async Task<bool> IsPublicAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -568,7 +578,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<ImmutableArray<TApplication>> ListAsync([CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<TApplication>> ListAsync( |
|
|
|
[CanBeNull] int? count, [CanBeNull] int? offset, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return Store.ListAsync(count, offset, cancellationToken); |
|
|
|
} |
|
|
|
@ -583,7 +594,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual Task<ImmutableArray<TResult>> ListAsync<TResult>([NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken) |
|
|
|
public virtual Task<ImmutableArray<TResult>> ListAsync<TResult>( |
|
|
|
[NotNull] Func<IQueryable<TApplication>, IQueryable<TResult>> query, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return ListAsync((applications, state) => state(applications), query, cancellationToken); |
|
|
|
} |
|
|
|
@ -602,7 +614,7 @@ namespace OpenIddict.Core |
|
|
|
/// </returns>
|
|
|
|
public virtual Task<ImmutableArray<TResult>> ListAsync<TState, TResult>( |
|
|
|
[NotNull] Func<IQueryable<TApplication>, TState, IQueryable<TResult>> query, |
|
|
|
[CanBeNull] TState state, CancellationToken cancellationToken) |
|
|
|
[CanBeNull] TState state, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (query == null) |
|
|
|
{ |
|
|
|
@ -620,7 +632,7 @@ namespace OpenIddict.Core |
|
|
|
/// <returns>
|
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task UpdateAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
public virtual async Task UpdateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -654,7 +666,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task UpdateAsync([NotNull] TApplication application, |
|
|
|
[CanBeNull] string secret, CancellationToken cancellationToken) |
|
|
|
[CanBeNull] string secret, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -686,7 +698,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task UpdateAsync([NotNull] TApplication application, |
|
|
|
[NotNull] Func<OpenIddictApplicationDescriptor, Task> operation, CancellationToken cancellationToken) |
|
|
|
[NotNull] Func<OpenIddictApplicationDescriptor, Task> operation, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (operation == null) |
|
|
|
{ |
|
|
|
@ -767,7 +779,7 @@ namespace OpenIddict.Core |
|
|
|
/// whose result returns a boolean indicating whether the client secret was valid.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<bool> ValidateClientSecretAsync( |
|
|
|
[NotNull] TApplication application, string secret, CancellationToken cancellationToken) |
|
|
|
[NotNull] TApplication application, string secret, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -810,7 +822,8 @@ namespace OpenIddict.Core |
|
|
|
/// 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>
|
|
|
|
public virtual async Task<bool> ValidatePostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken) |
|
|
|
public virtual async Task<bool> ValidatePostLogoutRedirectUriAsync( |
|
|
|
[NotNull] string address, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(address)) |
|
|
|
{ |
|
|
|
@ -854,7 +867,7 @@ namespace OpenIddict.Core |
|
|
|
/// whose result returns a boolean indicating whether the redirect_uri was valid.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<bool> ValidateRedirectUriAsync( |
|
|
|
[NotNull] TApplication application, [NotNull] string address, CancellationToken cancellationToken) |
|
|
|
[NotNull] TApplication application, [NotNull] string address, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -892,7 +905,7 @@ namespace OpenIddict.Core |
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
protected virtual async Task PopulateAsync([NotNull] TApplication application, |
|
|
|
[NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken) |
|
|
|
[NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (application == null) |
|
|
|
{ |
|
|
|
@ -923,7 +936,7 @@ namespace OpenIddict.Core |
|
|
|
/// <returns>
|
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
protected virtual async Task ValidateAsync([NotNull] TApplication application, CancellationToken cancellationToken) |
|
|
|
protected virtual async Task ValidateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(await Store.GetClientIdAsync(application, cancellationToken))) |
|
|
|
{ |
|
|
|
@ -995,7 +1008,7 @@ namespace OpenIddict.Core |
|
|
|
/// <returns>
|
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
protected virtual Task<string> ObfuscateClientSecretAsync([NotNull] string secret, CancellationToken cancellationToken) |
|
|
|
protected virtual Task<string> ObfuscateClientSecretAsync([NotNull] string secret, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(secret)) |
|
|
|
{ |
|
|
|
@ -1017,7 +1030,7 @@ namespace OpenIddict.Core |
|
|
|
/// whose result returns a boolean indicating whether the specified value was valid.
|
|
|
|
/// </returns>
|
|
|
|
protected virtual Task<bool> ValidateClientSecretAsync( |
|
|
|
[NotNull] string secret, [NotNull] string comparand, CancellationToken cancellationToken) |
|
|
|
[NotNull] string secret, [NotNull] string comparand, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(secret)) |
|
|
|
{ |
|
|
|
|