Add Admin Account Enable/Disable Controls with Refresh Token Authentication#149
Open
mohab-elshamy wants to merge 4 commits into
Open
Add Admin Account Enable/Disable Controls with Refresh Token Authentication#149mohab-elshamy wants to merge 4 commits into
mohab-elshamy wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds admin support for enabling and disabling user accounts and introduces refresh-token-based authentication to handle account-status changes securely.
Authentication Design
To support features such as account disabling/enabling and password changes, I considered three approaches:
I selected the third approach as a balance between security and performance. Access tokens expire after 10 minutes, while refresh tokens are validated against the current account status.
When an account is disabled, its refresh tokens are revoked immediately. Any existing access token remains valid only until its short expiration period ends.
Security Improvements
Authentication tokens were moved from
localStorageto secureHttpOnlycookies, reducing the risk of token theft through XSS.The implementation also includes CSRF protection, hashed refresh-token storage, token rotation, revocation, and revoked-token reuse detection.
Main Changes
localStorageto secureHttpOnlycookies.