Skip to content

Commit 430b623

Browse files
authored
feat: Authentication login screen (#24)
1 parent 86e81d0 commit 430b623

42 files changed

Lines changed: 2072 additions & 96 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
bin/
33
obj/
44
dist/
5+
build/
56
out/
67
.artifacts/
78
.dotnet-cli-home/
89
restore*.log
10+
*.log
911

1012
# .NET
1113
*.user

.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
dist/
3+
build/
4+
coverage/
5+
.angular/cache/
6+
bin/
7+
obj/
8+
package-lock.json
9+
yarn.lock
10+
pnpm-lock.yaml
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# GitHub Issue Context
2+
3+
## Source
4+
5+
- Repository: marciomyst/SmartMovieCatalog
6+
- Issue: #23
7+
- URL: https://github.com/marciomyst/SmartMovieCatalog/issues/23
8+
- State: OPEN
9+
- Created: 05/03/2026 19:37:28
10+
- Updated: 05/03/2026 19:44:54
11+
- Milestone: M1 — Core Movie Catalog
12+
13+
## Title
14+
15+
Authentication login screen
16+
17+
## Labels
18+
19+
- type:feature
20+
- priority:high
21+
- area:api
22+
- area:frontend
23+
- area:ui
24+
- area:security
25+
- v1
26+
27+
## Assignees
28+
29+
_No assignees_
30+
31+
32+
33+
## Issue Body
34+
35+
## Summary
36+
37+
Implement and document the Angular authentication login screen for Smart Movie Catalog.
38+
39+
<img width="1338" height="737" alt="Image" src="https://github.com/user-attachments/assets/1580050b-6599-47c0-b4bd-a2fc7736ca96" />
40+
41+
This issue covers the first frontend authentication surface: a dark cinematic login page that authenticates against the existing backend auth API and creates an in-memory frontend session.
42+
43+
## Goal
44+
45+
Allow users to authenticate from the Angular SPA using local email/password credentials and load their current user context before entering authenticated product flows.
46+
47+
## Scope
48+
49+
- Add the authentication login screen as the current SPA entry surface.
50+
- Keep the UI aligned with `frontend/DESIGN.md`: dark mode, cinematic visual direction, responsive layout, and Material Symbols icons.
51+
- Use an Angular reactive form with client-side validation for email and password.
52+
- Consume `POST /api/auth/authenticate` through a typed frontend API service.
53+
- After successful authentication, call `GET /api/auth/me` using the returned bearer token.
54+
- Keep `HttpClient` calls isolated outside UI components.
55+
- Store the authenticated session in memory only through an auth session store.
56+
- Map backend `400 ValidationProblemDetails` to field-level frontend validation feedback.
57+
- Keep backend `401 Unauthorized` responses generic in the UI to avoid account enumeration.
58+
- Update documentation for frontend auth structure, security posture, API consumption, testing, and ADR coverage.
59+
60+
## API Usage
61+
62+
```http
63+
POST /api/auth/authenticate
64+
```
65+
66+
Request:
67+
68+
```json
69+
{ "email": "user@example.com", "password": "Password123!" }
70+
```
71+
72+
Successful login then calls:
73+
74+
```http
75+
GET /api/auth/me
76+
Authorization: Bearer <accessToken>
77+
```
78+
79+
Local Angular development should use same-origin `/api` paths through `frontend/src/proxy.conf.js`.
80+
81+
## Acceptance Criteria
82+
83+
- Login screen renders as the SPA entry screen.
84+
- The page is responsive on mobile and desktop.
85+
- Email and password fields use Angular reactive form validation.
86+
- Password visibility can be toggled with an accessible icon button.
87+
- Submit calls `POST /api/auth/authenticate` with `email` and `password`.
88+
- Successful authentication calls `GET /api/auth/me` with the bearer token.
89+
- Successful authentication stores `accessToken`, `accessTokenExpiresAtUtc`, and current user data in memory.
90+
- Bearer token is not persisted in `localStorage` or `sessionStorage`.
91+
- `400 ValidationProblemDetails` displays field-level feedback.
92+
- `401 Unauthorized` displays a generic authentication error.
93+
- UI components do not call `HttpClient` directly.
94+
- Frontend auth contracts stay aligned with `SmartMovieCatalog.Contracts.Auth`.
95+
- Tests cover rendering, validation, password visibility, API calls, bearer header behavior, and unauthorized errors.
96+
- Documentation reflects the implemented auth screen and in-memory session strategy.
97+
98+
## Technical Notes
99+
100+
- Frontend auth code should live under `frontend/src/app/auth`.
101+
- Use typed API boundaries such as `AuthApi` and `auth.models.ts`.
102+
- Use an in-memory session store rather than browser storage.
103+
- Keep `/api` as the frontend request base so the same code works with Angular proxy locally and ASP.NET Core SPA hosting in runtime.
104+
- Any persistent session or refresh-token behavior requires a separate security decision.
105+
106+
## Out of Scope
107+
108+
- Refresh tokens.
109+
- Persistent browser sessions.
110+
- Route guards and authenticated app shell navigation.
111+
- Logout flow.
112+
- Registration.
113+
- Password recovery.
114+
- External identity providers.
115+
- Role-specific authorization UI.
116+
117+
118+
## Comments
119+
120+
_No comments_
121+
122+
## Instructions for Spec Kit
123+
124+
Use this GitHub issue as the primary source of truth.
125+
126+
Convert the issue into a Spec Kit feature specification before creating the implementation plan.
127+
128+
Preserve:
129+
130+
- business goal;
131+
- user stories;
132+
- acceptance criteria;
133+
- technical constraints;
134+
- non-goals;
135+
- dependencies;
136+
- open questions.
137+
138+
If information is missing, add it under a clearly marked **Clarifications Needed** section instead of inventing requirements.
139+
140+
If the issue conflicts with existing project documentation, explicitly call out the conflict.
141+
142+
Prefer a small, incremental implementation plan aligned with the repository's existing architecture, folder structure, language, framework, and conventions.

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Do not read, modify, or base analysis on generated/vendor output unless explicit
127127
- `test:`
128128

129129
<!-- SPECKIT START -->
130-
Current Spec Kit plan: `specs/021-backend-authentication-with-jwt-and-current-user-context/plan.md`.
130+
Current Spec Kit plan: `specs/023-authentication-login-screen/plan.md`.
131131

132132
Before using Spec Kit skills, read `.specify/memory/constitution.md`.
133133
If the spec, plan, or implementation touches backend, API, contracts, domain,

CONTEXT.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AI Flix - Global Monorepo Context
1+
# Smart Movie Catalog - Global Monorepo Context
22

33
This repository contains an ASP.NET Core backend and an Angular frontend.
44

@@ -8,7 +8,7 @@ Use this file to prevent context bleeding between backend and frontend work.
88
- Backend files live under `backend/src`.
99
- Before changing backend behavior, inspect the relevant C# project and layer.
1010
- The backend uses Clean Architecture projects: Api, Application, Domain, Infrastructure, and Contracts.
11-
- Do not assume CQRS, EF Core, PostgreSQL, or messaging infrastructure unless they exist in the codebase or the user explicitly requests that architecture.
11+
- EF Core/PostgreSQL persistence, JWT authentication, and Wolverine in-process CQRS exist in the backend. Do not assume distributed messaging, additional persistence stores, or external services unless they exist in the codebase or the user explicitly requests that architecture.
1212
- Keep backend code focused on explicit boundaries, clear request handling, dependency injection, configuration hygiene, and nullable-safe C#.
1313
- Do not put secrets in `appsettings*.json`, Dockerfiles, source files, or committed documentation.
1414

@@ -17,6 +17,7 @@ Use this file to prevent context bleeding between backend and frontend work.
1717
- Before changing UI, HTML, CSS, or TypeScript components, read `frontend/DESIGN.md`.
1818
- Follow the existing Angular project conventions and dependencies in `frontend/package.json`.
1919
- Do not introduce external component libraries, custom palettes, or unrelated visual systems without explicit approval.
20+
- Auth UI and API access live under `frontend/src/app/auth`; components must not call `HttpClient` directly.
2021

2122
## 3. Generated And Vendor Paths
2223
Do not read or modify these paths unless explicitly required:

DESIGN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Design
22

3-
This file defines the root-level product design policy for AI Flix / SmartMovieCatalog.
3+
This file defines the root-level product design policy for Smart Movie Catalog / SmartMovieCatalog.
44

55
For implementation-level frontend tokens and component rules, read:
66

@@ -32,7 +32,7 @@ If these documents conflict, prefer the most specific document:
3232

3333
## Visual Rules
3434
- Use dark mode as the default and only supported visual mode unless a light theme is explicitly added.
35-
- Follow the Tailwind-based palette and token rules in `frontend/DESIGN.md`.
35+
- Follow the Tailwind-inspired palette and token rules in `frontend/DESIGN.md`. The current Angular project uses local CSS for those tokens until Tailwind is added as a project dependency.
3636
- Do not introduce a separate color palette, component library, or visual framework without approval.
3737
- Prefer real movie/media imagery or durable product assets over abstract decorative graphics.
3838
- Avoid visual clutter, excessive gradients, nested cards, and ornamental backgrounds.

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# AI Flix / SmartMovieCatalog
1+
# Smart Movie Catalog / SmartMovieCatalog
22

3-
AI Flix is an early-stage movie catalog application with an ASP.NET Core backend and an Angular frontend.
3+
Smart Movie Catalog is an early-stage movie catalog application with an ASP.NET Core backend and an Angular frontend.
44

55
## Stack
66
- Backend: ASP.NET Core 10 / C# in `backend/src/SmartMovieCatalog.Api`.
77
- Frontend: Angular 21 / TypeScript in `frontend`.
88
- SPA integration: ASP.NET Core SpaProxy.
99
- Solution: `SmartMovieCatalog.slnx`.
1010

11-
Do not assume persistence, CQRS, DDD layers, messaging, authentication, or AI-provider integration until those choices are implemented or documented through an architecture decision.
11+
Persistence, local JWT authentication, Clean Architecture layers, and Wolverine-based in-process CQRS are implemented and documented. Do not assume external messaging, refresh tokens, registration, password recovery, or AI-provider integration until those choices are implemented or documented through an architecture decision.
1212

1313
## Repository Layout
1414
```text
@@ -93,6 +93,8 @@ The backend auth endpoints are:
9393
- `POST /api/auth/authenticate`
9494
- `GET /api/auth/me`
9595

96+
The Angular login screen is available at the SPA root. It calls `POST /api/auth/authenticate`, then `GET /api/auth/me`, through same-origin `/api` routes. In local frontend development, `frontend/src/proxy.conf.js` proxies `/api` to the backend.
97+
9698
Health check:
9799

98100
```bash
@@ -103,7 +105,7 @@ From `frontend`:
103105

104106
```bash
105107
npm run build
106-
npm test
108+
npm test -- --watch=false
107109
npm start
108110
```
109111

@@ -156,6 +158,7 @@ docker compose up -d --force-recreate api
156158
- Backend HTTP endpoints: Minimal API feature slices under `backend/src/SmartMovieCatalog.Api/Features`.
157159
- Auth endpoint mapping: `backend/src/SmartMovieCatalog.Api/Features/Auth`.
158160
- Frontend application: `frontend/src/app`.
161+
- Frontend auth module: `frontend/src/app/auth`.
159162
- Frontend visual system: `frontend/DESIGN.md`.
160163
- Root design policy: `DESIGN.md`.
161164

SmartMovieCatalog.slnx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
<Solution>
2-
<Project Path="frontend/Smartmoviecatalog.Angular.esproj">
3-
<Build />
4-
<Deploy />
5-
</Project>
6-
<Project Path="backend/src/SmartMovieCatalog.Application/SmartMovieCatalog.Application.csproj" />
7-
<Project Path="backend/src/SmartMovieCatalog.Api/SmartMovieCatalog.Api.csproj" />
8-
<Project Path="backend/src/SmartMovieCatalog.Contracts/SmartMovieCatalog.Contracts.csproj" />
9-
<Project Path="backend/src/SmartMovieCatalog.Domain/SmartMovieCatalog.Domain.csproj" />
10-
<Project Path="backend/src/SmartMovieCatalog.Infrastructure/SmartMovieCatalog.Infrastructure.csproj" />
11-
<Project Path="backend/tests/SmartMovieCatalog.Api.Tests/SmartMovieCatalog.Api.Tests.csproj" />
12-
<Project Path="backend/tests/SmartMovieCatalog.Application.Tests/SmartMovieCatalog.Application.Tests.csproj" />
13-
<Project Path="backend/tests/SmartMovieCatalog.Domain.Tests/SmartMovieCatalog.Domain.Tests.csproj" />
14-
<Project Path="backend/tests/SmartMovieCatalog.Infrastructure.Tests/SmartMovieCatalog.Infrastructure.Tests.csproj" />
2+
<Folder Name="/src/">
3+
<Project Path="backend/src/SmartMovieCatalog.Api/SmartMovieCatalog.Api.csproj" />
4+
<Project Path="backend/src/SmartMovieCatalog.Application/SmartMovieCatalog.Application.csproj" />
5+
<Project Path="backend/src/SmartMovieCatalog.Contracts/SmartMovieCatalog.Contracts.csproj" />
6+
<Project Path="backend/src/SmartMovieCatalog.Domain/SmartMovieCatalog.Domain.csproj" />
7+
<Project Path="backend/src/SmartMovieCatalog.Infrastructure/SmartMovieCatalog.Infrastructure.csproj" />
8+
</Folder>
9+
<Folder Name="/tests/">
10+
<Project Path="backend/tests/SmartMovieCatalog.Api.Tests/SmartMovieCatalog.Api.Tests.csproj" />
11+
<Project Path="backend/tests/SmartMovieCatalog.Application.Tests/SmartMovieCatalog.Application.Tests.csproj" />
12+
<Project Path="backend/tests/SmartMovieCatalog.Domain.Tests/SmartMovieCatalog.Domain.Tests.csproj" />
13+
<Project Path="backend/tests/SmartMovieCatalog.Infrastructure.Tests/SmartMovieCatalog.Infrastructure.Tests.csproj" />
14+
<Project Path="frontend/Smartmoviecatalog.Angular.esproj">
15+
<Build />
16+
<Deploy />
17+
</Project>
18+
</Folder>
1519
</Solution>

backend/src/SmartMovieCatalog.Api/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ COPY ["frontend/Smartmoviecatalog.Angular.esproj", "frontend/"]
3535
COPY ["frontend/package.json", "frontend/"]
3636
COPY ["frontend/package-lock.json", "frontend/"]
3737

38+
COPY ["Directory.Packages.props", "."]
39+
COPY ["Directory.Build.props", "."]
40+
3841
RUN dotnet restore "./backend/src/SmartMovieCatalog.Api/SmartMovieCatalog.Api.csproj" --disable-parallel
3942
COPY . .
4043

docs/API.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Returns `200 OK` with:
5757

5858
Missing, malformed, expired, incorrectly signed, missing-user, inactive-user, and removed-user tokens return `401 Unauthorized` as `ProblemDetails`.
5959

60+
## Frontend Consumption
61+
- The Angular login module calls `POST /api/auth/authenticate` with `email` and `password`.
62+
- On successful authentication, it calls `GET /api/auth/me` using the returned bearer token.
63+
- The frontend relies on same-origin `/api` paths. During local `ng serve`, `frontend/src/proxy.conf.js` forwards `/api` to the backend.
64+
- The frontend maps `400 ValidationProblemDetails` to field-level validation and keeps `401 ProblemDetails` generic to avoid account enumeration.
65+
6066
## API Design Rules
6167
- Keep endpoint contracts explicit and stable.
6268
- Use request and response DTOs for public API contracts when behavior grows beyond scaffold examples.

0 commit comments

Comments
 (0)