m3mo 911f192c38 Add JWT-based user authentication to backend
- Create User model with bcrypt password hashing
- Add auth routes: register, login, refresh, me
- Implement JWT access and refresh tokens
- Add get_current_user dependency for protected routes
- Update Task model with user_id foreign key for data isolation
- Update TaskService to filter tasks by authenticated user
- Add auth configuration (secret key, token expiry)
2026-02-02 22:57:38 +01:00

21 lines
475 B
Python

from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
database_url: str = "sqlite:///./tasks.db"
debug: bool = False
secret_key: str = "your-secret-key-change-in-production-min-32-chars"
algorithm: str = "HS256"
access_token_expire_minutes: int = 30
refresh_token_expire_days: int = 7
class Config:
env_file = ".env"
@lru_cache
def get_settings() -> Settings:
return Settings()