@cavicode/sso-webclient (0.4.0)
Published 2026-09-06 14:16:20 +03:00 by CaviCode
Installation
@cavicode:registry=npm install @cavicode/sso-webclient@0.4.0"@cavicode/sso-webclient": "0.4.0"About this package
CaviCode.SSO.WebClient
Версия 0.4.0: breaking release, согласована с NetClient 0.4.0. См. PROJECT.md, миграцию и индекс документации.
SSO BFF web client for CaviCode Network panels.
Consumes the /auth/* endpoints exposed by CaviCode.SSO.NetClient (server-side BFF).
Does NOT handle OIDC directly — the BFF does all OIDC. This client just consumes the session.
Install
npm install @cavicode/sso-webclient
Usage
import { createPanelAuthApi, type PanelAuthHttpClient } from '@cavicode/sso-webclient'
// http implements get(path), post(path, undefined, { headers }) and rejects non-2xx
const auth = createPanelAuthApi(http)
// Get current user
const user = await auth.getCurrentUser()
// { subject, email, displayName, roles, role }
// Build login URL
const loginUrl = auth.buildLoginUrl('/dashboard')
// Refresh session
const refreshedUser = await auth.refreshSession()
// Logout
const endSessionUrl = await auth.logout(true)
API
createPanelAuthApi(http, options?)— options: rolePriority and pathsgetCurrentUser()—GET /auth/mebuildLoginUrl(returnUrl?, forceLogin?)— builds/auth/login?returnUrl=...refreshSession()—POST /auth/refresh-sessionlogout(federated?)—POST /auth/logout?federated=...pickPrimaryRole(roles, priority?)— pick primary role by prioritynormalizePanelUser(payload, rolePriority?)— normalize user payload
Пустые roles дают role=null. POST refresh/logout передают X-CaviCode-CSRF: 1; adapter обязан сохранить этот заголовок и cookies. Параллельные refresh одного instance объединяются. Пути можно настроить через options.paths.
Dependencies
Development dependencies
| ID | Version |
|---|---|
| typescript | ^5.7.0 |
Keywords
cavicode
sso
oidc
bff
auth
Details
2026-09-06 14:16:20 +03:00
Assets (1)
Versions (2)
View all
npm
3
MIT
latest
4.3 KiB
sso-webclient-0.4.0.tgz
4.3 KiB