@crvouga/mockingbird-service-oauth 3.3.0 → 3.5.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/CHANGELOG.md +19 -1
- package/DISCOVERY.md +23 -0
- package/README.md +32 -4
- package/dist/chunk-ANDSQ2HK.js +7350 -0
- package/dist/chunk-ANDSQ2HK.js.map +7 -0
- package/dist/chunk-OYEO5VHR.js +4792 -0
- package/dist/chunk-OYEO5VHR.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +356 -41
- package/dist/index.js +1 -1
- package/dist/server.d.ts +711 -82
- package/dist/server.js +2 -2
- package/package.json +3 -2
- package/dist/chunk-73KPFQ45.js +0 -5444
- package/dist/chunk-73KPFQ45.js.map +0 -7
- package/dist/chunk-OHEZ2REI.js +0 -872
- package/dist/chunk-OHEZ2REI.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-oauth
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.5.0 (2026-10-15)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- finish durable run lifecycle ([725ea1a](https://github.com/crvouga/mockingbird/commit/725ea1a966dac65434e98f06a9c33aca0d6f32d7))
|
|
8
|
+
- add management and portable archives ([0d2a6dd](https://github.com/crvouga/mockingbird/commit/0d2a6dd0f9fecb3a1ea7c1638f6639787395c2f4))
|
|
9
|
+
|
|
10
|
+
### Fixes and improvements
|
|
11
|
+
|
|
12
|
+
- correlate cross-namespace operations ([3457a4b](https://github.com/crvouga/mockingbird/commit/3457a4b7dbfd9ad9c8a10671a5744b7c8425d000))
|
|
13
|
+
- harden HTTP stream handling ([674307a](https://github.com/crvouga/mockingbird/commit/674307a869f57907567d462c4f506c3b0a237e13))
|
|
14
|
+
|
|
15
|
+
## 3.4.0 (2026-10-12)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- unify the emulator control plane ([2068547](https://github.com/crvouga/mockingbird/commit/2068547bedde4e2e2331c1657c1a78120e84428b))
|
|
20
|
+
|
|
21
|
+
## 3.3.0 (2026-10-10)
|
|
4
22
|
|
|
5
23
|
### Features
|
|
6
24
|
|
package/DISCOVERY.md
CHANGED
|
@@ -35,6 +35,7 @@ repository; live parity is an additional oracle check, not a substitute for the
|
|
|
35
35
|
|
|
36
36
|
- `GET /__admin/health`
|
|
37
37
|
- `GET /__admin`
|
|
38
|
+
- `GET /__admin/controls`
|
|
38
39
|
- `GET /__admin/state`
|
|
39
40
|
- `GET /__admin/requests`
|
|
40
41
|
- `GET /__admin/metrics`
|
|
@@ -45,6 +46,28 @@ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/p
|
|
|
45
46
|
parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
|
|
46
47
|
designed for assertions and diagnosis by consuming test suites.
|
|
47
48
|
|
|
49
|
+
## Admin controls
|
|
50
|
+
|
|
51
|
+
Every HTTP emulator takes the same controls, and each means the same thing at boot
|
|
52
|
+
(`createRuntime({ adminControls })`, `serve --admin-controls`), over `/__admin`, and in a request header:
|
|
53
|
+
|
|
54
|
+
| Control | Admin API | Request header | Interface |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| Isolate state by key | `GET /__admin/namespaces` | `x-mockingbird-namespace: <key>` | [Namespaces](https://mockingbird.chrisvouga.dev/docs/admin-controls/namespaces) |
|
|
57
|
+
| Reset to boot | `POST /__admin/reset` | `x-mockingbird-reset: true` | [Reset](https://mockingbird.chrisvouga.dev/docs/admin-controls/reset) |
|
|
58
|
+
| Snapshot and restore | `POST /__admin/snapshots`, `POST /__admin/snapshots/<id>/restore` | `x-mockingbird-snapshot: <name>`, `x-mockingbird-restore: <name>` | [Snapshot and restore](https://mockingbird.chrisvouga.dev/docs/admin-controls/snapshot-and-restore) |
|
|
59
|
+
| Move the clock | `POST /__admin/clock` | `x-mockingbird-time: <instant>`, `x-mockingbird-advance: <duration>` | [Clock](https://mockingbird.chrisvouga.dev/docs/admin-controls/clock) |
|
|
60
|
+
| Read or branch from old state | `GET /__admin/timeline` | `x-mockingbird-at: <checkpoint>`, `x-mockingbird-branch: <name>` | [Checkpoints and branches](https://mockingbird.chrisvouga.dev/docs/admin-controls/checkpoints-and-branches) |
|
|
61
|
+
| Inject a fault | `POST /__admin/faults` | `x-mockingbird-fault: <fault>` | [Faults](https://mockingbird.chrisvouga.dev/docs/admin-controls/faults) |
|
|
62
|
+
| Latency and timeouts | `PUT /__admin/latency` | `x-mockingbird-delay: <duration>`, `x-mockingbird-timeout: <duration>` | [Latency and timeouts](https://mockingbird.chrisvouga.dev/docs/admin-controls/latency-and-timeouts) |
|
|
63
|
+
| Replay from a seed | `PUT /__admin/controls` | `x-mockingbird-seed: <seed>` | [Seed and determinism](https://mockingbird.chrisvouga.dev/docs/admin-controls/seed-and-determinism) |
|
|
64
|
+
| See what happened | `GET /__admin/requests`, `GET /__admin/state` | | [Journal, metrics and state](https://mockingbird.chrisvouga.dev/docs/admin-controls/journal-and-state) |
|
|
65
|
+
|
|
66
|
+
`GET /__admin` lists every route and header with a one-line summary, and `GET /__admin/controls`
|
|
67
|
+
is the namespace's current control document. The same seed and the same requests give the same
|
|
68
|
+
bytes. Setting controls as an emulator starts is [Boot](https://mockingbird.chrisvouga.dev/docs/admin-controls/boot); every route and header is in
|
|
69
|
+
the [Reference](https://mockingbird.chrisvouga.dev/docs/admin-controls/reference). The full guide: <https://mockingbird.chrisvouga.dev/docs/admin-controls>.
|
|
70
|
+
|
|
48
71
|
## Report a mismatch or missing capability
|
|
49
72
|
|
|
50
73
|
Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
|
package/README.md
CHANGED
|
@@ -13,8 +13,10 @@ npm install @crvouga/mockingbird-service-oauth
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
+
import * as oauth from "oauth4webapi"
|
|
16
17
|
import { createRuntime } from "@crvouga/mockingbird-service-oauth"
|
|
17
18
|
|
|
19
|
+
// Test setup: the identity provider, its test accounts and your registered client.
|
|
18
20
|
const identity = createRuntime({
|
|
19
21
|
provider: "google", // "apple", "microsoft", "github" or "oidc"
|
|
20
22
|
accounts: [
|
|
@@ -29,10 +31,17 @@ const identity = createRuntime({
|
|
|
29
31
|
}],
|
|
30
32
|
})
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
// Application code: the OIDC client it already uses (here oauth4webapi). Only its fetch
|
|
35
|
+
// changes: requests reach the emulator in this process instead of the real issuer.
|
|
36
|
+
const issuer = new URL("https://identity.test")
|
|
37
|
+
const options = {
|
|
38
|
+
[oauth.customFetch]: (url: string, init: RequestInit) => identity.fetch(new Request(url, init)),
|
|
39
|
+
}
|
|
40
|
+
const as = await oauth.processDiscoveryResponse(
|
|
41
|
+
issuer,
|
|
42
|
+
await oauth.discoveryRequest(issuer, options),
|
|
34
43
|
)
|
|
35
|
-
console.log(
|
|
44
|
+
console.log(as.authorization_endpoint, as.token_endpoint, as.jwks_uri)
|
|
36
45
|
|
|
37
46
|
// The same interface can be mounted in Bun, Deno, a worker or an HTTP adapter.
|
|
38
47
|
// Browser execution needs a secure context for Web Crypto.
|
|
@@ -43,11 +52,20 @@ void fetchHandler
|
|
|
43
52
|
Serve from Node (also works in Bun):
|
|
44
53
|
|
|
45
54
|
```ts
|
|
55
|
+
import * as oauth from "oauth4webapi"
|
|
46
56
|
import { createServer } from "@crvouga/mockingbird-service-oauth/server"
|
|
47
57
|
|
|
48
58
|
const server = await createServer({ port: 8810, provider: "apple" })
|
|
49
|
-
console.log(server.url)
|
|
50
59
|
// Register clients and seed accounts through /__admin, or pass them to createServer.
|
|
60
|
+
|
|
61
|
+
// Application code: its OIDC client, with the issuer set to server.url.
|
|
62
|
+
const issuer = new URL(server.url)
|
|
63
|
+
const as = await oauth.processDiscoveryResponse(
|
|
64
|
+
issuer,
|
|
65
|
+
// oauth4webapi requires HTTPS unless allowInsecureRequests is set; loopback needs it.
|
|
66
|
+
await oauth.discoveryRequest(issuer, { [oauth.allowInsecureRequests]: true }),
|
|
67
|
+
)
|
|
68
|
+
console.log(as.authorization_endpoint) // http://127.0.0.1:8810/auth/authorize
|
|
51
69
|
await server.close()
|
|
52
70
|
```
|
|
53
71
|
|
|
@@ -78,6 +96,7 @@ The issuer defaults to the incoming origin (and `/__admin/ns/<name>` when used).
|
|
|
78
96
|
`createMultiRuntime({ mounts })` and `createMultiServer({ mounts })` mount independent providers at exact paths on one origin. Discovery, endpoint URLs, token issuers, signing keys, clients, grants, sessions, faults, journals, and namespace state remain isolated per mount.
|
|
79
97
|
|
|
80
98
|
```ts
|
|
99
|
+
import * as oauth from "oauth4webapi"
|
|
81
100
|
import { createMultiServer } from "@crvouga/mockingbird-service-oauth/server"
|
|
82
101
|
|
|
83
102
|
const accounts = [{ id: "ada", name: "Ada Lovelace", email: "ada@example.test" }]
|
|
@@ -91,6 +110,15 @@ const server = await createMultiServer({
|
|
|
91
110
|
{ path: "/oauth2", provider: "microsoft", clients, accounts },
|
|
92
111
|
],
|
|
93
112
|
})
|
|
113
|
+
|
|
114
|
+
// Application code: each mount is its own issuer for the app's OIDC client.
|
|
115
|
+
const google = new URL(`${server.url}/google`)
|
|
116
|
+
const as = await oauth.processDiscoveryResponse(
|
|
117
|
+
google,
|
|
118
|
+
await oauth.discoveryRequest(google, { [oauth.allowInsecureRequests]: true }),
|
|
119
|
+
)
|
|
120
|
+
console.log(as.token_endpoint) // http://127.0.0.1:<port>/google/token
|
|
121
|
+
await server.close()
|
|
94
122
|
```
|
|
95
123
|
|
|
96
124
|
Use `/__admin/ns/<name>/<mount>/…` for URL-selected namespaces. `GET /__admin/health` reports every mount; `POST /__admin/reset?all=1` resets them atomically. Other aggregate admin requests select a runtime with `?mount=/google`, while mount-scoped controls are also available at `/google/__admin/*`. Duplicate or unsafe mount paths, duplicate explicit issuers, and duplicate client/key IDs within a mount fail before the listener starts.
|