Files
ERP/backend/app/routers/__init__.py
T
ali_mohaghegh 3cd76d335f fix(auth): Casdoor JWT verification and 401 semantics; add /auth/login password-grant endpoint
- verify kid from the JWT header (pyjwt decode() returns claims, not the
  header — the old lookup was always None and rejected every token)
- convert JWK entries to crypto keys explicitly (pyjwt 2.13 dropped dict
  keys) and fetch the JWKS from /.well-known/jwks
- 401 for missing/invalid/expired/wrong-issuer/wrong-audience tokens
  (was 403/400); 403 stays for valid-but-roleless users; 503 when Casdoor
  is unreachable; new CASDOOR_ISSUER setting separates the in-network
  endpoint from the browser-facing issuer
- dev-header fallback in inventory/pm scopes now requires an explicit
  X-User-Role header (no auth info at all -> 401)
- new POST /api/v1/auth/login: password grant against Casdoor, local JWT
  verification, auto-provisioning, returns token + profile with the role
  resolved from the app users table
2026-08-29 14:43:49 +03:30

61 lines
1.2 KiB
Python

"""All API routers, re-exported for main.py assembly."""
from app.routers import (
attribute_definitions,
auth,
brand_materials,
brands,
category_attributes,
category_ref_units,
files,
inventory,
item_decisions,
item_receipts,
item_termsheets,
line_item_specs,
line_items,
material_categories,
materials,
pm,
projects,
quote_events,
quotes,
schedule_steps,
standard_conversions,
supplier_materials,
suppliers,
termsheets,
unit_conversions,
units,
users,
)
ROUTERS = [
auth.router,
units.router,
brands.router,
material_categories.router,
attribute_definitions.router,
category_attributes.router,
materials.router,
brand_materials.router,
suppliers.router,
supplier_materials.router,
projects.router,
quotes.router,
line_items.router,
line_item_specs.router,
termsheets.router,
schedule_steps.router,
item_termsheets.router,
item_decisions.router,
item_receipts.router,
quote_events.router,
files.router,
category_ref_units.router,
unit_conversions.router,
standard_conversions.router,
inventory.router,
pm.router,
users.router,
]