@owlmeans/oidc 0.1.18-rc.2 → 0.1.18-rc.24

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/README.md CHANGED
@@ -1,33 +1,34 @@
1
1
  # @owlmeans/oidc
2
2
 
3
- Shared OIDC protocol abstractions — guard/gate aliases, models, and module declarations used by both server and browser OIDC packages.
3
+ Shared OIDC protocol abstractions — guard/gate aliases, models, and entrypoint declarations used by both server and browser OIDC packages.
4
4
 
5
5
  ## Overview
6
6
 
7
- - `OIDC_GATE` — gate alias to compose with `gate(...)` inside `guard(...)` declarations
7
+ - `OIDC_GATE` — gate alias to put in a protocol's `gate` option
8
8
  - `OIDC_GUARD`, `WRAPPED_OIDC`, `OIDC_FLOW`, `OIDC_AUTHEN_MODULE`, `OIDC_WRAPPED_TOKEN` — shared aliases
9
9
  - `OidcGuard`, `WithSharedConfig`, `OidcProviderConfig` — shared types
10
- - Module declarations for the OIDC dispatcher (`/authenticate/oidc/init`, `/authenticate/oidc/process`)
10
+ - Entrypoint declarations for the OIDC dispatcher (`/authenticate/oidc/init`, `/authenticate/oidc/process`)
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/oidc
15
+ bun add @owlmeans/oidc@^0.1.18-rc.24
16
16
  ```
17
17
 
18
18
  ## Usage
19
19
 
20
- Compose `OIDC_GATE` into a guard on a module:
20
+ Compose `OIDC_GATE` into a protocol declaration:
21
21
 
22
22
  ```typescript
23
- import { module, guard, gate } from '@owlmeans/module'
23
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
24
24
  import { route } from '@owlmeans/route'
25
25
  import { DEFAULT_GUARD } from '@owlmeans/auth-common'
26
26
  import { OIDC_GATE } from '@owlmeans/oidc'
27
27
 
