TorbatYar/backend/services/identity-access
Mortezakoohjani 800b0ba2c5 Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing.
Wire production domain, CORS for tenant subdomains, celery volume mounts, and nginx reverse proxy configs for apex, API, identity, auth, and wildcard tenants.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 21:43:33 +03:30
..
alembic Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
app Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
scripts Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
alembic.ini Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
Dockerfile Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
Dockerfile.dev Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
pytest.ini Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
README.md Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30
requirements.txt Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing. 2026-07-21 21:43:33 +03:30

Identity & Access Service

سرویس احراز هویت و دسترسی (فاز ۲) — SSO مرکزی با Keycloak.

مسئولیت‌ها

  • مدیریت پروفایل کاربر و عضویت tenant
  • ارائه پیکربندی OIDC به frontend
  • تبدیل authorization code به token (BFF)
  • همگام‌سازی کاربران با Keycloak Admin API

دیتابیس

identity_access_db (مستقل از Core — database-per-service)

APIهای اصلی

متد مسیر توضیح
GET /health سلامت سرویس
GET /api/v1/auth/config پیکربندی OIDC (عمومی)
POST /api/v1/auth/token تبدیل code به token
GET /api/v1/auth/me کاربر جاری
POST /api/v1/users ثبت کاربر (admin)
POST /api/v1/tenants/{id}/members افزودن عضو tenant

اجرا

cd backend/services/identity-access
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload --port 8001

تست

pytest -q

SSO Flow

  1. Frontend از /api/v1/auth/config آدرس Keycloak را می‌گیرد.
  2. کاربر به Keycloak redirect می‌شود.
  3. پس از login، callback با code به frontend برمی‌گردد.
  4. Frontend کد را به /api/v1/auth/token می‌فرستد و token دریافت می‌کند.
  5. همه سرویس‌ها (Core، CRM، ...) همان JWT را validate می‌کنند.