|
|
|
@ -31,9 +31,7 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
|
OpenIddictToken, TContext, string> |
|
|
|
where TContext : DbContext |
|
|
|
{ |
|
|
|
public OpenIddictAuthorizationStore( |
|
|
|
[NotNull] TContext context, |
|
|
|
[NotNull] IMemoryCache cache) |
|
|
|
public OpenIddictAuthorizationStore([NotNull] TContext context, [NotNull] IMemoryCache cache) |
|
|
|
: base(context, cache) |
|
|
|
{ |
|
|
|
} |
|
|
|
@ -51,9 +49,7 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
|
where TContext : DbContext |
|
|
|
where TKey : IEquatable<TKey> |
|
|
|
{ |
|
|
|
public OpenIddictAuthorizationStore( |
|
|
|
[NotNull] TContext context, |
|
|
|
[NotNull] IMemoryCache cache) |
|
|
|
public OpenIddictAuthorizationStore([NotNull] TContext context, [NotNull] IMemoryCache cache) |
|
|
|
: base(context, cache) |
|
|
|
{ |
|
|
|
} |
|
|
|
@ -76,9 +72,7 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
|
where TContext : DbContext |
|
|
|
where TKey : IEquatable<TKey> |
|
|
|
{ |
|
|
|
public OpenIddictAuthorizationStore( |
|
|
|
[NotNull] TContext context, |
|
|
|
[NotNull] IMemoryCache cache) |
|
|
|
public OpenIddictAuthorizationStore([NotNull] TContext context, [NotNull] IMemoryCache cache) |
|
|
|
: base(cache) |
|
|
|
{ |
|
|
|
if (context == null) |
|
|
|
@ -359,35 +353,6 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
|
Authorizations, Applications, ConvertIdentifierFromString(client), subject, status, type).ToListAsync(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <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>
|
|
|
|
public override Task<TAuthorization> FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(identifier)) |
|
|
|
{ |
|
|
|
throw new ArgumentException("The identifier cannot be null or empty.", nameof(identifier)); |
|
|
|
} |
|
|
|
|
|
|
|
var authorization = (from entry in Context.ChangeTracker.Entries<TAuthorization>() |
|
|
|
where entry.Entity != null && |
|
|
|
entry.Entity.Id.Equals(ConvertIdentifierFromString(identifier)) |
|
|
|
select entry.Entity).FirstOrDefault(); |
|
|
|
|
|
|
|
if (authorization != null) |
|
|
|
{ |
|
|
|
return Task.FromResult(authorization); |
|
|
|
} |
|
|
|
|
|
|
|
return base.FindByIdAsync(identifier, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Executes the specified query and returns the first element.
|
|
|
|
/// </summary>
|
|
|
|
|