1
0
mirror of https://github.com/bitwarden/server synced 2026-01-02 16:43:25 +00:00

fix(identity): [PM-21975] Add Security Stamp claim to persisted grant

* Added Security Stamp claim to refresh_token

* Linting

* Added better comments.

* Added clarification to naming of new method.

* Updated comments.

* Added more comments.

* Misspelling
This commit is contained in:
Todd Martin
2025-05-28 16:44:18 -04:00
committed by GitHub
parent 9ad2d61303
commit fe6181f55f
3 changed files with 83 additions and 33 deletions

View File

@@ -72,6 +72,10 @@ public class ProfileService : IProfileService
public async Task IsActiveAsync(IsActiveContext context)
{
// We add the security stamp claim to the persisted grant when we issue the refresh token.
// IdentityServer will add this claim to the subject, and here we evaluate whether the security stamp that
// was persisted matches the current security stamp of the user. If it does not match, then the user has performed
// an operation that we want to invalidate the refresh token.
var securityTokenClaim = context.Subject?.Claims.FirstOrDefault(c => c.Type == Claims.SecurityStamp);
var user = await _userService.GetUserByPrincipalAsync(context.Subject);