doc: auth architecture with management paths and key decisions #200
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api!200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "145-doc-auth-architecture"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Documents the complete auth architecture for Westside Basketball, including the three auth management paths and key architectural decisions. Prevents future sessions from rebuilding what Keycloak already provides (hours spent on custom password reset before realizing Keycloak's admin/account consoles exist).
Changes
docs/auth-architecture.md— New file. Complete auth architecture document covering:Test Plan
auth.py,password_reset.py,keycloak.py,config.py)arch-auth-westside-basketballviacreate_block/update_blockReview Checklist
Related Notes
arch-auth-westside-basketball(Auth Management Paths + Key Decisions subsections)PR #200 Review
DOMAIN REVIEW
Stack: Documentation only (Markdown). No code changes. The document describes a Python/FastAPI/Keycloak auth architecture.
Since this is a pure documentation PR, the review focuses on accuracy against the codebase and completeness against the issue's acceptance criteria.
Accuracy verification -- I read the referenced source files and cross-checked every factual claim:
get_current_userreturnsUser(sub, email, username, roles)auth.py:27-33, 75-157require_role("admin")factory patternauth.py:160-181issauth.py:128-143kidauth.py:111-119create_account_for_parent()flow: token, create (no password), emailVerified:True, role, execute-actions-emailservices/keycloak.py:253-332draneylucas@gmail.com,mldraney3@gmail.comservices/keycloak.py:23determine_role()returns 'admin' or 'player'services/keycloak.py:184-197secrets.token_urlsafe(32)for reset tokensroutes/password_reset.py:86password_reset_tokenstable, 1-hour expiry, single-usemodels.py:371,routes/password_reset.py:35,190reset_parent_password()via Admin API PUT withtemporary: falseservices/keycloak.py:200-250send_password_reset_email()inservices/email.pyservices/email.py:1016All factual claims in the document match the codebase. The architecture diagram, flow descriptions, URL table, role matrix, and decision rationale are all accurate.
BLOCKERS
None.
This is a documentation-only PR (182 additions, 0 deletions, 1 file:
docs/auth-architecture.md). No code changes means the standard BLOCKER criteria (test coverage, input validation, secrets, DRY) do not apply. No secrets or credentials appear in the document -- only Tailscale funnel URLs and email addresses already present in source code.NITS
Minor URL inconsistency: The document states the internal cluster URL as
http://keycloak.keycloak.svc.cluster.local:80(Key URLs table), butconfig.pyline 16 defineskeycloak_admin_urlashttp://keycloak.keycloak.svc.cluster.local(no explicit:80). Meanwhilekeycloak_realm_urlon config.py line 10-12 does include:80. Functionally identical (port 80 is default HTTP), but the document could note both forms exist in config to prevent future confusion.Account lifecycle trigger simplification: The document says "Parent completes Stripe checkout" as the trigger for
create_account_for_parent(). In reality, it is called from three places:routes/register.py(direct paid registration),routes/register.py(promo code paid registration), androutes/webhooks.py(Stripe webhook for pending registrations). The summary is not wrong, but a parenthetical noting "called from both registration routes and the Stripe webhook handler" would be more precise for future developers.Missing
coachrole assignment path: The document correctly states "Thecoachrole exists in Keycloak but is assigned manually via the admin console, not during auto-provisioning." This is accurate perdetermine_role()which only returns 'admin' or 'player'. Good documentation of a non-obvious gap.SOP COMPLIANCE
145-doc-auth-architecturematches issue #145)Closes #145) and related issues (#132, #144)PROCESS OBSERVATIONS
arch-auth-westside-basketball) and states "keep both in sync." This creates a future maintenance burden. The PR test plan includes Betty Sue porting to pal-e-docs, which addresses the initial sync.VERDICT: APPROVED