feat(auth): integrate portal JWT for enhanced authentication and authorization
CI / changes (push) Successful in 6s
CI / commitlint (push) Skipped
CI / openapi (push) Successful in 27s
CI / web (push) Successful in 51s
CI / go (push) Successful in 2m19s
CI / bird2 (push) Successful in 13s
CI / release (push) Successful in 4m24s
CI / changes (push) Successful in 6s
CI / commitlint (push) Skipped
CI / openapi (push) Successful in 27s
CI / web (push) Successful in 51s
CI / go (push) Successful in 2m19s
CI / bird2 (push) Successful in 13s
CI / release (push) Successful in 4m24s
Added support for portal JWT authentication, enabling single sign-on (SSO) capabilities. Updated the application to handle JWT claims for user permissions and roles, enhancing security and access control. Refactored relevant components and API routes to accommodate the new authentication flow, ensuring a seamless user experience. Updated documentation to reflect the new authentication requirements and configurations. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -30,8 +30,19 @@ export function normalizeApiToken(raw: string): string {
|
||||
return t
|
||||
}
|
||||
|
||||
/** Portal JWT storage key mirrored from `@/lib/auth`. Kept local to avoid a
|
||||
* cycle when `auth` starts pulling from `api-client` for the config endpoint. */
|
||||
const PORTAL_TOKEN_STORAGE_KEY = 'evobgp_portal_token'
|
||||
|
||||
/**
|
||||
* Bearer selection: portal JWT wins over the legacy API-key. When auth-portal
|
||||
* is disabled or hasn't issued a token yet we fall back to the local API-key
|
||||
* (`evobgp_api_token`) so curl-style tooling keeps working.
|
||||
*/
|
||||
function getToken(): string | null {
|
||||
if (typeof window === 'undefined') return null
|
||||
const portal = window.localStorage.getItem(PORTAL_TOKEN_STORAGE_KEY)
|
||||
if (portal && portal.trim()) return portal.trim()
|
||||
const raw = window.localStorage.getItem(TOKEN_STORAGE_KEY)
|
||||
if (!raw) return null
|
||||
const normalized = normalizeApiToken(raw)
|
||||
|
||||
Reference in New Issue
Block a user