Files
Aegis/backend/app/schemas/auth.py
T
kitos 4dea19cae9
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
feat(users): passwordless user creation via emailed set-password link, display full name instead of username
Admins now create users with a name + email (no password) and role;
a Send Email action (per-user, also reusable for resets) issues a
one-time token and POSTs it to an admin-configurable webhook URL —
intended for a Power Automate flow that delivers the actual email.
The old admin-sets-the-password flow is kept server-side
(LegacyUserCreateWithPassword) but no longer wired into the UI.

Every user-facing surface (top bar, sidebar, user management, audit
log, assignee pickers, dispute notifications) now shows full_name
instead of username, falling back to username when unset.

Also fixes long attack_procedure/expected_detection/suggested_text
text overflowing its container in the template review panels and
Red/Blue team fields (missing break-words on whitespace-pre-wrap
blocks).
2026-07-17 16:58:25 +02:00

58 lines
1.3 KiB
Python

"""Pydantic schemas for authentication endpoints."""
# Import uuid
import uuid
# Import BaseModel from pydantic
from pydantic import BaseModel
# Define class LoginRequest
class LoginRequest(BaseModel):
"""Body for the login endpoint.
Unused directly — we rely on ``OAuth2PasswordRequestForm``, but kept for
documentation and testing purposes.
"""
# username: str
username: str
# password: str
password: str
# Define class TokenResponse
class TokenResponse(BaseModel):
"""Response returned after a successful login."""
# access_token: str
access_token: str
# Assign token_type = "bearer"
token_type: str = "bearer"
# Define class UserOut
class UserOut(BaseModel):
"""Public representation of a user (no password hash)."""
# id: uuid.UUID
id: uuid.UUID
# username: str
username: str
full_name: str | None = None
# Assign email = None
email: str | None = None
# role: str
role: str
# is_active: bool
is_active: bool
# Assign must_change_password = True
must_change_password: bool = True
# Define class Config
class Config:
"""ORM mode configuration for SQLAlchemy model mapping."""
# Assign from_attributes = True
from_attributes = True