Simple HTTP Auth designed

This commit is contained in:
aodulov
2025-10-13 17:21:28 +03:00
parent 3e2c3bf9f3
commit 6e587e8aa7
9 changed files with 414 additions and 37 deletions

View File

@@ -0,0 +1,86 @@
# Implementation Plan: Simple HTTP Auth
**Branch**: `005-simple-http-auth` | **Date**: October 13, 2025 | **Spec**: D:/Coding/unisono/specs/005-simple-http-auth/spec.md
**Input**: Feature specification from `/specs/005-simple-http-auth/spec.md`
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow.
## Summary
The feature provides a simple HTTP authentication mechanism for the Single Page Application (SPA). Users will be prompted to enter a passphrase, configured via an `.env` file, to gain access. Access will be preserved for the duration of the browser session. Failed attempts will not be rate-limited, and if the passphrase is missing or invalid in the `.env` file, the application will default to no authentication. Authentication attempts (success/failure) will be logged to a text file. User management, password reset, and multi-factor authentication are explicitly out-of-scope.
## Technical Context
**Language/Version**: Node.js (LTS), TypeScript 5.x
**Primary Dependencies**: React, Material-UI / MUI, WebSocket library, Express.js
**Storage**: Ephemeral server-side storage (in-memory/session store) for encrypted session data, `.env` file for passphrase.
**Testing**: `npm test`
**Target Platform**: Web (SPA)
**Project Type**: Web application (frontend + backend)
**Performance Goals**: No specific target for passphrase validation.
**Constraints**: Access preserved during browser session.
**Scale/Scope**: Simple HTTP authentication for a single SPA.
## Constitution Check
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
The plan aligns with the project constitution:
- **I. Conventions**: The plan adheres to existing project conventions by using Node.js/TypeScript, React, Material-UI, Express.js, and the established `backend/` and `frontend/` structure.
- **II. Libraries/Frameworks**: The plan explicitly lists primary dependencies (React, Material-UI / MUI, WebSocket library, Express.js) which are established in `GEMINI.md`.
- **III. Style & Structure**: The plan follows the existing `backend/` and `frontend/` structure and uses TypeScript, aligning with the project's established patterns.
- **IV. Idiomatic Changes**: The plan proposes changes that integrate naturally within the existing web application structure.
- **V. Comments**: This is a code-level principle, not directly applicable to the plan document itself, but the plan doesn't suggest violating it.
**Quality Gates Alignment:**
- **I. Proactiveness**: The tasks include unit/integration and end-to-end tests for both user stories.
- **II. Verification (Tests)**: The plan specifies `npm test` for testing, consistent with `GEMINI.md`.
- **III. Verification (Standards)**: The plan implies adherence to these standards by using TypeScript and `npm test`.
**Status**: All principles and quality gates are aligned.
## Project Structure
### Documentation (this feature)
```
specs/005-simple-http-auth/
├── plan.md # This file (/speckit.plan command output)
├── research.md # Phase 0 output (/speckit.plan command)
├── data-model.md # Phase 1 output (/speckit.plan command)
├── quickstart.md # Phase 1 output (/speckit.plan command)
├── contracts/ # Phase 1 output (/speckit.plan command)
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
```
### Source Code (repository root)
```
backend/
├── src/
│ ├── models/
│ ├── services/
│ ├── api/
│ └── ws/
└── tests/
frontend/
├── src/
│ ├── components/
│ ├── pages/
│ └── services/
└── tests/
```
**Structure Decision**: The project uses a web application structure with separate `backend/` and `frontend/` directories. The authentication logic will primarily reside in the `backend/` for validation and session management, and the `frontend/` will handle the passphrase input and display.
## Complexity Tracking
*Fill ONLY if Constitution Check has violations that must be justified*
| Violation | Why Needed | Simpler Alternative Rejected Because |
|-----------|------------|-------------------------------------|
| [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
| [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |