Add authentication and session management improvements
Some checks failed
Build and push image / deploy (push) Has been cancelled

Introduce navigation guards for authentication and admin access within routes. Replace localStorage usage with secure token storage via httpOnly cookies, and add token blacklisting upon logout. Enhance token refresh mechanism and session expiration handling to improve security and user experience.
This commit is contained in:
2025-05-21 22:53:29 +01:00
parent dd5817419b
commit e5086ec653
7 changed files with 204 additions and 58 deletions

View File

@@ -238,8 +238,13 @@ REST_FRAMEWORK = {
CORS_ALLOW_ALL_ORIGINS = True
SIMPLE_JWT = {
"ROTATE_REFRESH_TOKENS": True,
"BLACKLIST_AFTER_ROTATION": True,
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=10),
'LEEWAY': timedelta(minutes=5),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'LEEWAY': timedelta(seconds=30),
'ALGORITHM': 'HS256',
'AUDIENCE': 'cbwebreader-users',
'ISSUER': 'cbwebreader',
}
FRONTEND_DIR = os.path.join(BASE_DIR, 'frontend')