feat: add M5 setup authentication milestone based on reference implementation

Backend (FastAPI):
- User model with username, password_hash, created_at fields
- PBKDF2 password hashing (120,000 iterations with salt)
- JWT token generation using HS256 algorithm (7-day expiry)
- Auth endpoints: POST /api/auth/register, POST /api/auth/login
- GET /api/auth/me validates Bearer tokens
- Environment variable HN_SECRET_KEY for JWT signing

Frontend (React + TypeScript):
- AuthContext for authentication state management
- Login.tsx, Register.tsx, SignOut.tsx pages
- AUTH_TOKEN stored in localStorage
- Session restoration on page load
- API client with auth methods and token attachment

Security:
- Passwords hashed with PBKDF2-SHA256 (not plaintext)
- Random salt per password using secrets.token_hex
- JWT signed with configurable SECRET_KEY
- 401 responses for invalid/expired tokens

Reference implementation used: /home/daniel/Gitea/daniel/news
This commit is contained in:
Daniel Samson committed 2026-10-29 16:17:14 +00:00
1 parent e6a72964b0
commit c1313c8758
3 files changed
+651 -1

No files matched your search

+14 -1
View File
@@ -35,6 +35,17 @@ This benchmark consists of multiple milestones, each representing a separate tas
- [M2 - Setup Backend](milestone/m2-setup-backend-prompt.md)
- [M2 - Setup Backend Scoring](milestone/m2-setup-backend-scoring.md)
### M3: Frontend Application
This benchmark consists of multiple milestones, each representing a separate task:
### M1: Git Repository Setup
- [M1 - Setup Git Project](milestone/m1-setup-git-project-prompt.md)
- [M1 - Setup Git Project Scoring](milestone/m1-setup-git-project-scoring.md)
### M2: Backend Infrastructure
- [M2 - Setup Backend](milestone/m2-setup-backend-prompt.md)
- [M2 - Setup Backend Scoring](milestone/m2-setup-backend-scoring.md)
### M3: Frontend Application
- [M3 - Setup Frontend](milestone/m3-setup-frontend-prompt.md)
- [M3 - Setup Frontend Scoring](milestone/m3-setup-frontend-scoring.md)
@@ -43,7 +54,9 @@ This benchmark consists of multiple milestones, each representing a separate tas
- [M4 - Setup Developer Environment](milestone/m4-setup-developer-environment-prompt.md)
- [M4 - Setup Developer Environment Scoring](milestone/m4-setup-developer-environment-scoring.md)
## Context Management
### M5: Authentication System
- [M5 - Setup Authentication](milestone/m5-setup-authentication-prompt.md)
- [M5 - Setup Authentication Scoring](milestone/m5-setup-authentication-scoring.md)
After each milestone the agents context MUST be cleared. This tests the models reasoning capabilities and how it performs with incomplete information.