-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
- Description: Refresh tokens are stored in plaintext and refresh flow does not validate sessions or rotate tokens. Hash tokens and implement rotation.
- Current state:
UserSession.refreshTokenstores raw token;AuthController.refresh-tokenonly checks JWT validity, not session state;invalidateexists but rotation is missing. - Tasks:
- Store
refreshTokenHash(e.g., SHA-256) instead of raw token; migrate schema accordingly. - On login: issue refresh token, persist only the hash with expiry and device info.
- On refresh: validate against stored hash and
isValid, then rotate (issue new refresh token, invalidate old session). - On logout/invalidate: mark session invalid by hash.
- Store
- Acceptance criteria:
- Raw refresh token never persisted; rotation works and old token cannot be reused.
- Tests cover valid/invalid/expired/rotated scenarios.
- References:
AuthController.java,UserSession*.java.
Reactions are currently unavailable