1.5 KiB
1.5 KiB
05. AUTH & IDENTITY SPECIFICATION
Current State (E2E Tested and Verified)
1. Lite Registration Flow
- Endpoint:
POST /auth/register - Logic: Creates a
UserandPersonrecord in theidentityschema. - Initial State: Both
User.is_activeandPerson.is_activeare explicitly set toFalse. The password must meet dynamic complexity requirements defined insystem.system_parameters(auth_password_strict,auth_min_password_length).
2. Email Verification Flow
- Endpoint:
POST /auth/verify-email - Logic: Validates the UUID token from
identity.verification_tokens. - Action: Marks the token as used, and activates both the
UserandPersonrecords (is_active = True).
3. Login & JWT / Cookie Hybrid System
- Endpoint:
POST /auth/login - Logic: Implements the OAuth2 Password Flow. If
remember_me=Trueis provided (via form data), it generates tokens with extended lifespans based on SSoT config (auth_remember_me_days). - Token Delivery:
access_token: Returned in JSON body (Bearer).refresh_token: Returned as a secureHttpOnlycookie withSameSite=laxand dynamicMax-Age.
4. Soft Delete / Anonymization
- Method:
AuthService.soft_delete_user - Logic: The user is NOT physically deleted. The email is anonymized (e.g.,
deleted_[ID]_[DATE]_[original_email]). - State:
is_active = Falseandis_deleted = True. Also performs cascading logic handlingaudit_logsandverification_tokensto respect constraints.