-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area/frontendarea/testingdocumentationImprovements or additions to documentationImprovements or additions to documentationtype/sub-issue
Description
📦 Sub-Issue of Epic #208
Part of: #208 (httpOnly Cookie Authentication Migration)
Priority: High
Area: Frontend, Testing, Documentation
Repository: frontend
Goal
Add comprehensive integration tests for the complete httpOnly cookie authentication flow and create developer documentation for the new authentication mechanism.
Acceptance Criteria
- Integration tests for login flow with cookies
- Integration tests for CSRF token handling
- Integration tests for authenticated requests
- Integration tests for logout flow
- Integration tests for CSRF token refresh (419 retry)
- Tests verify no token in localStorage
- Tests verify cookies sent with requests
- Developer migration guide documented
- Code coverage ≥80% for new code
- TypeScript strict mode passes
- ESLint passes
- All tests pass
Implementation Details
New test files:
tests/integration/auth/cookieAuth.test.tstests/integration/auth/csrfProtection.test.ts
Test scenarios:
- Login flow with CSRF token fetch
- Authenticated request with cookies
- Request without cookies fails (401)
- CSRF token included in POST/PUT/PATCH/DELETE
- 419 response triggers CSRF refresh and retry
- Logout clears session
- No token accessible via JavaScript
- Cookies have correct attributes in dev tools
Documentation updates:
- Create
docs/authentication-migration.md - Update
README.mdwith new auth flow - Add migration guide in
CHANGELOG.md - Update developer setup guide
Migration Guide Content:
- Overview of changes (localStorage → httpOnly cookies)
- Security benefits
- Local development setup
- API changes for developers
- Troubleshooting common issues
Dependencies
- Depends on: Frontend PR-1, Frontend PR-2 (implementation must be complete)
- Blocks: None (closes Epic [EPIC] Security: Migrate authentication from localStorage to httpOnly cookies #208)
Testing
npm test -- --coverage
npm run typecheck
npm run lint
npm run buildReferences
- React Testing Library
- Vitest
- Epic: [EPIC] Security: Migrate authentication from localStorage to httpOnly cookies #208 (this PR closes the epic with
Closes #208)
Metadata
Metadata
Assignees
Labels
area/frontendarea/testingdocumentationImprovements or additions to documentationImprovements or additions to documentationtype/sub-issue
Type
Projects
Status
✅ Done