|
|
|
@ -19,8 +19,7 @@ public class MongoOpenIddictTokenRepository : MongoDbRepository<OpenIddictMongoD |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public async Task DeleteManyByApplicationIdAsync(Guid applicationId, bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
public virtual async Task DeleteManyByApplicationIdAsync(Guid applicationId, bool autoSave = false, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var tokens = await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
.Where(x => x.ApplicationId == applicationId) |
|
|
|
@ -29,7 +28,7 @@ public class MongoOpenIddictTokenRepository : MongoDbRepository<OpenIddictMongoD |
|
|
|
await DeleteManyAsync(tokens, autoSave, cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task DeleteManyByAuthorizationIdAsync(Guid authorizationId, bool autoSave = false, |
|
|
|
public virtual async Task DeleteManyByAuthorizationIdAsync(Guid authorizationId, bool autoSave = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var tokens = await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
@ -39,6 +38,15 @@ public class MongoOpenIddictTokenRepository : MongoDbRepository<OpenIddictMongoD |
|
|
|
await DeleteManyAsync(tokens, autoSave, GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task DeleteManyByAuthorizationIdsAsync(Guid[] authorizationIds, bool autoSave = false, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var tokens = await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
.Where(x => x.AuthorizationId != null && authorizationIds.Contains(x.AuthorizationId.Value)) |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
|
|
|
|
await DeleteManyAsync(tokens, autoSave, GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<List<OpenIddictToken>> FindAsync(string subject, Guid client, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await Queryable.Where((await GetMongoQueryableAsync(cancellationToken)), x => x.Subject == subject && x.ApplicationId == client) |
|
|
|
@ -100,7 +108,7 @@ public class MongoOpenIddictTokenRepository : MongoDbRepository<OpenIddictMongoD |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<OpenIddictToken>> GetPruneListAsync(DateTime date, int count, CancellationToken cancellationToken = default) |
|
|
|
public virtual async Task<List<OpenIddictToken>> GetPruneListAsync(DateTime date, int count, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var authorizationIds = await (await GetMongoQueryableAsync<OpenIddictAuthorization>(cancellationToken)) |
|
|
|
.Where(x => x.Status != OpenIddictConstants.Statuses.Valid) |
|
|
|
|