2ce7862058
Replace complex JWT + refresh token authentication with simple session-based auth using signed cookies. **Removed:** - JWT token service (jwt_service.py) - Refresh token store (refresh_store.py) - Refresh token model and database table - JWKS fetching and OIDC token verification - python-jose dependency **Added:** - Session service (session.py) with HMAC-SHA256 signed cookies - Auth dependencies module for shared auth logic - Session-based auth endpoints **Updated:** - All API endpoints to use session-based auth - Config: removed JWT settings, added SESSION_SECRET/SESSION_TTL_HOURS - Tests: rewritten for session-based flow - Frontend: no changes needed (already uses cookies) Quality gates: ruff ✓, mypy ✓, typecheck ✓, lint ✓
25 lines
981 B
Python
25 lines
981 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from src.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from src.models.project import Project
|
|
from src.models.ssh_key import SSHKey
|
|
from src.models.user_config import UserConfig
|
|
|
|
|
|
class User(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|
__tablename__ = "users"
|
|
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
authentik_id: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
avatar_url: Mapped[str | None] = mapped_column(String(1024), nullable=True)
|
|
|
|
projects: Mapped[list["Project"]] = relationship(back_populates="owner")
|
|
ssh_keys: Mapped[list["SSHKey"]] = relationship(back_populates="user")
|
|
user_config: Mapped["UserConfig | None"] = relationship(back_populates="user", uselist=False)
|