@reflagged/shell 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reflagged/shell",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Shared app shell for Reflagged services — OIDC auth, SSO, app switcher",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -81,6 +81,7 @@ export async function GET(req: Request): Promise<NextResponse> {
81
81
  tenantSlug: asString(claims.tenant_slug),
82
82
  orgSlug: asString(claims.org_slug),
83
83
  orgRole: asString(claims.org_role),
84
+ platformRole: asString(claims.platform_role),
84
85
  accessibleServices,
85
86
  })
86
87
 
@@ -17,6 +17,16 @@ export type OidcSessionToken = {
17
17
  tenantSlug?: string | null
18
18
  orgSlug?: string | null
19
19
  orgRole?: string | null
20
+ /**
21
+ * The platform-wide role (`superadmin` · `reflagged_admin` · `tenant_admin`
22
+ * · `member`), beside `org_role` rather than behind it.
23
+ *
24
+ * `org_role` is emitted as `membership ?? platform`, which drops the second
25
+ * one: a `superadmin` carried as `member` in their own organisation looks
26
+ * like an ordinary member to a service. A service deriving rights from the
27
+ * token would lock them out of their own instance at the next sign-in.
28
+ */
29
+ platformRole?: string | null
20
30
  /** Product keys the user may access; ['*'] = all, [] = none. */
21
31
  accessibleServices?: string[] | null
22
32
  iat: number
@@ -22,6 +22,7 @@ export async function signSessionCookie(
22
22
  tenantSlug?: string | null
23
23
  orgSlug?: string | null
24
24
  orgRole?: string | null
25
+ platformRole?: string | null
25
26
  accessibleServices?: string[] | null
26
27
  },
27
28
  ): Promise<string> {
@@ -36,6 +37,7 @@ export async function signSessionCookie(
36
37
  tenantSlug: payload.tenantSlug ?? null,
37
38
  orgSlug: payload.orgSlug ?? null,
38
39
  orgRole: payload.orgRole ?? null,
40
+ platformRole: payload.platformRole ?? null,
39
41
  accessibleServices: payload.accessibleServices ?? null,
40
42
  })
41
43
  .setProtectedHeader({ alg: ALG })
@@ -65,6 +67,7 @@ export async function verifySessionCookie(
65
67
  tenantSlug: typeof payload.tenantSlug === 'string' ? payload.tenantSlug : null,
66
68
  orgSlug: typeof payload.orgSlug === 'string' ? payload.orgSlug : null,
67
69
  orgRole: typeof payload.orgRole === 'string' ? payload.orgRole : null,
70
+ platformRole: typeof payload.platformRole === 'string' ? payload.platformRole : null,
68
71
  accessibleServices: Array.isArray(payload.accessibleServices)
69
72
  ? (payload.accessibleServices as unknown[]).filter((s): s is string => typeof s === 'string')
70
73
  : null,