@owlmeans/oidc 0.1.7 → 0.1.9
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
|
@@ -83,3 +83,20 @@ Array of dispatcher module declarations: `POST /authenticate/oidc/init` and `POS
|
|
|
83
83
|
- [`@owlmeans/web-oidc-rp`](../web-oidc-rp) — browser-side relying party
|
|
84
84
|
- [`@owlmeans/server-oidc-provider`](../server-oidc-provider) — embedded OIDC identity provider
|
|
85
85
|
- [`@owlmeans/auth-common`](../auth-common) — `DEFAULT_GUARD` typically composed alongside `OIDC_GATE`
|
|
86
|
+
|
|
87
|
+
<!-- owlmeans:agent-guidance:start -->
|
|
88
|
+
## Agent guidance
|
|
89
|
+
|
|
90
|
+
This package ships embedded Claude Code skills and GitHub Copilot instructions under
|
|
91
|
+
`agent-meta/`. After installing your `@owlmeans/*` packages, run the OwlMeans
|
|
92
|
+
agent-skills installer to place them into your project's native locations
|
|
93
|
+
(`.claude/skills/` and `.github/instructions/`):
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npx @owlmeans/agent-skills
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The embedded files are version-matched to this package release. Do not edit them
|
|
100
|
+
directly — they are regenerated on each publish. To contribute guidance edits,
|
|
101
|
+
open a PR against the source monorepo.
|
|
102
|
+
<!-- owlmeans:agent-guidance:end -->
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How to use @owlmeans/oidc — shared OIDC protocol abstractions including OIDC_GATE constant used in module gate() declarations."
|
|
3
|
+
applyTo: "**/*.ts, **/*.tsx"
|
|
4
|
+
---
|
|
5
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
+
|
|
7
|
+
# @owlmeans/oidc
|
|
8
|
+
|
|
9
|
+
**Layer:** Core
|
|
10
|
+
**Install:** `"@owlmeans/oidc": "^0.1.9"` in `dependencies`
|
|
11
|
+
|
|
12
|
+
## Key Exports
|
|
13
|
+
|
|
14
|
+
| Export | Description |
|
|
15
|
+
|--------|-------------|
|
|
16
|
+
| `OIDC_GATE` | Gate alias to pass to `gate(...)` inside `guard(...)` |
|
|
17
|
+
| `GOOGLE_CLIENT_AUTH` | Client auth plugin type for Google OAuth |
|
|
18
|
+
| `GOOGLE_SERVICE` | Provider service key for Google (`'google'`) |
|
|
19
|
+
| `OidcProviderDescriptor` | Shared provider config shape, including service, endpoints, redirect URI, and optional default flag |
|
|
20
|
+
| `OidcGuard` types | Guard payload shapes |
|
|
21
|
+
| Modules | Shared OIDC module declarations |
|
|
22
|
+
| Models | Token/profile shapes |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { OIDC_GATE } from '@owlmeans/oidc'
|
|
28
|
+
import { guard, gate } from '@owlmeans/entrypoint'
|
|
29
|
+
import { DEFAULT_GUARD } from '@owlmeans/auth-common'
|
|
30
|
+
|
|
31
|
+
guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Product-Viable Usage Notes
|
|
35
|
+
|
|
36
|
+
- Provider config is stored in `cfg.oidc.providers`; viable config registers both an internal admin provider and a Google provider with `service: GOOGLE_SERVICE`.
|
|
37
|
+
- `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.
|
|
38
|
+
- `GOOGLE_CLIENT_AUTH` names the browser authentication plugin registered by `@owlmeans/web-oidc-rp/auth/plugins`.
|
|
39
|
+
- `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.
|
|
40
|
+
|
|
41
|
+
- `PERMISSIONS_SCOPE` / `PERMISSIONS_CLAIM` (`'permissions'`) — the OIDC scope requesting, and the
|
|
42
|
+
token claim carrying, the subject's `PermissionSet[]` from the integrated IAM provider. Shared by
|
|
43
|
+
`server-oidc-provider` (emission), `server-oidc-rp` (extraction), and target provider config (`extraScopes`).
|
|
44
|
+
|
|
45
|
+
## Depends On
|
|
46
|
+
|
|
47
|
+
- `@owlmeans/entrypoint`, `@owlmeans/route`, `@owlmeans/auth`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"package": "@owlmeans/oidc",
|
|
4
|
+
"version": "0.1.9",
|
|
5
|
+
"generatedAt": "2026-06-14T13:34:06.131Z",
|
|
6
|
+
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
|
+
"entries": [
|
|
8
|
+
{
|
|
9
|
+
"kind": "skill",
|
|
10
|
+
"name": "oidc-versions",
|
|
11
|
+
"category": "multi-package",
|
|
12
|
+
"file": "skills/oidc-versions/SKILL.md",
|
|
13
|
+
"canonicalPath": ".claude/skills/oidc-versions/SKILL.md"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"kind": "skill",
|
|
17
|
+
"name": "oidc",
|
|
18
|
+
"category": "package-specific",
|
|
19
|
+
"file": "skills/oidc/SKILL.md",
|
|
20
|
+
"canonicalPath": ".claude/skills/oidc/SKILL.md"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"kind": "instruction",
|
|
24
|
+
"name": "oidc",
|
|
25
|
+
"category": "package-specific",
|
|
26
|
+
"file": "instructions/oidc.instructions.md",
|
|
27
|
+
"canonicalPath": ".github/instructions/oidc.instructions.md"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
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().
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
|
+
|
|
8
|
+
# @owlmeans/oidc
|
|
9
|
+
|
|
10
|
+
**Layer:** Core
|
|
11
|
+
**Install:** `"@owlmeans/oidc": "^0.1.9"` in `dependencies`
|
|
12
|
+
|
|
13
|
+
## Key Exports
|
|
14
|
+
|
|
15
|
+
| Export | Description |
|
|
16
|
+
|--------|-------------|
|
|
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'`) |
|
|
20
|
+
| `OidcProviderDescriptor` | Shared provider config shape, including service, endpoints, redirect URI, and optional default flag |
|
|
21
|
+
| `OidcGuard` types | Guard payload shapes |
|
|
22
|
+
| Modules | Shared OIDC module declarations |
|
|
23
|
+
| Models | Token/profile shapes |
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { entrypoint, guard, gate } from '@owlmeans/entrypoint'
|
|
29
|
+
import { route } from '@owlmeans/route'
|
|
30
|
+
import { DEFAULT_GUARD } from '@owlmeans/auth-common'
|
|
31
|
+
import { OIDC_GATE } from '@owlmeans/oidc'
|
|
32
|
+
|
|
33
|
+
entrypoint(
|
|
34
|
+
route(manager.back.account.base, '/account'),
|
|
35
|
+
guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
## Product-Viable Usage Notes
|
|
42
|
+
|
|
43
|
+
- Provider config is stored in `cfg.oidc.providers`; viable config registers both an internal admin provider and a Google provider with `service: GOOGLE_SERVICE`.
|
|
44
|
+
- `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.
|
|
45
|
+
- `GOOGLE_CLIENT_AUTH` names the browser authentication plugin registered by `@owlmeans/web-oidc-rp/auth/plugins`.
|
|
46
|
+
- `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.
|
|
47
|
+
|
|
48
|
+
## Depends On
|
|
49
|
+
|
|
50
|
+
- `@owlmeans/entrypoint`, `@owlmeans/route`, `@owlmeans/auth`
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oidc-versions
|
|
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 *)
|
|
5
|
+
---
|
|
6
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
|
+
|
|
8
|
+
# OIDC / OAuth dependency version management — OwlMeans Common
|
|
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.
|
|
11
|
+
|
|
12
|
+
## The four libraries and their owning packages
|
|
13
|
+
|
|
14
|
+
| Library | Owner package(s) | Policy | Current pin |
|
|
15
|
+
|---------|-----------------|--------|-------------|
|
|
16
|
+
| `oidc-provider` | `@owlmeans/server-oidc-provider` | **exact** | `9.8.4` |
|
|
17
|
+
| `jose` | `@owlmeans/server-oidc-provider`, `@owlmeans/server-oidc-rp` | **exact** | `6.2.3` |
|
|
18
|
+
| `openid-client` | `@owlmeans/server-oidc-rp` | **exact** | `6.8.4` |
|
|
19
|
+
| `oidc-client-ts` | `@owlmeans/web-oidc-rp`, `@owlmeans/mui-oidc-rp` | **exact** | `3.5.0` |
|
|
20
|
+
|
|
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).
|
|
22
|
+
|
|
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.
|
|
24
|
+
|
|
25
|
+
## Checking installed vs latest
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm view oidc-provider@9 version # confirm latest v9 patch
|
|
29
|
+
npm view jose@6 version # confirm latest v6 patch
|
|
30
|
+
npm view openid-client@6 version
|
|
31
|
+
npm view oidc-client-ts@3 version
|
|
32
|
+
npm view @types/oidc-provider version # no major suffix, uses dist-tags
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Official documentation anchors
|
|
36
|
+
|
|
37
|
+
Consult these before every bump — especially for same-major minors that might add new required fields or change defaults:
|
|
38
|
+
|
|
39
|
+
- **oidc-provider:** [CHANGELOG](https://github.com/panva/node-oidc-provider/blob/main/CHANGELOG.md) · [Configuration docs](https://github.com/panva/node-oidc-provider/blob/main/docs/README.md)
|
|
40
|
+
- **jose:** [CHANGELOG](https://github.com/panva/jose/blob/main/CHANGELOG.md) · [API docs](https://github.com/panva/jose/blob/main/docs/README.md)
|
|
41
|
+
- **openid-client:** [CHANGELOG](https://github.com/panva/openid-client/blob/main/CHANGELOG.md) · [Usage guide](https://github.com/panva/openid-client/blob/main/docs/README.md)
|
|
42
|
+
- **oidc-client-ts:** [CHANGELOG](https://github.com/authts/oidc-client-ts/blob/main/CHANGELOG.md)
|
|
43
|
+
|
|
44
|
+
## Breaking-change checklist per library
|
|
45
|
+
|
|
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:
|
|
67
|
+
```typescript
|
|
68
|
+
// ✅ v6 — must pass { extractable: true }
|
|
69
|
+
const key = await jose.importPKCS8(pkcs8String, 'RS256', { extractable: true })
|
|
70
|
+
const jwk = await jose.exportJWK(key) // works
|
|
71
|
+
```
|
|
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)
|
|
77
|
+
|
|
78
|
+
v6 introduced a **functional API** (replacing the class-based v5 API). OwlMeans already targets v6 (migrated earlier). Key API surface used:
|
|
79
|
+
|
|
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).
|
|
86
|
+
|
|
87
|
+
Breaking changes within v6.x are documented in the CHANGELOG; check before bumping patch/minor versions.
|
|
88
|
+
|
|
89
|
+
### oidc-client-ts (v3.x — no migration from v3.1)
|
|
90
|
+
|
|
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.
|
|
92
|
+
|
|
93
|
+
## OwlMeans isolation principle
|
|
94
|
+
|
|
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.
|
|
105
|
+
|
|
106
|
+
See [[server-oidc-rp]] for the full public surface.
|
|
107
|
+
|
|
108
|
+
## Performing a bump
|
|
109
|
+
|
|
110
|
+
1. **Read the CHANGELOG** for the target version (link above). Enumerate every breaking change against the checklist above.
|
|
111
|
+
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.
|
|
117
|
+
|
|
118
|
+
## Downstream verification
|
|
119
|
+
|
|
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
|
+
```
|
|
129
|
+
|
|
130
|
+
Check `overrides` in each repo's root `package.json` — remove stale pins of oidc-provider/jose/openid-client/oidc-client-ts if present.
|
|
131
|
+
|
|
132
|
+
## Cross-references
|
|
133
|
+
|
|
134
|
+
- [[versions]] — `@owlmeans/*` internal package version sync
|
|
135
|
+
- [[shadcn-versions]] — UI lib (Tailwind / shadcn) version management
|
|
136
|
+
- [[server-oidc-provider]] — how to use and configure the embedded OIDC provider (v9 notes)
|
|
137
|
+
- [[server-oidc-rp]] — how to use the OIDC relying party + public type contracts
|
|
138
|
+
- [[auth-protocol]] — end-to-end OIDC auth flow and mocking points
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/oidc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
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.
|
|
25
|
-
"@owlmeans/auth-common": "^0.1.
|
|
26
|
-
"@owlmeans/basic-envelope": "^0.1.
|
|
27
|
-
"@owlmeans/config": "^0.1.
|
|
28
|
-
"@owlmeans/context": "^0.1.
|
|
29
|
-
"@owlmeans/entrypoint": "^0.1.
|
|
30
|
-
"@owlmeans/resource": "^0.1.
|
|
31
|
-
"@owlmeans/route": "^0.1.
|
|
24
|
+
"@owlmeans/auth": "^0.1.9",
|
|
25
|
+
"@owlmeans/auth-common": "^0.1.9",
|
|
26
|
+
"@owlmeans/basic-envelope": "^0.1.9",
|
|
27
|
+
"@owlmeans/config": "^0.1.9",
|
|
28
|
+
"@owlmeans/context": "^0.1.9",
|
|
29
|
+
"@owlmeans/entrypoint": "^0.1.9",
|
|
30
|
+
"@owlmeans/resource": "^0.1.9",
|
|
31
|
+
"@owlmeans/route": "^0.1.9"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"ajv": "*"
|