I have created the official sprint planning document at SPRINT2_PLANNING.md . Below is the required summary of the planning phase. 1. Sprint Objective The objective of Sprint 2 is to implement a secure Authentication & Authorization system for Inveetaire. This provides role-based gateway protection for all portals (couple, crew, and super_admin), session timeout protection, and secure password reset workflows. It transitions the platform from an open, unauthenticated prototype to a secure multi-role system. 2. Task List Pre-checklist (Build Setup): Resolve TD-006 and TD-007 to version Tailwind config and document the standalone build CLI. AUTH-001: Build Login Page and Authentication Logic (Unified login form, credential validation, IP lockout). AUTH-002: Build Logout and Session Destruction (POST /logout, cookie/file deletion). AUTH-004: Build Session Timeout and Regeneration (Auth and Role middleware, absolute and inactivity timeouts). AUTH-003: Build Password Reset Flow (Time-limited tokens, simulated MVP reset email cache, update form). 3. Execution Order Execution follows strict topological dependency: Pre-checklist Build Setup (Commit tailwind.config.js and build scripts, compile CSS to ensure form styles exist). AUTH-001 (Implement AuthController, AuthService, AuthModel, and /login routes). AUTH-002 (Logout action dependent on login mechanism). AUTH-004 (Guards and timeouts dependent on login session data). AUTH-003 (Forgot/reset workflow, utilizing AuthService and AuthModel update patterns). 4. Dependency Summary Pre-requisites: Seeded database tables (roles, users) from PDD v1.0 and populated env config values for timeouts. CSRF & Middleware Integration: POST endpoints bind to the existing CsrfMiddleware (resolved in AF-001). Concrete middleware classes implement MiddlewareInterface and plug into the Sprint 0 MiddlewarePipeline. Database Isolation: Restricts password reset token storage to storage/cache/ JSON payloads to respect the database schema freeze. 5. Risk Summary Lockout Weaknesses / Brute Force: Mitigated by enforcing a temporary IP-based lockout mechanism after 5 incorrect credentials. CSRF Exemption: Mitigated by explicitly routing POST endpoints through CsrfMiddleware. Privilege Escalation: Mitigated by regenerating session IDs upon successful authentication (Session::regenerate()). 6. Technical Debt Impact Resolved in Sprint 2: TD-006 (Build configuration versioning) TD-007 (Build tooling documentation) AF-001 (CSRF route wiring) Intentionally Deferred: TD-002 (CSP — targeted for Sprint 3 pre-checklist) TD-003 (Log rotation — targeted for pre-launch) TD-005 (Google Fonts local serving — targeted for Sprint 2+ non-blocking) 7. Estimated AI Coding Sessions Total Estimated Sessions: 5 coding sessions. Pre-checklist: 0.5 sessions (XS/S) AUTH-001: 2 sessions (M/L) AUTH-002: 1 session (XS) AUTH-004: 1 session (S) AUTH-003: 1 session (M) 8. Definition of Sprint Success Sprint 2 is declared successful when: Login, logout, and password resets are fully operational. Unauthorized paths are correctly intercepted by AuthMiddleware and RoleMiddleware. All session timeout rules (absolute and universal inactivity) are enforced. Build settings are repository-reproducible, and all code passes PHP syntax and output escaping validation checks. Session Metadata Task ID: N/A (Sprint 2 Planning) Summary: Developed and committed the Sprint 2 Planning document. Files Created: SPRINT2_PLANNING.md Files Modified: None Dependencies: None Acceptance Criteria: N/A Security Checklist: N/A Definition of Done: Planning phase complete. Waiting for user's authorization to begin implementation. Read Docx Search Text Search Role Read Adr Search Auth Tasks Read Pdd Search Pdd Sec Db Check