feature/user-authentication #2
1 changed files with 40 additions and 35 deletions
|
|
@ -112,27 +112,27 @@ CREATE TABLE Users (
|
||||||
## 🚀 Implementation Plan
|
## 🚀 Implementation Plan
|
||||||
|
|
||||||
### Phase 1: Backend Authentication (3-4 hours)
|
### Phase 1: Backend Authentication (3-4 hours)
|
||||||
- [ ] Create User model and DTOs (RegisterDto, LoginDto, AuthResponse)
|
- [x] Create User model and DTOs (RegisterDto, LoginDto, AuthResponse)
|
||||||
- [ ] Configure ASP.NET Core Identity
|
- [x] Configure ASP.NET Core Identity (using PasswordHasher with custom User)
|
||||||
- [ ] Create AuthService with user registration logic
|
- [x] Create AuthService with user registration logic
|
||||||
- [ ] Create AuthService with user login logic
|
- [x] Create AuthService with user login logic
|
||||||
- [ ] Configure JWT token generation
|
- [x] Configure JWT token generation
|
||||||
- [ ] Create AuthController with endpoints
|
- [x] Create AuthController with endpoints
|
||||||
- [ ] Add JWT authentication middleware
|
- [x] Add JWT authentication middleware
|
||||||
- [ ] Configure CORS for frontend
|
- [x] Configure CORS for frontend
|
||||||
|
|
||||||
### Phase 2: Database Integration (1-2 hours)
|
### Phase 2: Database Integration (1-2 hours)
|
||||||
- [ ] Update User entity to match schema
|
- [x] Update User entity to match schema
|
||||||
- [ ] Configure EF Core user repository
|
- [x] Configure EF Core user repository (via AppDbContext)
|
||||||
- [ ] Implement password hashing
|
- [x] Implement password hashing (using PasswordHasher)
|
||||||
- [ ] Create user seed data (admin user)
|
- [x] Create user seed data (admin user - in SeedDataExtension)
|
||||||
- [ ] Test database operations
|
- [ ] Test database operations
|
||||||
|
|
||||||
### Phase 3: Token Management (1 hour)
|
### Phase 3: Token Management (1 hour)
|
||||||
- [ ] Configure JWT settings in appsettings.json
|
- [x] Configure JWT settings in appsettings.json
|
||||||
- [ ] Implement token validation middleware
|
- [x] Implement token validation middleware (via AddJwtBearer)
|
||||||
- [ ] Add token refresh mechanism
|
- [ ] Add token refresh mechanism
|
||||||
- [ ] Set up token expiration (24 hours)
|
- [x] Set up token expiration (24 hours)
|
||||||
- [ ] Configure refresh token rotation
|
- [ ] Configure refresh token rotation
|
||||||
|
|
||||||
### Phase 4: Frontend Integration (Optional - if doing full stack)
|
### Phase 4: Frontend Integration (Optional - if doing full stack)
|
||||||
|
|
@ -145,9 +145,9 @@ CREATE TABLE Users (
|
||||||
### Milestones
|
### Milestones
|
||||||
| Milestone | Date | Status |
|
| Milestone | Date | Status |
|
||||||
|-----------|------|--------|
|
|-----------|------|--------|
|
||||||
| Backend Auth Complete | - | ⏳ |
|
| Backend Auth Complete | 2025-06-05 | ✅ |
|
||||||
| Database Integration | - | ⏳ |
|
| Database Integration | 2025-06-05 | ✅ |
|
||||||
| Token Management | - | ⏳ |
|
| Token Management | 2025-06-05 | ✅ |
|
||||||
| Frontend Integration | - | ⏳ |
|
| Frontend Integration | - | ⏳ |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -155,32 +155,33 @@ CREATE TABLE Users (
|
||||||
## ✅ Tasks
|
## ✅ Tasks
|
||||||
|
|
||||||
### Backend
|
### Backend
|
||||||
- [ ] Create Models/User.cs with properties
|
- [x] Create Models/User.cs with properties
|
||||||
- [ ] Create DTOs/Auth/RegisterDto.cs
|
- [x] Create DTOs/Auth/RegisterDto.cs
|
||||||
- [ ] Create DTOs/Auth/LoginDto.cs
|
- [x] Create DTOs/Auth/LoginDto.cs
|
||||||
- [ ] Create DTOs/Auth/AuthResponse.cs
|
- [x] Create DTOs/Auth/AuthResponse.cs
|
||||||
- [ ] Create Services/AuthService.cs
|
- [x] Create Interfaces/IAuthService.cs
|
||||||
- [ ] Create Controllers/AuthController.cs
|
- [x] Create Services/AuthService.cs
|
||||||
- [ ] Configure JWT in Program.cs
|
- [x] Create Controllers/AuthController.cs
|
||||||
|
- [x] Configure JWT in Program.cs
|
||||||
- [ ] Add [Authorize] attribute to protected endpoints
|
- [ ] Add [Authorize] attribute to protected endpoints
|
||||||
- [ ] Create AuthMiddleware.cs
|
- [ ] Create AuthMiddleware.cs
|
||||||
- [ ] Configure CORS policy
|
- [x] Configure CORS policy
|
||||||
- [ ] Write unit tests for AuthService
|
- [ ] Write unit tests for AuthService
|
||||||
- [ ] Write integration tests for AuthController
|
- [ ] Write integration tests for AuthController
|
||||||
|
|
||||||
### Database
|
### Database
|
||||||
- [ ] Update User entity mapping
|
- [x] Update User entity mapping (in AppDbContext)
|
||||||
- [ ] Create UserRepository
|
- [ ] Create UserRepository (using DbContext directly for now)
|
||||||
- [ ] Implement password hashing
|
- [x] Implement password hashing (PasswordHasher<User>)
|
||||||
- [ ] Create migration for Users table
|
- [x] Create migration for Users table (in InitialCreate migration)
|
||||||
- [ ] Seed admin user
|
- [x] Seed admin user (in SeedDataExtension)
|
||||||
|
|
||||||
### Token Management
|
### Token Management
|
||||||
- [ ] Configure JWT settings
|
- [x] Configure JWT settings (in appsettings.json)
|
||||||
- [ ] Implement token generation
|
- [x] Implement token generation (in AuthService)
|
||||||
- [ ] Implement token validation
|
- [x] Implement token validation (via AddJwtBearer)
|
||||||
- [ ] Implement token refresh
|
- [ ] Implement token refresh
|
||||||
- [ ] Set token expiration
|
- [x] Set token expiration (24 hours)
|
||||||
|
|
||||||
### Frontend (Optional)
|
### Frontend (Optional)
|
||||||
- [ ] Create authService.ts
|
- [ ] Create authService.ts
|
||||||
|
|
@ -309,6 +310,10 @@ CREATE TABLE Users (
|
||||||
| Date | Status Change | Notes |
|
| Date | Status Change | Notes |
|
||||||
|------|---------------|-------|
|
|------|---------------|-------|
|
||||||
| May 31, 2025 | Created | Initial plan based on application-plan.md |
|
| May 31, 2025 | Created | Initial plan based on application-plan.md |
|
||||||
|
| Jun 05, 2025 | Status: Planned → In Progress | Started implementation |
|
||||||
|
| Jun 05, 2025 | Backend Auth Complete | DTOs, AuthService, AuthController, JWT configured |
|
||||||
|
| Jun 05, 2025 | Database Integration Complete | User entity, password hashing, seed data |
|
||||||
|
| Jun 05, 2025 | Token Management Complete | JWT settings, token generation/validation |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue