diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 6b4e4adb..bd2a28f2 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -79,13 +79,10 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, - /// whose result returns the unique identifier associated with the application. + /// A that can be used to monitor the asynchronous operation. /// - public virtual Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) - { - return CreateAsync(application, /* secret: */ null, cancellationToken); - } + public virtual Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) + => CreateAsync(application, /* secret: */ null, cancellationToken); /// /// Creates a new application. @@ -96,10 +93,9 @@ namespace OpenIddict.Core /// The client secret associated with the application, if applicable. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, - /// whose result returns the unique identifier associated with the application. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync( + public virtual async Task CreateAsync( [NotNull] TApplication application, [CanBeNull] string secret, CancellationToken cancellationToken = default) { @@ -141,7 +137,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(application, cancellationToken); + await Store.CreateAsync(application, cancellationToken); } catch (Exception exception) @@ -183,11 +179,14 @@ namespace OpenIddict.Core if (!string.IsNullOrEmpty(secret)) { await Store.SetClientSecretAsync(application, /* secret: */ null, cancellationToken); - return await CreateAsync(application, secret, cancellationToken); + await CreateAsync(application, secret, cancellationToken); + } + else + { + await CreateAsync(application, cancellationToken); } - - return await CreateAsync(application, cancellationToken); + return application; } /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs index 45b8f820..24eb9a74 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs @@ -78,10 +78,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task 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; } /// @@ -190,6 +191,35 @@ namespace OpenIddict.Core return Store.FindAsync(subject, client, cancellationToken); } + /// + /// Retrieves the authorizations corresponding to the specified subject, associated with + /// the application identifier and for which the specified scopes have been granted. + /// + /// The subject associated with the authorization. + /// The client associated with the authorization. + /// The minimal scopes associated with the authorization. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, whose result + /// returns the authorizations corresponding to the specified subject/client/scopes. + /// + public virtual Task> FindAsync( + [NotNull] string subject, [NotNull] string client, + ImmutableArray 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); + } + /// /// Retrieves an authorization using its unique identifier. /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs index bc410ede..7146c65c 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs @@ -78,9 +78,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default) + public virtual async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default) { if (scope == null) { @@ -89,7 +89,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(scope, cancellationToken); + await Store.CreateAsync(scope, cancellationToken); } catch (Exception exception) @@ -123,7 +123,9 @@ namespace OpenIddict.Core } await PopulateAsync(scope, descriptor, cancellationToken); - return await CreateAsync(scope, cancellationToken); + await CreateAsync(scope, cancellationToken); + + return scope; } /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs index 1336f1cf..22c793dd 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs @@ -80,9 +80,9 @@ namespace OpenIddict.Core /// The token. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default) + public virtual async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default) { if (token == null) { @@ -93,7 +93,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(token, cancellationToken); + await Store.CreateAsync(token, cancellationToken); } catch (Exception exception) @@ -127,7 +127,9 @@ namespace OpenIddict.Core } await PopulateAsync(token, descriptor, cancellationToken); - return await CreateAsync(token, cancellationToken); + await CreateAsync(token, cancellationToken); + + return token; } /// diff --git a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs index 8c87415c..7d44a177 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); /// /// Removes an existing application. diff --git a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs index 639b62c1..2f792847 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); /// /// Removes an existing authorization. @@ -75,6 +75,22 @@ namespace OpenIddict.Core /// Task> FindAsync([NotNull] string subject, [NotNull] string client, CancellationToken cancellationToken); + /// + /// Retrieves the authorizations corresponding to the specified subject, associated with + /// the application identifier and for which the specified scopes have been granted. + /// + /// The subject associated with the authorization. + /// The client associated with the authorization. + /// The minimal scopes associated with the authorization. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, whose result + /// returns the authorizations corresponding to the specified subject/client/scopes. + /// + Task> FindAsync( + [NotNull] string subject, [NotNull] string client, + ImmutableArray scopes, CancellationToken cancellationToken); + /// /// Retrieves an authorization using its unique identifier. /// diff --git a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs index e061433d..8c0a48d7 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); /// /// Removes an existing scope. diff --git a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs index 4c1581bd..11ca3528 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); /// /// Removes a token. diff --git a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs index 5739ac7a..bab9e807 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs @@ -63,9 +63,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); /// /// Removes an existing application. diff --git a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs index f096d33f..aeb5bfbe 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs @@ -63,9 +63,9 @@ namespace OpenIddict.Core /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); /// /// Removes an existing authorization. @@ -112,6 +112,46 @@ namespace OpenIddict.Core new KeyValuePair(ConvertIdentifierFromString(client), subject), cancellationToken); } + /// + /// Retrieves the authorizations corresponding to the specified subject, associated with + /// the application identifier and for which the specified scopes have been granted. + /// + /// The subject associated with the authorization. + /// The client associated with the authorization. + /// The minimal scopes associated with the authorization. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, whose result + /// returns the authorizations corresponding to the specified subject/client/scopes. + /// + public virtual async Task> FindAsync( + [NotNull] string subject, [NotNull] string client, + ImmutableArray 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 cannot be null or empty.", nameof(client)); + } + + var builder = ImmutableArray.CreateBuilder(); + + foreach (var authorization in await FindAsync(subject, client, cancellationToken)) + { + var set = new HashSet(await GetScopesAsync(authorization, cancellationToken), StringComparer.Ordinal); + if (set.IsSupersetOf(scopes)) + { + builder.Add(authorization); + } + } + + return builder.ToImmutable(); + } + /// /// Retrieves an authorization using its unique identifier. /// diff --git a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs index 228495ba..34a753ef 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs @@ -59,9 +59,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); /// /// Removes an existing scope. diff --git a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs index 936343c0..d3c85d59 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs @@ -63,9 +63,9 @@ namespace OpenIddict.Core /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); /// /// Removes a token. diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs index adaaeb7b..057b8592 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) { if (application == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework Applications.Add(application); - await Context.SaveChangesAsync(cancellationToken); - - return application; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs index 00ca7ba5..bf6fe2ed 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) { if (authorization == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework Authorizations.Add(authorization); - await Context.SaveChangesAsync(cancellationToken); - - return authorization; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs index e85f866a..f1c6bb14 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs @@ -98,9 +98,9 @@ namespace OpenIddict.EntityFramework /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) { if (scope == null) { @@ -109,9 +109,7 @@ namespace OpenIddict.EntityFramework Scopes.Add(scope); - await Context.SaveChangesAsync(cancellationToken); - - return scope; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs index 93404579..e140c420 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs @@ -117,9 +117,9 @@ namespace OpenIddict.EntityFramework /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) { if (token == null) { @@ -128,9 +128,7 @@ namespace OpenIddict.EntityFramework Tokens.Add(token); - await Context.SaveChangesAsync(cancellationToken); - - return token; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs index 2d0ed3e0..a5422bf2 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) { if (application == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(application); - await Context.SaveChangesAsync(cancellationToken); - - return application; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs index 1ff755bd..d3b95572 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) { if (authorization == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(authorization); - await Context.SaveChangesAsync(cancellationToken); - - return authorization; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs index b46276e8..e6f85a91 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs @@ -98,9 +98,9 @@ namespace OpenIddict.EntityFrameworkCore /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) { if (scope == null) { @@ -109,9 +109,7 @@ namespace OpenIddict.EntityFrameworkCore Scopes.Add(scope); - await Context.SaveChangesAsync(cancellationToken); - - return scope; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs index 94f83da0..9ed37840 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs @@ -117,9 +117,9 @@ namespace OpenIddict.EntityFrameworkCore /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) { if (token == null) { @@ -128,9 +128,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(token); - await Context.SaveChangesAsync(cancellationToken); - - return token; + return Context.SaveChangesAsync(cancellationToken); } ///