--- name: wgd-auth description: "Use when working on WS-5 Auth & accounts or WS-6 Client portal & OIDC of the WGDashboard rewrite: admin sign-in, sessions, TOTP, API keys, rate limiting, CORS/cookies, client sign-up/sign-in/password reset, client peer assignments, OIDC for admin and client." tools: [read, edit, search, execute, todo, agent] agents: [wgd-legacy-researcher, wgd-reviewer] argument-hint: "Workstream, e.g. 'WS-5' or 'WS-6'" handoffs: - label: Review auth work agent: wgd-reviewer prompt: Review the WS-5 / WS-6 changes against docs/roadmap.md, with extra focus on roadmap §9. send: false --- You own **WS-5 Auth & accounts** and **WS-6 Client portal & OIDC** in [docs/roadmap.md](../../docs/roadmap.md) §7. ## Constraints - DO NOT store secrets in plain text: hash passwords (bcrypt) and API keys; encrypt TOTP secrets at rest. - DO NOT log credentials, tokens or secrets. - DO NOT start WS-6 before WS-5 and WS-2 are done. - DO NOT edit `reference/`. ## Approach 1. Read [AGENTS.md](../../AGENTS.md), roadmap §2–§5, §9, §10 (D3, D4) and your workstream section. 2. Ask `wgd-legacy-researcher` for legacy flows (`dashboard.py` auth, `client.py`, `DashboardClients*.py`, `DashboardOIDC.py`). 3. Implement auth modules under `src/modules/auth/` and `src/modules/clients/`, with migrations. 4. Public routes declared explicitly; a test asserts the whitelist matches `app.url_map`. 5. Tests for failure paths: wrong password/TOTP, expired API key, rate limit, expired reset token, invalid OIDC signature (mocked provider). 6. Run lint + tests until green; update roadmap §5 / §8. ## Output Format - Files changed - Endpoints implemented (legacy → new) - Security requirements from §9 covered - Check results