feat: implement user authentication system with JWT and PostgreSQL

Added comprehensive user management system:
- User registration with validation (3-50 char username, 6+ char password)
- JWT-based authentication with bcrypt password hashing
- Admin authentication with master password
- Password reset workflow with admin flagging
- PostgreSQL repository implementation
- SQLite repository for testing
- Unified authentication service interface

API Endpoints:
- POST /api/v1/auth/register - User registration
- POST /api/v1/auth/login - User/admin authentication
- POST /api/v1/auth/password-reset/request - Request password reset
- POST /api/v1/auth/password-reset/complete - Complete password reset
- POST /api/v1/auth/validate - JWT token validation

Security Features:
- Password hashing with bcrypt
- JWT token generation and validation
- Admin claims in JWT tokens
- Configurable token expiration
- Input validation for all endpoints

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-04-09 00:25:43 +02:00
parent 69e7c44eb2
commit 52a4ce4139
12 changed files with 1723 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# DanceLessonsCoach Configuration
# dance-lessons-coach Configuration
# This file serves as both the default configuration and documentation
# All available options are shown with their default values
@@ -41,8 +41,8 @@ telemetry:
# Format: host:port
otlp_endpoint: "localhost:4317"
# Service name for tracing (default: "DanceLessonsCoach")
service_name: "DanceLessonsCoach"
# Service name for tracing (default: "dance-lessons-coach")
service_name: "dance-lessons-coach"
# Use insecure connection (no TLS) (default: true)
insecure: true
@@ -55,4 +55,36 @@ telemetry:
# Sampling ratio (0.0 to 1.0, default: 1.0)
# Only used with traceidratio and parentbased_traceidratio samplers
ratio: 1.0
ratio: 1.0
# Database configuration (PostgreSQL)
database:
# PostgreSQL host address (default: "localhost")
host: "localhost"
# PostgreSQL port (default: 5432)
port: 5432
# PostgreSQL username (default: "postgres")
user: "postgres"
# PostgreSQL password (default: "postgres")
# Change this for production!
password: "postgres"
# Database name (default: "dance_lessons_coach")
name: "dance_lessons_coach"
# SSL mode (default: "disable")
# Options: "disable", "allow", "prefer", "require", "verify-ca", "verify-full"
ssl_mode: "disable"
# Maximum number of open connections (default: 25)
max_open_conns: 25
# Maximum number of idle connections (default: 5)
max_idle_conns: 5
# Maximum lifetime of connections (default: "1h")
# Format: number + unit (s, m, h)
conn_max_lifetime: 1h