From f28240c37f0df935e3ab91d00502a9fa4a93d700 Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Sun, 1 Mar 2026 00:50:44 +0100 Subject: [PATCH] feat(sso): update User model and schemas for Keycloak --- backend/app/models.py | 3 ++- backend/app/schemas.py | 13 +------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/backend/app/models.py b/backend/app/models.py index 58d513a..86ae5cb 100644 --- a/backend/app/models.py +++ b/backend/app/models.py @@ -12,7 +12,8 @@ class User(Base): id: Mapped[int] = mapped_column(Integer, primary_key=True) username: Mapped[str] = mapped_column(String(64), unique=True, nullable=False) email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False) - hashed_password: Mapped[str] = mapped_column(String(255), nullable=False) + hashed_password: Mapped[str | None] = mapped_column(String(255), nullable=True) + keycloak_sub: Mapped[str | None] = mapped_column(String(255), unique=True, nullable=True) is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False) configs: Mapped[list["Config"]] = relationship("Config", back_populates="owner") diff --git a/backend/app/schemas.py b/backend/app/schemas.py index 54e999c..526fb90 100644 --- a/backend/app/schemas.py +++ b/backend/app/schemas.py @@ -1,15 +1,9 @@ from datetime import datetime from typing import Optional -from pydantic import BaseModel, EmailStr +from pydantic import BaseModel # --- Auth --- -class UserCreate(BaseModel): - username: str - email: EmailStr - password: str - - class UserOut(BaseModel): id: int username: str @@ -19,11 +13,6 @@ class UserOut(BaseModel): model_config = {"from_attributes": True} -class LoginRequest(BaseModel): - username: str - password: str - - # --- Config --- class ConfigCreate(BaseModel): name: str