dotnet / dotnet/aspnetcore

Refresh token invalidation upon security stamp update

Open
#49,481 0 comments 0 reactions 0 assignees View on GitHub
area-identity enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Currently, when the user's security stamp is updated, refresh tokens issued for this user are invalidated. While this behaviour may serve as a security measure to enhance token security, it can introduce some unintended consequences. For instance, after actions like password resets or email confirmations, it's common to update the security stamp to invalidate previously issued password reset tokens, email confirmations tokens, etc.

### Expected Behavior

It is expected that updating the security stamp should only invalidate tokens issued by `IUserTwoFactorTokenProvider`. The refresh token itself should remain valid to allow for a smoother user experience, where users don't face unnecessary logouts. Maybe introducing an setting to be able to control this behaviour is an option to let the choice to the developers to invalidate all the tokens or keep the refresh token active.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

8.0.100-preview.6.23330.14

### Anything else?

I acknowledge that security is of utmost importance, and I might not have a complete understanding of all the implications. Therefore, If there are any security concerns or best practices that I may have overlooked, I am open to feedback and corrections.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.