acm-udayton / acm-udayton/ACM-Meeting-Records
[FEATURE] Swap to JWT Authentication
- Lingua principale
- Python
- Stelle
- 7
- Fork
- 2
- Merge medio
- 4g 23h
- PR unite (30g)
- 2
Descrizione
## Feature Description
Switch authentication to use a JWT instead of the existing session-based approach.
Migrate from `flask-login` to `flask-jwt-extended`. Docs on `flask-jwt-extended` can be found at https://flask-jwt-extended.readthedocs.io/en/stable/
## Why It's Worth Implementing
By converting the application authentication to JWT instead of session-based auth, we switch to a more modern authentication approach and prepare for decoupling of the backend and frontend of the application.
---
## Acceptance Criteria & Solution Requirements
*To close this issue, the following must be met (can be finalized in the comments):*
- [ ] 1. Application runs as expected with the new feature integrated seamlessly.
- [ ] 2. Code quality metrics are maintained, and linting has been considered in development.
- [ ] 3. Testing metrics are maintained, and tests have been updated/added wherever relevant during development.
- [ ] 4. Documentation has been updated to reflect the changes made during development.
- [ ] 5. All backend user authentication has been converted to JWT-based authentication.
- [ ] 6. All admin verification at the route level has been converted to a JWT key `is_admin`
- [ ] 7. JWT creation uses a secret key environment variable separate from the global `SECRET_KEY`
- [ ] 8. Access token JWTs are given a short lifespan (~15 minutes)
- [ ] 9. Refresh token JWTs are given a long lifespan (10 days) to reduce login frequency by refreshing the user's access token (and only the access token, not the refresh token as well) when it expires.
- [ ] 10. Add user management option to revoke JWTs (both access and refresh) from the admin dashboard.
- [ ] 11. Automatically remove expired revoked tokens from the database.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
The issue involves migrating from flask-login to flask-jwt-extended. Start by examining the current authentication routes and decorators in the codebase. Look for how sessions are managed and where admin checks occur. The acceptance criteria list specific requirements like token lifespan and revocation; review the flask-jwt-extended documentation for implementing refresh tokens and a token revocation list. Testing will involve updating existing authentication tests and ensuring the admin dashboard can revoke tokens.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- flask, python
- Ambito
- api, authentication, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100