Browse Source

Backport the managers changes to OpenIddict 1.x

pull/553/head
Kévin Chalet 8 years ago
parent
commit
854fd5804a
  1. 25
      src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
  2. 40
      src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
  3. 10
      src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
  4. 10
      src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
  5. 4
      src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
  6. 20
      src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
  7. 4
      src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
  8. 4
      src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
  9. 4
      src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
  10. 44
      src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
  11. 4
      src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
  12. 4
      src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs
  13. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs
  14. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs
  15. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs
  16. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs
  17. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs
  18. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs
  19. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs
  20. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs

25
src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs

@ -79,13 +79,10 @@ namespace OpenIddict.Core
/// <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,
/// whose result returns the unique identifier associated with the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public virtual Task<TApplication> 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);
/// <summary>
/// Creates a new application.
@ -96,10 +93,9 @@ namespace OpenIddict.Core
/// <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,
/// whose result returns the unique identifier associated with the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public virtual async Task<TApplication> 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;
}
/// <summary>

40
src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs

@ -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>

10
src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs

@ -78,9 +78,9 @@ namespace OpenIddict.Core
/// <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, whose result returns the scope.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public virtual async Task<TScope> 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;
}
/// <summary>

10
src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs

@ -80,9 +80,9 @@ namespace OpenIddict.Core
/// <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 token.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public virtual async Task<TToken> 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;
}
/// <summary>

4
src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <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, whose result returns the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing application.

20
src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="authorization">The authorization 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>
Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing authorization.
@ -75,6 +75,22 @@ namespace OpenIddict.Core
/// </returns>
Task<ImmutableArray<TAuthorization>> FindAsync([NotNull] string subject, [NotNull] string client, CancellationToken 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>
Task<ImmutableArray<TAuthorization>> FindAsync(
[NotNull] string subject, [NotNull] string client,
ImmutableArray<string> scopes, CancellationToken cancellationToken);
/// <summary>
/// Retrieves an authorization using its unique identifier.
/// </summary>

4
src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <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, whose result returns the scope.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing scope.

4
src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="token">The token 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 token.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
/// <summary>
/// Removes a token.

4
src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs

@ -63,9 +63,9 @@ namespace OpenIddict.Core
/// <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, whose result returns the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public abstract Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing application.

44
src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs

@ -63,9 +63,9 @@ namespace OpenIddict.Core
/// <param name="authorization">The authorization 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 abstract Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing authorization.
@ -112,6 +112,46 @@ namespace OpenIddict.Core
new KeyValuePair<TKey, string>(ConvertIdentifierFromString(client), subject), 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 async 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 cannot be null or empty.", nameof(client));
}
var builder = ImmutableArray.CreateBuilder<TAuthorization>();
foreach (var authorization in await FindAsync(subject, client, cancellationToken))
{
var set = new HashSet<string>(await GetScopesAsync(authorization, cancellationToken), StringComparer.Ordinal);
if (set.IsSupersetOf(scopes))
{
builder.Add(authorization);
}
}
return builder.ToImmutable();
}
/// <summary>
/// Retrieves an authorization using its unique identifier.
/// </summary>

4
src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs

@ -59,9 +59,9 @@ namespace OpenIddict.Core
/// <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, whose result returns the scope.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public abstract Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
/// <summary>
/// Removes an existing scope.

4
src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs

@ -63,9 +63,9 @@ namespace OpenIddict.Core
/// <param name="token">The token 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 token.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public abstract Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
/// <summary>
/// Removes a token.

8
src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework
/// <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, whose result returns the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TApplication> 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);
}
/// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework
/// <param name="authorization">The authorization 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 override async Task<TAuthorization> 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);
}
/// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs

@ -98,9 +98,9 @@ namespace OpenIddict.EntityFramework
/// <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, whose result returns the scope.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TScope> 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);
}
/// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs

@ -117,9 +117,9 @@ namespace OpenIddict.EntityFramework
/// <param name="token">The token 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 token.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TToken> 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);
}
/// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <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, whose result returns the application.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TApplication> 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);
}
/// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="authorization">The authorization 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 override async Task<TAuthorization> 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);
}
/// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs

@ -98,9 +98,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <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, whose result returns the scope.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TScope> 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);
}
/// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs

@ -117,9 +117,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="token">The token 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 token.
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns>
public override async Task<TToken> 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);
}
/// <summary>

Loading…
Cancel
Save