|
|
|
@ -78,10 +78,9 @@ namespace OpenIddict.Core |
|
|
|
/// <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, whose result returns the authorization.
|
|
|
|
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
|
|
|
|
/// </returns>
|
|
|
|
public virtual async Task<TAuthorization> CreateAsync( |
|
|
|
[NotNull] TAuthorization authorization, CancellationToken cancellationToken = default) |
|
|
|
public virtual async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (authorization == null) |
|
|
|
{ |
|
|
|
@ -98,7 +97,7 @@ namespace OpenIddict.Core |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
return await Store.CreateAsync(authorization, cancellationToken); |
|
|
|
await Store.CreateAsync(authorization, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception exception) |
|
|
|
@ -132,7 +131,9 @@ namespace OpenIddict.Core |
|
|
|
} |
|
|
|
|
|
|
|
await PopulateAsync(authorization, descriptor, cancellationToken); |
|
|
|
return await CreateAsync(authorization, cancellationToken); |
|
|
|
await CreateAsync(authorization, cancellationToken); |
|
|
|
|
|
|
|
return authorization; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -190,6 +191,35 @@ namespace OpenIddict.Core |
|
|
|
return Store.FindAsync(subject, client, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Retrieves the authorizations corresponding to the specified subject, associated with
|
|
|
|
/// the application identifier and for which the specified scopes have been granted.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="subject">The subject associated with the authorization.</param>
|
|
|
|
/// <param name="client">The client associated with the authorization.</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 specified subject/client/scopes.
|
|
|
|
/// </returns>
|
|
|
|
public virtual Task<ImmutableArray<TAuthorization>> FindAsync( |
|
|
|
[NotNull] string subject, [NotNull] string client, |
|
|
|
ImmutableArray<string> scopes, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(subject)) |
|
|
|
{ |
|
|
|
throw new ArgumentException("The subject cannot be null or empty.", nameof(subject)); |
|
|
|
} |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(client)) |
|
|
|
{ |
|
|
|
throw new ArgumentException("The client identifier cannot be null or empty.", nameof(client)); |
|
|
|
} |
|
|
|
|
|
|
|
return Store.FindAsync(subject, client, scopes, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Retrieves an authorization using its unique identifier.
|
|
|
|
/// </summary>
|
|
|
|
|