feat(auth): enhance JWT claims and app switcher configuration
- Added support for optional tenant IDs in JWT claims for user permissions. - Updated auth routes to include tenant information in the JWT payload. - Enhanced app switcher configuration to handle tenant IDs without exposing them publicly. - Improved documentation for EvoBGP tenant ID integration and its usage in JWT.
This commit is contained in:
@@ -69,7 +69,8 @@ AUTH_REQUIRED=true
|
||||
AUTH_JWT_SECRET=dev-secret-change-me
|
||||
AUTH_ISSUER=https://auth.shnt.top
|
||||
AUTH_PORTAL_URL=http://localhost:5175
|
||||
EVOBGP_PORTAL_TENANT_ID=<uuid tenant>
|
||||
# Опционально, если tenant не задан в portal /admin/apps для bgp:
|
||||
# EVOBGP_PORTAL_TENANT_ID=<uuid tenant>
|
||||
```
|
||||
|
||||
```env
|
||||
@@ -78,10 +79,12 @@ VITE_AUTH_ENABLED=true
|
||||
VITE_AUTH_PORTAL_URL=http://localhost:5175
|
||||
```
|
||||
|
||||
В portal **Админ → Приложения → BGP** укажите **EvoBGP tenant ID** (UUID из БД / лога `DemoIDs` / API-ключа). Он попадёт в JWT как `bgp_tenant_id`. Portal `is_admin` получает полный каталог `bgp:*` в JWT.
|
||||
|
||||
## App Switcher
|
||||
|
||||
Публичный конфиг: `GET {AUTH_PORTAL_URL}/api/v1/app-switcher`.
|
||||
`CURRENT_APP_ID = bgp`. Редактор ссылок — portal `/admin/apps`.
|
||||
Публичный конфиг: `GET {AUTH_PORTAL_URL}/api/v1/app-switcher` (без `tenantId`).
|
||||
`CURRENT_APP_ID = bgp`. Редактор ссылок и tenant — portal `/admin/apps`.
|
||||
|
||||
## Logout (SSO)
|
||||
|
||||
@@ -93,6 +96,6 @@ VITE_AUTH_PORTAL_URL=http://localhost:5175
|
||||
|---------|---------|
|
||||
| 401 на API | Нет/битый Bearer; разные `JWT_SECRET` |
|
||||
| 403 нет доступа к приложению | В portal не выдан app `bgp` |
|
||||
| 403 на раздел | Нет `bgp:<section>:…` |
|
||||
| JWT без tenant | Не задан `EVOBGP_PORTAL_TENANT_ID` |
|
||||
| 403 на раздел | Нет `bgp:<section>:…` (у admin после обновления портала — полный каталог; перелогиньтесь) |
|
||||
| portal tenant not configured | Нет tenant в JWT и нет `EVOBGP_PORTAL_TENANT_ID` |
|
||||
| return_to rejected | origin EvoBGP не в `RETURN_TO_ALLOWLIST` |
|
||||
|
||||
Reference in New Issue
Block a user