feat(admin-ui): SSO через Keycloak (PKCE, public client)
react-oidc-context + oidc-client-ts. Confidential client тоже работает —
SPA просто не использует client_secret.
- src/auth/oidcConfig.ts — UserManager settings (authority, redirect_uri,
PKCE, automaticSilentRenew). VITE_KEYCLOAK_{URL,REALM,CLIENT_ID} с дефолтами
на nstart realm + ordinis client.
- src/auth/TokenSync.tsx — синкает access_token в localStorage и axios default
header после login/refresh. Existing API код не трогали — interceptor уже
читает localStorage.
Bonus: 401 interceptor триггерит signinSilent → signinRedirect fallback.
- src/auth/AuthBadge.tsx — header'ный бейдж: "Войти" если anonymous, имя +
logout если залогинен.
- main.tsx обёрнут в <AuthProvider>.
- __root.tsx показывает AuthBadge рядом с language switch.
- .env.example с конфигом Keycloak.
- i18n auth.login / auth.logout (RU + EN).
Keycloak client `ordinis` — настроить:
Valid redirect URIs: https://ordinis.k8s.265.nstart.cloud/*,
https://ordinis.k8s.264.nstart.cloud/*,
http://localhost:5173/*
Web Origins: те же + (или "+"), PKCE Code Challenge: S256
This commit is contained in:
@@ -172,6 +172,8 @@ i18n
|
||||
'field.frequency_bands': 'Частотные диапазоны',
|
||||
'loading': 'Загрузка...',
|
||||
'error.failed': 'Не удалось загрузить данные',
|
||||
'auth.login': 'Войти',
|
||||
'auth.logout': 'Выйти',
|
||||
},
|
||||
},
|
||||
'en-US': {
|
||||
@@ -336,6 +338,8 @@ i18n
|
||||
'field.frequency_bands': 'Frequency bands',
|
||||
'loading': 'Loading...',
|
||||
'error.failed': 'Failed to load data',
|
||||
'auth.login': 'Sign in',
|
||||
'auth.logout': 'Sign out',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user