Implement Secure Refresh Token Rotation with Revocation Support

This commit is contained in:
adityachandelgit
2025-04-30 14:24:15 -06:00
committed by Aditya Chandel
parent 277b82263d
commit 2407cf93fa
5 changed files with 113 additions and 24 deletions
@@ -0,0 +1,14 @@
CREATE TABLE refresh_token
(
id BIGINT PRIMARY KEY AUTO_INCREMENT,
user_id BIGINT NOT NULL,
token VARCHAR(512) NOT NULL,
expiry_date TIMESTAMP NOT NULL,
revoked BOOLEAN NOT NULL DEFAULT FALSE,
revocation_date TIMESTAMP NULL,
CONSTRAINT uq_refresh_token UNIQUE (token),
CONSTRAINT fk_refresh_token_user FOREIGN KEY (user_id)
REFERENCES users (id)
ON DELETE CASCADE
);