- 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)
21 lines
475 B
Python
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()
|