28
- module(
28
+ protocol(
29
29
  route(manager.back.account.base, '/account'),
30
- guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
30
+ contract(typed<Account>()),
31
+ { guards: DEFAULT_GUARD, gate: { alias: OIDC_GATE, params: [`my-service-account-{entity}`] } },
31
32
  )
32
33
  ```
33
34
 
@@ -56,7 +57,7 @@ import { OIDC_GUARD } from '@owlmeans/oidc'
56
57
  - `WRAPPED_OIDC` — `'wrapped-oidc-authz'`
57
58
  - `OIDC_AUTHEN_MODULE` — `'iam-oidc-authen'`
58
59
  - `OIDC_WRAPPED_TOKEN` — `'oidc-wrapped-token'`
59
- - `DISPATCHER_OIDC`, `DISPATCHER_OIDC_INIT` — auth dispatcher module aliases
60
+ - `DISPATCHER_OIDC`, `DISPATCHER_OIDC_INIT` — auth dispatcher entrypoint aliases
60
61
  - `INTERACTION`, `INTERACTION_PATH` — interaction route aliases
61
62
  - `OIDC_GUARD_CACHE` — guard cache resource alias
62
63
 
@@ -73,9 +74,9 @@ import { OIDC_GUARD } from '@owlmeans/oidc'
73
74
  - `GOOGLE_CLIENT_AUTH` identifies the browser Google auth plugin registered by `@owlmeans/web-oidc-rp/auth/plugins`.
74
75
  - `OIDC_GATE` is for OIDC-backed authorization. Apps that only use Google/OIDC for login and authorize against local identity records should define their own product gate alias.
75
76
 
76
- ### `modules`
77
+ ### `entrypoints`
77
78
 
78
- Array of dispatcher module declarations: `POST /authenticate/oidc/init` and `POST /authenticate/oidc/process`.
79
+ Array of dispatcher entrypoint declarations: `POST /authenticate/oidc/init` and `POST /authenticate/oidc/process`.
79
80
 
80
81
  ## Related Packages
81
82
 
@@ -92,7 +93,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
92
93
  your project's skill store (`.agents/skills/`):
93
94
 
94
95
  ```sh
95
- npx @owlmeans/agent-skills
96
+ npx @owlmeans/agent-skills@^0.1.18-rc.15
96
97
  ```
97
98
 
98
99
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/oidc",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.507Z",
4
+ "version": "0.1.18-rc.24",
5
+ "generatedAt": "2026-09-12T08:39:52.725Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oidc
3
- description: How to use @owlmeans/oidc — shared OIDC protocol abstractions including OIDC_GATE constant used in module gate() declarations. Auto-invoked when importing OIDC types/constants or wiring OIDC into a guard().
3
+ description: How to use @owlmeans/oidc — the OIDC names both sides share — the OIDC_GATE alias, the guard, the requested-scope contract, provider descriptors, the dispatcher entrypoints and the error query params. Auto-invoked when importing OIDC types or constants, wiring OIDC into a protocol gate, or declaring an identity provider in configuration.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,60 +8,105 @@ user-invocable: false
8
8
  # @owlmeans/oidc
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/oidc": "^0.1.18-rc.0"` in `dependencies`
11
+ **Install:** `"@owlmeans/oidc": "^0.1.18-rc.24"` in `dependencies`
12
+
13
+ The shared half of the OIDC stack: no transport, no library. It owns the names, the shapes and the
14
+ guard that the server relying party (`@owlmeans/server-oidc-rp`), the browser relying party
15
+ (`@owlmeans/web-oidc-rp`) and the embedded provider (`@owlmeans/server-oidc-provider`) must agree on.
12
16
 
13
17
  ## Key Exports
14
18
 
15
19
  | Export | Description |
16
20
  |--------|-------------|
17
- | `OIDC_GATE` | Gate alias to pass to `gate(...)` inside `guard(...)` |
18
- | `GOOGLE_CLIENT_AUTH` | Client auth plugin type for Google OAuth |
19
- | `GOOGLE_SERVICE` | Provider service key for Google (`'google'`) |
21
+ | `OIDC_GATE` | Gate alias to pass in a protocol's `gate` option |
22
+ | `OIDC_GUARD` | The guard's alias |
23
+ | `OIDC_GUARD_CACHE` | A resource-alias constant nothing reads — the guard has no cache lookup, so registering a resource under it changes no behaviour |
24
+ | `makeOidcGuard(opts?)` / `appendOidcGuard(context, opts?)` | The wrapped-token guard, and its registration. The target-specific packages wrap these |
25
+ | `withOidcGuard(protocolTree, coguards?)` | Returns a decorated immutable protocol tree, prepending `OIDC_GUARD` to selected guarded declarations (default `DEFAULT_GUARD`) |
26
+ | `oidcProtocols` | Shared dispatcher declarations: `DISPATCHER_OIDC_INIT` (`POST /authenticate/oidc/init`) and `DISPATCHER_OIDC` (`POST /authenticate/oidc/process`) |
27
+ | `DISPATCHER_OIDC_INIT`, `DISPATCHER_OIDC` | Their aliases |
28
+ | `OIDC_WRAPPED_TOKEN`, `WRAPPED_OIDC` | The authorization-header scheme for an OIDC-wrapped token, and the service alias that refreshes one |
29
+ | `OIDC_CLIENT_AUTH`, `GOOGLE_CLIENT_AUTH` | Authentication plugin types — the generic OIDC one and the Google one |
30
+ | `GOOGLE_SERVICE` | Provider service value for Google (`'google'`) |
20
31
  | `OIDC_RP_BASE_SCOPES` / `OIDC_RP_BASE_SCOPE` | The scopes every OwlMeans RP requests, as array / space-delimited string |
21
- | `EMAIL_SCOPE`, `PERMISSIONS_SCOPE`, `PERMISSIONS_CLAIM` | Standard email scope; the integrated-IAM grant scope and its claim |
22
- | `OIDC_ERROR_QUERY`, `OIDC_ERROR_DESCRIPTION_QUERY` | Redirect-URI params an authorization server sets on failure |
23
- | `INTERACTION`, `INTERACTION_PATH`, `INTERACTION_UID` | Interaction screen entrypoint alias, path, and its uid path param |
24
- | `OidcProviderDescriptor` | Shared provider config shape, including service, endpoints, redirect URI, and optional default flag |
25
- | `OidcGuard` types | Guard payload shapes |
26
- | Modules | Shared OIDC module declarations |
27
- | Models | Token/profile shapes |
32
+ | `EMAIL_SCOPE`, `PERMISSIONS_SCOPE`, `PERMISSIONS_CLAIM` | The standard email scope; the integrated-IAM grant scope and the claim it produces |
33
+ | `OIDC_CODE_QUERY`, `OIDC_ERROR_QUERY`, `OIDC_ERROR_DESCRIPTION_QUERY` | Redirect-URI params an authorization server sets on success and on failure |
34
+ | `INTERACTION`, `INTERACTION_PATH`, `INTERACTION_UID` | Interaction screen alias, path, and the uid path param the path must declare |
35
+ | `PROVIDER_INTERACTION`, `OIDC_AUTHEN_MODULE`, `OIDC_FLOW` | The provider-side interaction alias, the IAM authentication entrypoint alias, and the flow name |
36
+ | `DEFAULT_PATH`, `DEFAULT_FRONT` | `'oidc'` and `'oidc-client'` — the provider's default base path and the default front service alias |
37
+ | `OidcProviderDescriptor` | One identity provider as configuration: `clientId`, `secret?`, `discoveryUrl?`, `service?`/`basePath?`, `redirectUri?`, `extraScopes?`, `entityId?`, `idOverride?`, the three endpoint overrides `authEndpoint?`/`tokenEndpoint?`/`userinfoEndpoint?`, plus the presentation fields below |
38
+ | `OidcProviderConfig` | A descriptor plus `internal?` (machine use only) and `apiClientId?` (the admin client) |
39
+ | `OidcSharedConfig` / `WithSharedConfig` | `cfg.oidc`: `providers`, `restrictedProviders`, `clientCookie.interaction` |
40
+ | `OidcIamConfig` | `{ iamMode?: 'keycloak' \| 'integrated' }` — the IAM-mode seam, kept here to avoid a cycle with `@owlmeans/iam` |
41
+ | `OidcGuard`, `OidcGuardOptions` | The guard service type, and `{ coguards, cache?, tokenService? }` — only `coguards` (its **first** entry, default `DEFAULT_GUARD`) and `tokenService` are read; `cache` is declared and never used |
42
+ | `OIDCAuthInitParams`, `OIDCClientAuthPayload`, `OIDCTokenUpdate`, `CommonTokenSetParams` | The dispatcher wire shapes |
43
+ | `OIDCAuthInitParamsSchema`, `OIDCClientAuthPayloadSchema`, `OIDCTokenUpdateSchema`, `ProviderProfileDetailsSchema` | Their AJV schemas |
44
+ | `ProviderProfileDetails`, `OidcUserDetails`, `OidcProviderSettings` | What an identity provider reports about a subject |
45
+ | `WrappedOIDCService` | The `AuthorizationService` that keeps a wrapped token fresh |
28
46
 
29
47
  ## Usage
30
48
 
31
49
  ```typescript
32
- import { entrypoint, guard, gate } from '@owlmeans/entrypoint'
50
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
33
51
  import { route } from '@owlmeans/route'
34
52
  import { DEFAULT_GUARD } from '@owlmeans/auth-common'
35
53
  import { OIDC_GATE } from '@owlmeans/oidc'
36
54
 
37
- entrypoint(
38
- route(manager.back.account.base, '/account'),
39
- guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
55
+ protocol(
56
+ route(accountAlias, '/account'),
57
+ contract(typed<Account>()),
58
+ { guards: DEFAULT_GUARD, gate: { alias: OIDC_GATE, params: ['my-service-account--read'] } },
40
59
  )
41
60
  ```
42
61
 
43
- The actual OIDC verification happens in `@owlmeans/server-oidc-rp` (server) and `@owlmeans/web-oidc-rp` (browser). The `oidc` package gives both sides a shared name to refer to.
62
+ The verification itself happens in `@owlmeans/server-oidc-rp` (server) and `@owlmeans/web-oidc-rp`
63
+ (browser); this package gives both sides one name to refer to. `OIDC_GATE` is for OIDC/UMA-style
64
+ authorization. A product that authenticates over OIDC but authorizes against its own identity
65
+ resources declares its own gate alias instead.
44
66
 
45
67
  ## Scope names are a cross-package contract
46
68
 
47
69
  `OIDC_RP_BASE_SCOPES` is the one definition of what an OwlMeans relying party asks an authorization
48
- server for. Two sides must agree on it and both read it from here:
70
+ server for, and two sides read it from here:
49
71
 
50
72
  - the **RP** builds its request from it (`requestedScope()` in `@owlmeans/server-oidc-rp`);
51
73
  - whoever **registers the client** must allow at least these scopes — an authorization server
52
- rejects the entire request with `invalid_scope` when a requested scope is one it supports but
53
- the client is not allowed to use (see `@owlmeans/iam-integrated`'s `INTEGRATED_CLIENT_SCOPES`).
74
+ rejects the entire request with `invalid_scope` when a requested scope is one it supports but the
75
+ client is not allowed to use.
54
76
 
55
- Never hardcode a scope string on either side; adding one to `OIDC_RP_BASE_SCOPES` must widen every
77
+ Never hardcode a scope string on either side. Adding one to `OIDC_RP_BASE_SCOPES` must widen every
56
78
  client allowlist derived from it in the same change.
57
79
 
58
- ## Product-Viable Usage Notes
80
+ ## Provider descriptors
81
+
82
+ `cfg.oidc.providers` is the list. `discoveryUrl` is the canonical form — the fully-qualified issuer,
83
+ used verbatim; `service` + `basePath` is the legacy fallback that reassembles the issuer from a
84
+ registered service host, and it forces the relying party to know the provider's URL layout.
85
+
86
+ Presentation lives on the descriptor too, because a browser never talks to the issuer directly and
87
+ has no discovery document to read a name out of: `label` (the human-readable name), `icon` (an icon
88
+ registry **name**, never markup), `order` (ascending; absent sorts after the default) and `hidden`
89
+ (registered but never offered). `internal: true` means machine use and is never offered either.
90
+
91
+ `def` marks the default provider, and **both sides read it**. On the server, `getDefault()` in
92
+ `@owlmeans/server-oidc-rp` returns the `clientId` of the first provider carrying the flag, and the
93
+ init handler resolves the OIDC client from that value before it looks at `entityId` at all — so `def`
94
+ in a server config decides which provider the browser-starts-server-finishes flow runs against. In
95
+ the browser it drives presentation as well: `@owlmeans/web-oidc-rp` gives the flagged provider a
96
+ login method of `order` 20 (unless the descriptor sets its own) and renders it with primary emphasis.
97
+
98
+ `restrictedProviders` narrows what an application may use: `false` forbids identity-provider sign-in
99
+ outright, `true` allows only the default one, and an array is an allowlist matched against a
100
+ provider's `entityId ?? service ?? clientId`.
59
101
 
60
- - Provider config is stored in `cfg.oidc.providers`; viable config registers both an internal admin provider and a Google provider with `service: GOOGLE_SERVICE`.
61
- - `GOOGLE_SERVICE` is the provider service value `'google'`. Keep it stable so browser plugins, backend provider lookup, and identity credentials derive the same login-service key.
62
- - `GOOGLE_CLIENT_AUTH` names the browser authentication plugin registered by `@owlmeans/web-oidc-rp/auth/plugins`.
63
- - `OIDC_GATE` is for OIDC/UMA-style authorization gates. Do not use it for downstream products that authenticate with OIDC/Google but authorize against local identity resources; those products should declare their own gate alias.
102
+ `authEndpoint`, `tokenEndpoint` and `userinfoEndpoint` name a provider's endpoints outright, for a
103
+ provider reached without discovery. The shipped reader of all three is the Google sign-in plugin in
104
+ `@owlmeans/server-oidc-rp`, which falls back to Google's own endpoints when they are absent; a
105
+ descriptor that carries a `discoveryUrl` gets its endpoints from the discovery document instead and
106
+ these fields do nothing.
64
107
 
65
108
  ## Depends On
66
109
 
67
- - `@owlmeans/entrypoint`, `@owlmeans/route`, `@owlmeans/auth`
110
+ - `@owlmeans/entrypoint`, `@owlmeans/route`, `@owlmeans/auth`, `@owlmeans/auth-common`,
111
+ `@owlmeans/basic-envelope`, `@owlmeans/config`, `@owlmeans/context`, `@owlmeans/resource`
112
+ - `ajv` (peer) — the schemas above are `JSONSchemaType` declarations
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: oidc-versions
3
3
  description: How to manage and upgrade the four OIDC/OAuth third-party dependencies used by OwlMeans OIDC packages. Covers exact-pin policy, official doc anchors, breaking-change checklists for each lib, the OwlMeans isolation principle, and the verification flow across common and downstream repos. Auto-invoked when touching oidc-provider, openid-client, jose, or oidc-client-ts version strings in package.json files.
4
- allowed-tools: Bash(npm view *) Bash(grep *) Bash(bun *)
4
+ allowed-tools: Bash(npm view *), Bash(grep *), Bash(bun *)
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
7
 
8
8
  # OIDC / OAuth dependency version management — OwlMeans Common
9
9
 
10
- This skill is the sibling of [[versions]] (internal `@owlmeans/*` version sync) and [[shadcn-versions]] (UI lib bumps). Use it whenever upgrading the upstream OIDC/OAuth libraries, and cross-read it before touching any OIDC package implementation.
10
+ The sibling of [[versions]] (internal `@owlmeans/*` version sync) and [[shadcn-versions]] (UI lib
11
+ bumps). Use it whenever upgrading the upstream OIDC/OAuth libraries, and cross-read it before
12
+ touching any OIDC package implementation.
11
13
 
12
14
  ## The four libraries and their owning packages
13
15
 
@@ -18,9 +20,12 @@ This skill is the sibling of [[versions]] (internal `@owlmeans/*` version sync)
18
20
  | `openid-client` | `@owlmeans/server-oidc-rp` | **exact** | `6.8.4` |
19
21
  | `oidc-client-ts` | `@owlmeans/web-oidc-rp`, `@owlmeans/mui-oidc-rp` | **exact** | `3.5.0` |
20
22
 
21
- `@types/oidc-provider` is a dev dep of `server-oidc-provider` and must track the oidc-provider major: `9.5.0` (v9 ships no bundled types).
23
+ `@types/oidc-provider` is a dev dependency of `@owlmeans/server-oidc-provider` and must track the
24
+ oidc-provider major: `9.5.0` (v9 ships no bundled types).
22
25
 
23
- All four are authored by panva or authts and follow semantic versioning. **Exact pins** are the project policy — every bump is deliberate and reviewed.
26
+ All four are authored by panva or authts and follow semantic versioning. **Exact pins** are the
27
+ policy — no caret, no range — so that every bump is a deliberate, reviewed change. The pinned value
28
+ lives in each owning package's `dependencies`; nothing else may declare one of these libraries.
24
29
 
25
30
  ## Checking installed vs latest
26
31
 
@@ -43,91 +48,114 @@ Consult these before every bump — especially for same-major minors that might
43
48
 
44
49
  ## Breaking-change checklist per library
45
50
 
46
- ### oidc-provider (v9.x — current)
47
-
48
- Migrated from v8 in this project. Key differences to keep in mind:
49
-
50
- - **Provider is a Koa app instance.** `oidc.use()` middleware registered after `api.server.use(base, oidc.callback())` is *downstream* of the Koa router — `await next()` inside such middleware does **not** run after a matched route completes. Move any post-response header manipulation (e.g. CSP rewrites) to a **Fastify `onSend` hook** scoped to the OIDC base path instead.
51
- - **`enableHttpPostMethods`** defaults to `false` (authorization/logout endpoints no longer accept POST by default). Set `enableHttpPostMethods: true` in the Provider config if the interaction flow POSTs.
52
- - **DPoP is on by default.** `features.dPoP.enabled` is `true` without explicit config. Disable if the OIDC clients don't send DPoP proofs.
53
- - **Cookie `sameSite` defaults to `lax`** (was `none`). Review if the interaction UI lives on a different subdomain.
54
- - **JWK `kid` must be unique.** No two keys in `jwks.keys` can share the same `kid`. Generate or assign a deterministic unique `kid` when building the JWKS.
55
- - **`provider.Account` getter removed.** Use `findAccount` callback; do not read `oidc.Account`.
56
- - **Node 22+ required.**
57
- - **ESM-only** (was already ESM in v8).
58
- - HTTP requests now use the **global `fetch()`** (not `got`). `httpOptions` is replaced with a `fetch` config option that mirrors the fetch API.
59
- - **`@types/oidc-provider`** must be `9.x` (`^9.5.0` or exact); the v8 types are incompatible.
60
-
61
- ### jose (v6.x — current)
62
-
63
- Migrated from v5 in this project:
64
-
65
- - **WebCrypto is the only crypto backend.** `importPKCS8`, `importSPKI`, `importJWK`, `generateKeyPair` now return `CryptoKey` (not `KeyObject`).
66
- - **`extractable` must be set when you need to call `exportJWK` on an imported key.** In v5 Node `KeyObject` was always extractable. In v6 the `CryptoKey` default is `extractable: false`. The fix:
51
+ ### oidc-provider v9
52
+
53
+ - **The provider is a Koa app instance**, and `Provider#use(fn)` splices `fn` **ahead of** the
54
+ provider's own router in the Koa chain, so such a middleware runs before routing and resumes
55
+ normally after `await next()`. Header corrections for an OwlMeans server nonetheless belong in a
56
+ middleware registered on the API server **before** `oidc.callback()`, writing to the raw response
57
+ where `@fastify/helmet` has already put its defaults. They must never be a Fastify `onSend` hook:
58
+ `oidc.callback()` ends the response outside Fastify's reply lifecycle, so `onSend` never fires for
59
+ a route the provider answers.
60
+ - **`enableHttpPostMethods` is `false`.** Turning it on requires `cookies.long.sameSite: 'none'` in
61
+ the same configuration; otherwise the constructor throws `TypeError: HTTP POST Method support
62
+ requires that cookies.long.sameSite is set to none`.
63
+ - **DPoP is on.** `features.dPoP.enabled` is `true` with no configuration. Disable it when the
64
+ clients send no DPoP proofs.
65
+ - **Cookie `sameSite` is `lax`** for both `cookies.long` and `cookies.short`. Review it when the
66
+ interaction UI lives on a different subdomain.
67
+ - **JWK `kid` must be unique.** No two keys in `jwks.keys` may share one.
68
+ - **There is no `provider.Account` getter.** Accounts come from the `findAccount` callback.
69
+ - **ESM-only**, and outbound HTTP goes through the `fetch` configuration option — a function
70
+ mirroring the fetch API, defaulting to `globalThis.fetch`. There is no `httpOptions`.
71
+ - **`@types/oidc-provider` must track the major** (`9.5.0`); v9 ships no bundled types.
72
+
73
+ ### jose v6
74
+
75
+ - **WebCrypto is the only crypto backend.** `importPKCS8`, `importSPKI` and `importX509` resolve to a
76
+ `CryptoKey`; `importJWK` resolves to a `CryptoKey` for every key type except `oct`, which yields a
77
+ `Uint8Array`. `KeyObject` survives only as an exported type.
78
+ - **`extractable` defaults to `false` for a private key** and `true` for everything else, so an
79
+ imported private key cannot be exported unless the import asked for it:
67
80
  ```typescript
68
- // ✅ v6 — must pass { extractable: true }
69
81
  const key = await jose.importPKCS8(pkcs8String, 'RS256', { extractable: true })
70
82
  const jwk = await jose.exportJWK(key) // works
71
83
  ```
72
- - **`decodeJwt` unchanged** — still `decodeJwt(jwt): JWTPayload`.
73
- - **Subpath exports removed.** All exports are from the root `'jose'` entry; e.g. `'jose/jwt/verify'` no longer works.
74
- - **CJS `require()` requires Node's `require(esm)` support** (Node 22+, or use dynamic `import()`).
75
-
76
- ### openid-client (v6.x — no migration needed from v6.1)
84
+ - `decodeJwt(jwt): JWTPayload`.
85
+ - Both the root entry and the subpath entries (`jose/jwt/verify`, `jose/key/import`, `jose/errors`, …)
86
+ are exported. Prefer the root entry — an `import * as jose from 'jose'` is what the OwlMeans
87
+ packages use, and a subpath import buys nothing under a bundler.
88
+ - **CJS `require()` needs Node's `require(esm)` support**; use dynamic `import()` otherwise.
77
89
 
78
- v6 introduced a **functional API** (replacing the class-based v5 API). OwlMeans already targets v6 (migrated earlier). Key API surface used:
90
+ ### openid-client v6
79
91
 
80
- - `client.discovery(issuerUrl, clientId, secret, authMethod, options)` — returns a `Configuration` object.
81
- - `client.buildAuthorizationUrl(config, params)` — returns a `URL`.
82
- - `client.authorizationCodeGrant(config, url, checks)` — returns `TokenEndpointResponse`.
83
- - `client.clientCredentialsGrant(config)` / `client.refreshTokenGrant(config, refreshToken)`.
84
- - `client.tokenIntrospection(config, token)`.
85
- - `client.allowInsecureRequests` — passed in the `execute` array option of `discovery` when behind HTTP (dev/internal).
92
+ A functional API — there is no client class. The surface OwlMeans uses:
86
93
 
87
- Breaking changes within v6.x are documented in the CHANGELOG; check before bumping patch/minor versions.
94
+ - `discovery(issuerUrl, clientId, metadata?, clientAuthentication?, options?)` → `Configuration`.
95
+ `metadata` accepts the client secret as a bare string. `clientAuthentication` is a `ClientAuth`
96
+ function (`ClientSecretPost(secret)`, `ClientSecretBasic(secret)`, …) and defaults to
97
+ `ClientSecretPost` when a secret is present — passing `undefined` takes that default.
98
+ - `buildAuthorizationUrl(config, params)` → `URL`.
99
+ - `authorizationCodeGrant(config, url, checks)` → `TokenEndpointResponse`.
100
+ - `clientCredentialsGrant(config)` / `refreshTokenGrant(config, refreshToken)`.
101
+ - `tokenIntrospection(config, token)`.
102
+ - `allowInsecureRequests` — passed inside the `execute` array of `discovery`'s options to permit
103
+ plain HTTP for an internal or development issuer.
88
104
 
89
- ### oidc-client-ts (v3.x — no migration from v3.1)
105
+ ### oidc-client-ts v3
90
106
 
91
- Current pin is `3.5.0`. OwlMeans only uses `UserManager` (browser-side, currently a stub). Check the CHANGELOG for breaking changes to `UserManager` constructor or `signinRedirect` between minor versions.
107
+ Only `UserManager` is referenced, in the incomplete fully-browser-side path; the production flow is a
108
+ server-side token exchange. Check the CHANGELOG for changes to the `UserManager` constructor or
109
+ `signinRedirect` before bumping a minor.
92
110
 
93
111
  ## OwlMeans isolation principle
94
112
 
95
- **No upstream OIDC library type may appear in a package's public `index.ts` exports.** Define OwlMeans-owned interfaces and map at the service boundary.
96
-
97
- Canonical example — `@owlmeans/server-oidc-rp` public types:
98
- - `OidcTokenSet` — OwlMeans-owned shape for `access_token`, `refresh_token`, `id_token`, etc.
99
- - `OidcGrantChecks` — owned shape for PKCE checks.
100
- - `OidcServerMetadata` — owned shape for issuer/endpoint metadata.
101
- - `OidcIntrospectionResponse` — owned shape for token introspection.
102
- - `OidcClientDescriptor` — **opaque branded type** (consumers receive and pass it back; never read its internal structure).
103
-
104
- The implementation in `src/service.ts` imports and uses the upstream types internally, mapping to/from the owned types at method boundaries. This means a future library swap is confined to a single file.
113
+ **No upstream OIDC library NAME may appear in a package's public `index.ts` exports.** Declare
114
+ OwlMeans-owned types and map at the service boundary, so a consumer never imports from
115
+ `openid-client` or `oidc-provider` to type a variable this stack handed it.
116
+
117
+ The public types of `@owlmeans/server-oidc-rp` are the canonical example:
118
+
119
+ - `OidcTokenSet` / `OidcTokenSetParameters` — declared shapes for `access_token`, `refresh_token`,
120
+ `id_token`, `token_type`, `expires_in`, `scope`, with and without the `claims()` helper.
121
+ - `OidcGrantChecks` — the declared shape for PKCE checks.
122
+ - `OidcIntrospectionResponse` — the declared shape for token introspection.
123
+ - `OidcServerMetadata` and `OidcClientDescriptor` — deliberate aliases onto the upstream metadata and
124
+ configuration objects, exported under owned names. `OidcClientDescriptor` is **opaque**: consumers
125
+ receive it and pass it back, and never read its internals.
126
+
127
+ What the principle guarantees is the **exported name**: a consumer types every value this stack hands
128
+ it without importing `openid-client` or `oidc-provider`. It does not confine upstream imports to one
129
+ file, and reading it that way misleads. In `@owlmeans/server-oidc-rp` the type module imports
130
+ `Configuration`, `ServerMetadata`, `TokenEndpointResponse` and `TokenEndpointResponseHelpers` from
131
+ `openid-client` in order to alias them under the owned names; the service module imports the
132
+ functional API; and `jose`'s `decodeJwt` is imported directly by the token wrapper, the `oidc-client`
133
+ auth plugin and the exchange handler. A library swap touches each of those — the owned names are what
134
+ keep it from reaching any consumer.
105
135
 
106
136
  See [[server-oidc-rp]] for the full public surface.
107
137
 
108
138
  ## Performing a bump
109
139
 
110
- 1. **Read the CHANGELOG** for the target version (link above). Enumerate every breaking change against the checklist above.
140
+ 1. **Read the CHANGELOG** for the target version (link above). Enumerate every breaking change
141
+ against the checklist above.
111
142
  2. Update the version string in **each owning package's `package.json`** — exact pins only, no caret.
112
- 3. Update `@types/oidc-provider` if bumping `oidc-provider` across a major.
113
- 4. **Run `bun install`** in the monorepo root to update the lockfile.
114
- 5. **Fix any code changes** using the checklist (particularly the `extractable` gotcha for jose and the CSP/debug middleware placement for oidc-provider).
115
- 6. Build affected packages: `bun run build` (or `tsc -b`) per package.
116
- 7. Run unit tests: `bun test ./tests` per package.
143
+ 3. Update `@types/oidc-provider` when bumping `oidc-provider` across a major.
144
+ 4. Reinstall so the lockfile is regenerated.
145
+ 5. **Fix the code** using the checklist — particularly the jose `extractable` argument and the
146
+ placement of the header-correcting middleware for oidc-provider.
147
+ 6. Build every affected package, then run its unit tests.
117
148
 
118
149
  ## Downstream verification
119
150
 
120
- Downstream repos that link `@owlmeans/*` packages as local workspace entries (bun hoisted linker) pick up the rebuilt outputs automatically. After rebuilding the affected packages, verify each downstream:
121
-
122
- ```bash
123
- # per repo: viable, viable-agent, internal
124
- cd <your-project-root>
125
- bun install # refresh transitive third-party versions
126
- bun run build # or per-workspace build command
127
- bun test # or per-workspace test command
128
- ```
151
+ A project that links these packages as local workspace entries picks up the rebuilt outputs
152
+ automatically, but its own transitive copies of the four libraries do not move on their own. After
153
+ rebuilding, in every consuming project: reinstall, build, and run the tests.
129
154
 
130
- Check `overrides` in each repo's root `package.json` — remove stale pins of oidc-provider/jose/openid-client/oidc-client-ts if present.
155
+ Then check `overrides` (or the equivalent resolution field) in each consuming project's root
156
+ manifest and remove any stale pin of `oidc-provider`, `jose`, `openid-client` or `oidc-client-ts` —
157
+ an override outranks the exact pin the owning package declares, so a forgotten one silently keeps the
158
+ old version installed.
131
159
 
132
160
  ## Cross-references
133
161
 
@@ -0,0 +1,10 @@
1
+ /** Shared OIDC browser-to-server protocols, bound by the relying-party packages. */
2
+ export declare const oidcProtocols: {
3
+ init: import("@owlmeans/entrypoint").EntrypointProtocol<{
4
+ body: import("./types.js").OIDCAuthInitParams;
5
+ }, any>;
6
+ authenticate: import("@owlmeans/entrypoint").EntrypointProtocol<{
7
+ body: import("./types.js").OIDCClientAuthPayload;
8
+ }, any>;
9
+ };
10
+ //# sourceMappingURL=entrypoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,eAAO,MAAM,aAAa;IACxB,IAAI;;;IAIJ,YAAY;;;CAIb,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { contract, protocol, typed } from '@owlmeans/entrypoint';
2
+ import { route, RouteMethod, backend } from '@owlmeans/route';
3
+ import { DISPATCHER_OIDC, DISPATCHER_OIDC_INIT } from './consts.js';
4
+ import { OIDCAuthInitParamsSchema, OIDCClientAuthPayloadSchema } from './models.js';
5
+ /** Shared OIDC browser-to-server protocols, bound by the relying-party packages. */
6
+ export const oidcProtocols = {
7
+ init: protocol(route(DISPATCHER_OIDC_INIT, '/authenticate/oidc/init', backend(null, RouteMethod.POST)), contract.request({ body: typed(OIDCAuthInitParamsSchema) }, typed())),
8
+ authenticate: protocol(route(DISPATCHER_OIDC, '/authenticate/oidc/process', backend(null, RouteMethod.POST)), contract.request({ body: typed(OIDCClientAuthPayloadSchema) }, typed())),
9
+ };
10
+ //# sourceMappingURL=entrypoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAEnF,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,QAAQ,CACZ,KAAK,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EACvF,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,wBAAwB,CAAC,EAAE,EAAE,KAAK,EAAO,CAAC,CAC1E;IACD,YAAY,EAAE,QAAQ,CACpB,KAAK,CAAC,eAAe,EAAE,4BAA4B,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EACrF,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,2BAA2B,CAAC,EAAE,EAAE,KAAK,EAAO,CAAC,CAC7E;CACF,CAAA"}
package/build/guard.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import type { Config, Context, OidcGuard, OidcGuardOptions } from './types.js';
2
- import type { CommonEntrypoint } from '@owlmeans/entrypoint';
2
+ import type { EntrypointTree } from '@owlmeans/entrypoint';
3
3
  export declare const makeOidcGuard: (opts?: OidcGuardOptions) => OidcGuard;
4
4
  export declare const appendOidcGuard: <C extends Config, T extends Context<C>>(context: T, opts?: OidcGuardOptions) => T;
5
- export declare const setupOidcGuard: (modules: CommonEntrypoint[], coguards?: string | string[]) => void;
5
+ /**
6
+ * Decorate an immutable protocol tree so the OIDC guard runs before each selected auth guard.
7
+ *
8
+ * The tree's shape and protocol types are preserved; only declarations that explicitly carry a
9
+ * selected guard are cloned. Parent inheritance then carries OIDC to their children exactly as
10
+ * the route model does for every other guard.
11
+ */
12
+ export declare const withOidcGuard: <Tree extends EntrypointTree>(tree: Tree, coguards?: string | readonly string[]) => Tree;
6
13
  //# sourceMappingURL=guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAsB,MAAM,YAAY,CAAA;AAElG,OAAO,KAAK,EAAqC,gBAAgB,EAAgB,MAAM,sBAAsB,CAAA;AAS7G,eAAO,MAAM,aAAa,UAAW,gBAAgB,KAAG,SA4FvD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,WAC3D,CAAC,SAAS,gBAAgB,MAKpC,CAAA;AAED,eAAO,MAAM,cAAc,YAAa,gBAAgB,EAAE,aAAa,MAAM,GAAG,MAAM,EAAE,SAUvF,CAAA"}
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAsB,MAAM,YAAY,CAAA;AAGlG,OAAO,KAAK,EAAqC,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AAQ3G,eAAO,MAAM,aAAa,UAAW,gBAAgB,KAAG,SA4FvD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,WAC3D,CAAC,SAAS,gBAAgB,MAKpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,SAAS,cAAc,QACjD,IAAI,aAAa,MAAM,GAAG,SAAS,MAAM,EAAE,KAChD,IAcF,CAAA"}
package/build/guard.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createService } from '@owlmeans/context';
2
2
  import { OIDC_GUARD, OIDC_WRAPPED_TOKEN, WRAPPED_OIDC } from './consts.js';
3
+ import { decorateEntrypoint, isEntrypointProtocol } from '@owlmeans/entrypoint';
3
4
  import { DEFAULT_GUARD, TOKEN_UPDATE } from '@owlmeans/auth-common';
4
5
  import { AUTH_HEADER, AuthorizationError } from '@owlmeans/auth';
5
6
  import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope';
6
7
  import { trust } from '@owlmeans/auth-common/utils';
7
8
  import { TRUSTED } from '@owlmeans/config';
8
9
  import { extractAuthToken } from '@owlmeans/auth-common/utils';
9
- import { modules as oidcModules } from './modules.js';
10
10
  export const makeOidcGuard = (opts) => {
11
11
  // const cache = (context: Context) => context.hasResource(opts?.cache ?? OIDC_GUARD_CACHE)
12
12
  // ? context.resource<Resource<ResourceRecord>>(opts?.cache ?? OIDC_GUARD_CACHE)
@@ -86,15 +86,24 @@ export const appendOidcGuard = (context, opts) => {
86
86
  context.registerService(makeOidcGuard(opts));
87
87
  return context;
88
88
  };
89
- export const setupOidcGuard = (modules, coguards) => {
90
- modules.push(...oidcModules);
91
- coguards = Array.isArray(coguards) ? coguards : [coguards ?? DEFAULT_GUARD];
92
- modules.forEach(module => {
93
- if (module.guards != null && !module.guards.includes(OIDC_GUARD)
94
- && module.guards.some(guard => coguards.includes(guard))) {
95
- module.guards.unshift(OIDC_GUARD);
89
+ /**
90
+ * Decorate an immutable protocol tree so the OIDC guard runs before each selected auth guard.
91
+ *
92
+ * The tree's shape and protocol types are preserved; only declarations that explicitly carry a
93
+ * selected guard are cloned. Parent inheritance then carries OIDC to their children exactly as
94
+ * the route model does for every other guard.
95
+ */
96
+ export const withOidcGuard = (tree, coguards) => {
97
+ const selected = new Set(Array.isArray(coguards) ? coguards : [coguards ?? DEFAULT_GUARD]);
98
+ const decorate = (node) => Object.fromEntries(Object.entries(node).map(([key, value]) => {
99
+ if (!isEntrypointProtocol(value))
100
+ return [key, decorate(value)];
101
+ if (value.guards.includes(OIDC_GUARD) || !value.guards.some(guard => selected.has(guard))) {
102
+ return [key, value];
96
103
  }
97
- });
104
+ return [key, decorateEntrypoint(value, { guards: [OIDC_GUARD, ...value.guards] })];
105
+ }));
106
+ return decorate(tree);
98
107
  };
99
108
  const wrapper = (context) => context.hasService(WRAPPED_OIDC)
100
109
  ? context.service(WRAPPED_OIDC)
@@ -1 +1 @@
1
- {"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,WAAW,EAAwB,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACtF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAE,M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AAC,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC,CAAA;IAC1F,MAAM,QAAQ,GAAG,CAAC,IAAoB,EAAkB,EAAE,CAAC,MAAM,CAAC,WAAW,CAC3E,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACxC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/D,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1F,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACrB,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;IACpF,CAAC,CAAC,CACH,CAAA;IAED,OAAO,QAAQ,CAAC,IAAI,CAAS,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAsB,EAAE,CACvD,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;IAC9B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE,CAAC,KAAK,EAAwB,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type * from './types.js';
2
2
  export * from './consts.js';
3
3
  export * from './guard.js';
4
- export * from './modules.js';
4
+ export * from './entrypoints.js';
5
5
  export * from './models.js';
6
6
  export type * from './iam.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,mBAAmB,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,mBAAmB,UAAU,CAAA"}
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './consts.js';
2
2
  export * from './guard.js';
3
- export * from './modules.js';
3
+ export * from './entrypoints.js';
4
4
  export * from './models.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA"}
package/build/types.d.ts CHANGED
@@ -39,6 +39,20 @@ export interface OidcProviderDescriptor {
39
39
  userinfoEndpoint?: string;
40
40
  idOverride?: string;
41
41
  def?: boolean;
42
+ /**
43
+ * How this provider presents itself on the sign-in screen.
44
+ *
45
+ * A provider list is configuration, so the only place its human-readable name can come from is
46
+ * the configuration itself — the client never talks to the issuer directly and has no discovery
47
+ * document to read a name out of.
48
+ */
49
+ label?: string;
50
+ /** Icon registry NAME, never markup — this package must stay free of an icon library. */
51
+ icon?: string;
52
+ /** Ascending. Absent means "after the default one". */
53
+ order?: number;
54
+ /** Registered, but never offered as a choice. */
55
+ hidden?: boolean;
42
56
  }
43
57
  export interface WithSharedConfig {
44
58
  oidc: OidcSharedConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,MAAO,SAAQ,WAAW;CAAI;AAC/C,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;CAAI;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE;QACb,WAAW,CAAC,EAAE;YACZ,IAAI,CAAC,EAAE,MAAM,CAAA;YACb,GAAG,CAAC,EAAE,MAAM,CAAA;SACb,CAAA;KACF,CAAC;IACF,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACzC;AAED,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;IAEhE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,sBAAsB;IAErC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAA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0.1.18-rc.2",
3
+ "version": "0.1.18-rc.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -21,14 +21,14 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@owlmeans/auth": "^0.1.18-rc.2",
25
- "@owlmeans/auth-common": "^0.1.18-rc.2",
26
- "@owlmeans/basic-envelope": "^0.1.18-rc.2",
27
- "@owlmeans/config": "^0.1.18-rc.2",
28
- "@owlmeans/context": "^0.1.18-rc.2",
29
- "@owlmeans/entrypoint": "^0.1.18-rc.2",
30
- "@owlmeans/resource": "^0.1.18-rc.2",
31
- "@owlmeans/route": "^0.1.18-rc.2"
24
+ "@owlmeans/auth": "^0.1.18-rc.12",
25
+ "@owlmeans/auth-common": "^0.1.18-rc.16",
26
+ "@owlmeans/basic-envelope": "^0.1.18-rc.15",
27
+ "@owlmeans/config": "^0.1.18-rc.15",
28
+ "@owlmeans/context": "^0.1.18-rc.11",
29
+ "@owlmeans/entrypoint": "^0.1.18-rc.14",
30
+ "@owlmeans/resource": "^0.1.18-rc.12",
31
+ "@owlmeans/route": "^0.1.18-rc.12"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "ajv": "*"
@@ -1,16 +1,16 @@
1
- import { body, filter, entrypoint } from '@owlmeans/entrypoint'
1
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
2
2
  import { route, RouteMethod, backend } from '@owlmeans/route'
3
3
  import { DISPATCHER_OIDC, DISPATCHER_OIDC_INIT } from './consts.js'
4
4
  import { OIDCAuthInitParamsSchema, OIDCClientAuthPayloadSchema } from './models.js'
5
5
 
6
- export const modules = [
7
- entrypoint(
6
+ /** Shared OIDC browser-to-server protocols, bound by the relying-party packages. */
7
+ export const oidcProtocols = {
8
+ init: protocol(
8
9
  route(DISPATCHER_OIDC_INIT, '/authenticate/oidc/init', backend(null, RouteMethod.POST)),
9
- filter(body(OIDCAuthInitParamsSchema))
10
-
10
+ contract.request({ body: typed(OIDCAuthInitParamsSchema) }, typed<any>()),
11
11
  ),
12
- entrypoint(
12
+ authenticate: protocol(
13
13
  route(DISPATCHER_OIDC, '/authenticate/oidc/process', backend(null, RouteMethod.POST)),
14
- filter(body(OIDCClientAuthPayloadSchema))
15
- )
16
- ]
14
+ contract.request({ body: typed(OIDCClientAuthPayloadSchema) }, typed<any>()),
15
+ ),
16
+ }
package/src/guard.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { createService } from '@owlmeans/context'
2
2
  import type { Config, Context, OidcGuard, OidcGuardOptions, WrappedOIDCService } from './types.js'
3
3
  import { OIDC_GUARD, OIDC_WRAPPED_TOKEN, WRAPPED_OIDC } from './consts.js'
4
- import type { AbstractRequest, AbstractResponse, CommonEntrypoint, GuardService } from '@owlmeans/entrypoint'
4
+ import { decorateEntrypoint, isEntrypointProtocol } from '@owlmeans/entrypoint'
5
+ import type { AbstractRequest, AbstractResponse, EntrypointTree, GuardService } from '@owlmeans/entrypoint'
5
6
  import { DEFAULT_GUARD, TOKEN_UPDATE } from '@owlmeans/auth-common'
6
7
  import { AUTH_HEADER, type Auth, AuthToken, AuthorizationError } from '@owlmeans/auth'
7
8
  import { EnvelopeKind, makeEnvelopeModel } from '@owlmeans/basic-envelope'
8
9
  import { trust } from '@owlmeans/auth-common/utils'
9
10
  import { TRUSTED } from '@owlmeans/config'
10
11
  import { extractAuthToken } from '@owlmeans/auth-common/utils'
11
- import { modules as oidcModules } from './modules.js'
12
12
 
13
13
  export const makeOidcGuard = (opts?: OidcGuardOptions): OidcGuard => {
14
14
  // const cache = (context: Context) => context.hasResource(opts?.cache ?? OIDC_GUARD_CACHE)
@@ -112,16 +112,29 @@ export const appendOidcGuard = <C extends Config, T extends Context<C>>(
112
112
  return context
113
113
  }
114
114
 
115
- export const setupOidcGuard = (modules: CommonEntrypoint[], coguards?: string | string[]) => {
116
- modules.push(...oidcModules)
117
- coguards = Array.isArray(coguards) ? coguards : [coguards ?? DEFAULT_GUARD]
115
+ /**
116
+ * Decorate an immutable protocol tree so the OIDC guard runs before each selected auth guard.
117
+ *
118
+ * The tree's shape and protocol types are preserved; only declarations that explicitly carry a
119
+ * selected guard are cloned. Parent inheritance then carries OIDC to their children exactly as
120
+ * the route model does for every other guard.
121
+ */
122
+ export const withOidcGuard = <Tree extends EntrypointTree>(
123
+ tree: Tree, coguards?: string | readonly string[],
124
+ ): Tree => {
125
+ const selected = new Set(Array.isArray(coguards) ? coguards : [coguards ?? DEFAULT_GUARD])
126
+ const decorate = (node: EntrypointTree): EntrypointTree => Object.fromEntries(
127
+ Object.entries(node).map(([key, value]) => {
128
+ if (!isEntrypointProtocol(value)) return [key, decorate(value)]
129
+ if (value.guards.includes(OIDC_GUARD) || !value.guards.some(guard => selected.has(guard))) {
130
+ return [key, value]
131
+ }
118
132
 
119
- modules.forEach(module => {
120
- if (module.guards != null && !module.guards.includes(OIDC_GUARD)
121
- && module.guards.some(guard => coguards.includes(guard))) {
122
- module.guards.unshift(OIDC_GUARD)
123
- }
124
- })
133
+ return [key, decorateEntrypoint(value, { guards: [OIDC_GUARD, ...value.guards] })]
134
+ }),
135
+ )
136
+
137
+ return decorate(tree) as Tree
125
138
  }
126
139
 
127
140
  const wrapper = (context: Context): WrappedOIDCService =>
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type * from './types.js'
2
2
  export * from './consts.js'
3
3
  export * from './guard.js'
4
- export * from './modules.js'
4
+ export * from './entrypoints.js'
5
5
  export * from './models.js'
6
6
  export type * from './iam.js'
package/src/types.ts CHANGED
@@ -45,6 +45,20 @@ export interface OidcProviderDescriptor {
45
45
  idOverride?: string
46
46
  // This flag works only on client side. It specifies a default relying party
47
47
  def?: boolean
48
+ /**
49
+ * How this provider presents itself on the sign-in screen.
50
+ *
51
+ * A provider list is configuration, so the only place its human-readable name can come from is
52
+ * the configuration itself — the client never talks to the issuer directly and has no discovery
53
+ * document to read a name out of.
54
+ */
55
+ label?: string
56
+ /** Icon registry NAME, never markup — this package must stay free of an icon library. */
57
+ icon?: string
58
+ /** Ascending. Absent means "after the default one". */
59
+ order?: number
60
+ /** Registered, but never offered as a choice. */
61
+ hidden?: boolean
48
62
  }
49
63
 
50
64
 
package/build/.gitkeep DELETED
File without changes
@@ -1,2 +0,0 @@
1
- export declare const modules: import("@owlmeans/entrypoint").CommonEntrypoint[];
2
- //# sourceMappingURL=modules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,mDAUnB,CAAA"}
package/build/modules.js DELETED
@@ -1,9 +0,0 @@
1
- import { body, filter, entrypoint } from '@owlmeans/entrypoint';
2
- import { route, RouteMethod, backend } from '@owlmeans/route';
3
- import { DISPATCHER_OIDC, DISPATCHER_OIDC_INIT } from './consts.js';
4
- import { OIDCAuthInitParamsSchema, OIDCClientAuthPayloadSchema } from './models.js';
5
- export const modules = [
6
- entrypoint(route(DISPATCHER_OIDC_INIT, '/authenticate/oidc/init', backend(null, RouteMethod.POST)), filter(body(OIDCAuthInitParamsSchema))),
7
- entrypoint(route(DISPATCHER_OIDC, '/authenticate/oidc/process', backend(null, RouteMethod.POST)), filter(body(OIDCClientAuthPayloadSchema)))
8
- ];
9
- //# sourceMappingURL=modules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAEnF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU,CACR,KAAK,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EACvF,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAEvC;IACD,UAAU,CACR,KAAK,CAAC,eAAe,EAAE,4BAA4B,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EACrF,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAC1C;CACF,CAAA"}