|
|
@ -235,23 +235,21 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
throw new ArgumentException("The client cannot be null or empty.", nameof(client)); |
|
|
throw new ArgumentException("The client cannot be null or empty.", nameof(client)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const string key = nameof(FindAsync) + "\x1e" + nameof(subject) + "\x1e" + nameof(client); |
|
|
|
|
|
|
|
|
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
var query = Cache.GetOrCreate(key, entry => |
|
|
var query = Cache.GetOrCreate("a3235f5b-2be5-452e-a43e-b10f5d6a01ff", entry => |
|
|
{ |
|
|
{ |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
|
|
|
|
|
|
return EF.CompileAsyncQuery((TContext context, TKey id, string principal) => |
|
|
return EF.CompileAsyncQuery((TContext context, TKey key, string principal) => |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
.Include(authorization => authorization.Application) |
|
|
.Include(authorization => authorization.Application) |
|
|
.AsTracking() |
|
|
.AsTracking() |
|
|
where authorization.Subject == principal |
|
|
where authorization.Subject == principal |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
where application.Id.Equals(id) |
|
|
where application.Id.Equals(key) |
|
|
select authorization); |
|
|
select authorization); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -289,23 +287,21 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
throw new ArgumentException("The status cannot be null or empty.", nameof(status)); |
|
|
throw new ArgumentException("The status cannot be null or empty.", nameof(status)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const string key = nameof(FindAsync) + "\x1e" + nameof(subject) + "\x1e" + nameof(client) + "\x1e" + nameof(status); |
|
|
|
|
|
|
|
|
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
var query = Cache.GetOrCreate(key, entry => |
|
|
var query = Cache.GetOrCreate("bdf6b8aa-cd27-4b23-9961-fdd896a6660e", entry => |
|
|
{ |
|
|
{ |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
|
|
|
|
|
|
return EF.CompileAsyncQuery((TContext context, TKey id, string principal, string state) => |
|
|
return EF.CompileAsyncQuery((TContext context, TKey key, string principal, string state) => |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
.Include(authorization => authorization.Application) |
|
|
.Include(authorization => authorization.Application) |
|
|
.AsTracking() |
|
|
.AsTracking() |
|
|
where authorization.Subject == principal && authorization.Status == state |
|
|
where authorization.Subject == principal && authorization.Status == state |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
where application.Id.Equals(id) |
|
|
where application.Id.Equals(key) |
|
|
select authorization); |
|
|
select authorization); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -349,18 +345,15 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
throw new ArgumentException("The type cannot be null or empty.", nameof(type)); |
|
|
throw new ArgumentException("The type cannot be null or empty.", nameof(type)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const string key = nameof(FindAsync) + "\x1e" + nameof(subject) + "\x1e" + |
|
|
|
|
|
nameof(client) + "\x1e" + nameof(status) + "\x1e" + nameof(type); |
|
|
|
|
|
|
|
|
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// filtered using authorization.Application.Id.Equals(key). To work around this issue,
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// this method is overriden to use an explicit join before applying the equality check.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
// See https://github.com/openiddict/openiddict-core/issues/499 for more information.
|
|
|
var query = Cache.GetOrCreate(key, entry => |
|
|
var query = Cache.GetOrCreate("5d06e679-70cd-4f4b-94f7-19ffe9d5d8ab", entry => |
|
|
{ |
|
|
{ |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
|
|
|
|
|
|
return EF.CompileAsyncQuery((TContext context, TKey id, string principal, string state, string kind) => |
|
|
return EF.CompileAsyncQuery((TContext context, TKey key, string principal, string state, string kind) => |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
from authorization in context.Set<TAuthorization>() |
|
|
.Include(authorization => authorization.Application) |
|
|
.Include(authorization => authorization.Application) |
|
|
.AsTracking() |
|
|
.AsTracking() |
|
|
@ -368,7 +361,7 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
authorization.Status == state && |
|
|
authorization.Status == state && |
|
|
authorization.Type == kind |
|
|
authorization.Type == kind |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
join application in context.Set<TApplication>().AsTracking() on authorization.Application.Id equals application.Id |
|
|
where application.Id.Equals(id) |
|
|
where application.Id.Equals(key) |
|
|
select authorization); |
|
|
select authorization); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -392,17 +385,15 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
throw new ArgumentException("The identifier cannot be null or empty.", nameof(identifier)); |
|
|
throw new ArgumentException("The identifier cannot be null or empty.", nameof(identifier)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const string key = nameof(FindByIdAsync) + "\x1e" + nameof(identifier); |
|
|
var query = Cache.GetOrCreate("0f00e136-9277-484a-8ee4-12bf1d889c43", entry => |
|
|
|
|
|
|
|
|
var query = Cache.GetOrCreate(key, entry => |
|
|
|
|
|
{ |
|
|
{ |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
|
|
|
|
|
|
return EF.CompileAsyncQuery((TContext context, TKey id) => |
|
|
return EF.CompileAsyncQuery((TContext context, TKey key) => |
|
|
(from authorization in context.Set<TAuthorization>() |
|
|
(from authorization in context.Set<TAuthorization>() |
|
|
.Include(authorization => authorization.Application) |
|
|
.Include(authorization => authorization.Application) |
|
|
.AsTracking() |
|
|
.AsTracking() |
|
|
where authorization.Id.Equals(id) |
|
|
where authorization.Id.Equals(key) |
|
|
select authorization).FirstOrDefault()); |
|
|
select authorization).FirstOrDefault()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -426,9 +417,7 @@ namespace OpenIddict.EntityFrameworkCore |
|
|
throw new ArgumentException("The subject cannot be null or empty.", nameof(subject)); |
|
|
throw new ArgumentException("The subject cannot be null or empty.", nameof(subject)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const string key = nameof(FindBySubjectAsync) + "\x1e" + nameof(subject); |
|
|
var query = Cache.GetOrCreate("31e53867-fa49-4d1b-b846-acce353acd0b", entry => |
|
|
|
|
|
|
|
|
var query = Cache.GetOrCreate(key, entry => |
|
|
|
|
|
{ |
|
|
{ |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
entry.SetPriority(CacheItemPriority.NeverRemove); |
|
|
|
|
|
|
|
|
|