Files
Aegis/backend/app/schemas/auth.py
Kitos a4a2adccee
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
feat(phase-39): role-based access control overhaul + forced password change
- Add must_change_password field to User model with migration b023

- Add POST /auth/change-password endpoint with password policy validation

- Add require_password_changed dependency to block requests until password is changed

- Add ChangePasswordModal with live password policy checklist (forced on first login)

- Show password policy in CreateUserModal and EditUserModal

- Fix backend permissions: tests, campaigns, templates, reports, evidence, worklogs

- red_tech/blue_tech: execute only, cannot create tests/campaigns/templates

- red_lead/blue_lead: create/edit tests/campaigns/templates, generate reports, no system access

- viewer: read-only everywhere, can generate reports

- Fix frontend role checks across TestDetailPage, TestDetailHeader, TeamTabs, TestsPage, CampaignsPage, CampaignDetailPage, Sidebar
2026-02-18 10:37:02 +01:00

35 lines
732 B
Python

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