Skip to content

Commit

Permalink
[PM-3570] Adjust refresh token lifetimes (#3697)
Browse files Browse the repository at this point in the history
* adjust refresh token lifetimes

* fix broken grant delete

* Update ApiClient.cs

---------

Co-authored-by: Matt Bishop <[email protected]>
  • Loading branch information
kspearrin and withinfocus authored Feb 8, 2024
1 parent 9ecc479 commit 707347c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Identity/IdentityServer/StaticClientStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public StaticClientStore(GlobalSettings globalSettings)
{
ApiClients = new List<Client>
{
new ApiClient(globalSettings, BitwardenClient.Mobile, 90, 1),
new ApiClient(globalSettings, BitwardenClient.Web, 30, 1),
new ApiClient(globalSettings, BitwardenClient.Mobile, 60, 1),
new ApiClient(globalSettings, BitwardenClient.Web, 7, 1),
new ApiClient(globalSettings, BitwardenClient.Browser, 30, 1),
new ApiClient(globalSettings, BitwardenClient.Desktop, 30, 1),
new ApiClient(globalSettings, BitwardenClient.Cli, 30, 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ public async Task DeleteByKeyAsync(string key)
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = from g in dbContext.Grants
where g.Key == key
select g;
dbContext.Remove(query);
await dbContext.SaveChangesAsync();
await dbContext.Grants.Where(g => g.Key == key).ExecuteDeleteAsync();
}
}

Expand All @@ -32,14 +28,11 @@ public async Task DeleteManyAsync(string subjectId, string sessionId, string cli
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = from g in dbContext.Grants
where g.SubjectId == subjectId &&
g.ClientId == clientId &&
g.SessionId == sessionId &&
g.Type == type
select g;
dbContext.Remove(query);
await dbContext.SaveChangesAsync();
await dbContext.Grants.Where(g =>
g.SubjectId == subjectId &&
g.ClientId == clientId &&
g.SessionId == sessionId &&
g.Type == type).ExecuteDeleteAsync();
}
}

Expand Down

0 comments on commit 707347c

Please sign in to comment.