Add Next.js middleware for route protection (task 5.1)
- Create src/middleware.ts using Auth.js v5 auth() wrapper - Protect /app/* routes: redirect unauthenticated users to /login - Protect /api/* routes (except /api/auth/* and /api/health): return 401 JSON for unauthenticated requests - Redirect authenticated users away from /login and /register to /app - Mark task 5.1 as complete in tasks.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
10e4ec8648
commit
55fd91ff52
2 changed files with 45 additions and 1 deletions
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
## 5. Auth Middleware & Helpers
|
||||
|
||||
- [ ] 5.1 `[sonnet]` Create `proxy.ts` at project root: protect `/app/*` routes (redirect to `/login`), protect `/api/*` except `/api/auth/*` and `/api/health` (return 401), redirect authenticated users from `/login` and `/register` to `/app`
|
||||
- [x] 5.1 `[sonnet]` Create `proxy.ts` at project root: protect `/app/*` routes (redirect to `/login`), protect `/api/*` except `/api/auth/*` and `/api/health` (return 401), redirect authenticated users from `/login` and `/register` to `/app`
|
||||
- [ ] 5.2 `[haiku]` Create `src/lib/auth.ts` with `getAuthUser()` helper that extracts user from Auth.js session
|
||||
|
||||
## 6. User Settings API
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue