@crvouga/mockingbird-service-oauth 3.0.0 → 3.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/CHANGELOG.md +10 -4
- package/DISCOVERY.md +2 -2
- package/README.md +12 -12
- package/SUPPORT.md +4 -4
- package/dist/{chunk-L7GVSS4G.js → chunk-KZJ46OLU.js} +4 -4
- package/dist/{chunk-L7GVSS4G.js.map → chunk-KZJ46OLU.js.map} +2 -2
- package/dist/{chunk-YNOWCZWB.js → chunk-YZAZ5ZDZ.js} +5 -5
- package/dist/{chunk-YNOWCZWB.js.map → chunk-YZAZ5ZDZ.js.map} +2 -2
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/openapi.yaml +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-oauth
|
|
2
2
|
|
|
3
|
+
## 3.1.0 (2026-10-08)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- redesign emulator experience ([d6038c2](https://github.com/crvouga/mockingbird/commit/d6038c27eebbaa1751f02bc9305002a5b1304779))
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- `@crvouga/mockingbird-service-sqlite`
|
|
12
|
+
|
|
3
13
|
## 3.0.0 (2026-10-07)
|
|
4
14
|
|
|
5
15
|
### ⚠️ Breaking changes
|
|
@@ -14,10 +24,6 @@
|
|
|
14
24
|
- typecheck the brand gate before builds ([fc36095](https://github.com/crvouga/mockingbird/commit/fc3609514de70ffe3170a5d216fb8a49f9ce7cbb))
|
|
15
25
|
- format the emulates records query ([8698872](https://github.com/crvouga/mockingbird/commit/8698872509d06002be5a8fcdc85d79f8462320c3))
|
|
16
26
|
|
|
17
|
-
### Dependencies
|
|
18
|
-
|
|
19
|
-
- `@crvouga/mockingbird-service-sqlite`
|
|
20
|
-
|
|
21
27
|
## 2.3.0 (2026-10-04)
|
|
22
28
|
|
|
23
29
|
### Features
|
package/DISCOVERY.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @crvouga/mockingbird-service-oauth discovery
|
|
2
2
|
|
|
3
3
|
This is the installed-package index for coding agents and tooling. All relative links resolve
|
|
4
|
-
inside `node_modules/@crvouga/mockingbird-service-oauth/`; no repository checkout is needed to discover the
|
|
4
|
+
inside `node_modules/@crvouga/mockingbird-service-oauth/`; no repository checkout is needed to discover the emulator's
|
|
5
5
|
supported surface or documented behavior.
|
|
6
6
|
|
|
7
7
|
## Capability and behavior sources
|
|
@@ -48,7 +48,7 @@ designed for assertions and diagnosis by consuming test suites.
|
|
|
48
48
|
## Report a mismatch or missing capability
|
|
49
49
|
|
|
50
50
|
Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
|
|
51
|
-
operation/command, a minimal redacted request, actual
|
|
51
|
+
operation/command, a minimal redacted request, actual emulator result, expected oracle result or vendor
|
|
52
52
|
documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
|
|
53
53
|
customer data, prompts, PHI, card data, or unredacted recordings.
|
|
54
54
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @crvouga/mockingbird-service-oauth
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Local emulators. Real API contracts. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
|
|
4
4
|
|
|
5
5
|
A stateful OAuth 2.0 / OpenID Connect identity sandbox. Google, Apple, Microsoft and GitHub wire profiles share a vendor-neutral account chooser, signup and consent UI. Generic OIDC works with other configurable identity clients. Uses real RS256 signatures, discovery, JWKS, authorization codes, S256 PKCE, refresh tokens and revocation.
|
|
6
6
|
|
|
@@ -55,9 +55,9 @@ await server.close()
|
|
|
55
55
|
npx mockingbird-oauth serve --provider google --port 8810
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
### Point an app at the
|
|
58
|
+
### Point an app at the emulator
|
|
59
59
|
|
|
60
|
-
Override the authorization, token, userinfo and JWKS endpoints in your application's OAuth provider configuration. Set its expected issuer to the
|
|
60
|
+
Override the authorization, token, userinfo and JWKS endpoints in your application's OAuth provider configuration. Set its expected issuer to the emulator's public base URL. Discovery is at `/.well-known/openid-configuration` for OIDC profiles; GitHub uses explicit OAuth endpoints and does not issue ID tokens. Register the **exact** callback URL (including scheme, port, path and query); wildcard callbacks are not accepted. No outgoing requests to a vendor occur.
|
|
61
61
|
|
|
62
62
|
| Profile | Authorization | Token | JWKS | Userinfo |
|
|
63
63
|
| --- | --- | --- | --- | --- |
|
|
@@ -67,9 +67,9 @@ Override the authorization, token, userinfo and JWKS endpoints in your applicati
|
|
|
67
67
|
| `github` | `/login/oauth/authorize` | `/login/oauth/access_token` | Not an OIDC provider | `/user`, `/user/emails` |
|
|
68
68
|
| `oidc` | `/authorize` | `/token` | `/jwks` | `/userinfo` |
|
|
69
69
|
|
|
70
|
-
`/authorize`, `/token`, `/jwks`, `/revoke` are common aliases. Google also accepts `/o/oauth2/auth` and `/oauth2/v3/userinfo`; Apple revocation is `/auth/revoke`. Token and revocation requests use `application/x-www-form-urlencoded`. Token client authentication supports Basic, body credentials, and public clients. Public clients must use S256 PKCE; confidential clients can opt in with `requirePkce: true`. Google
|
|
70
|
+
`/authorize`, `/token`, `/jwks`, `/revoke` are common aliases. Google also accepts `/o/oauth2/auth` and `/oauth2/v3/userinfo`; Apple revocation is `/auth/revoke`. Token and revocation requests use `application/x-www-form-urlencoded`. Token client authentication supports Basic, body credentials, and public clients. Public clients must use S256 PKCE; confidential clients can opt in with `requirePkce: true`. Google emulator client secrets are fixture strings configured on the client. Apple clients can use either a fixture string or `apple: { teamId, keyId, publicKey }`, where `publicKey` is an EC P-256 public JWK. In JWT mode the emulator verifies the ES256 signature, key ID, team, subject, Apple audience, issue/expiry times and maximum lifetime. The application can keep generating its usual Apple client-secret JWTs with the corresponding test private key.
|
|
71
71
|
|
|
72
|
-
For example, an Auth.js-style OIDC provider can use `type: "oidc"`, `issuer: "http://localhost:8810"`, `clientId`, `clientSecret`, and `checks: ["pkce", "state"]`. For existing Google/Apple presets, override **all** remote endpoints and issuer validation; changing the authorization URL alone is insufficient. In-process HTTP clients can route requests to `identity.fetch`. Browser navigation must reach a served
|
|
72
|
+
For example, an Auth.js-style OIDC provider can use `type: "oidc"`, `issuer: "http://localhost:8810"`, `clientId`, `clientSecret`, and `checks: ["pkce", "state"]`. For existing Google/Apple presets, override **all** remote endpoints and issuer validation; changing the authorization URL alone is insufficient. In-process HTTP clients can route requests to `identity.fetch`. Browser navigation must reach a served emulator or a service worker that routes those requests.
|
|
73
73
|
|
|
74
74
|
The issuer defaults to the incoming origin (and `/__admin/ns/<name>` when used). Set `issuer` to the public URL behind a reverse proxy; it may include a mount path. Avoid a fixed issuer shared across namespaces: use the namespace URL and its own discovery/JWKS so each namespace remains an independent issuer.
|
|
75
75
|
|
|
@@ -146,7 +146,7 @@ tapping `oauth-mock-form-post-continue`; with scripts, the page submits the form
|
|
|
146
146
|
|
|
147
147
|
- Authorization-code flow with exact redirect matching, including explicitly registered private-use URI schemes for native apps, state and nonce; duplicate parameters rejected. Invalid clients/callbacks never redirect. Public native clients require S256 PKCE.
|
|
148
148
|
- Real RSA-2048 / RS256 ID tokens and independent public JWKS; correct issuer, audience, expiry, auth time and scope-filtered claims. Keys remain stable until explicitly rotated.
|
|
149
|
-
- Codes expire after 5 minutes and are consumed atomically, including concurrent PKCE redemption. Access/ID tokens last 1 hour. Generic OIDC refresh tokens default to 30 days; Microsoft defaults to 90 days. Apple/Google refresh tokens have no fixed deadline by default; Google inactivity, testing mode and issuance limits still apply. GitHub OAuth app access tokens have no fixed deadline in the
|
|
149
|
+
- Codes expire after 5 minutes and are consumed atomically, including concurrent PKCE redemption. Access/ID tokens last 1 hour. Generic OIDC refresh tokens default to 30 days; Microsoft defaults to 90 days. Apple/Google refresh tokens have no fixed deadline by default; Google inactivity, testing mode and issuance limits still apply. GitHub OAuth app access tokens have no fixed deadline in the emulator. The injected emulator clock controls expiry.
|
|
150
150
|
- Google `access_type=offline` issues refresh tokens on first consent or `prompt=consent`; generic/Microsoft `offline_access` and Apple issue refresh tokens. Refresh cannot expand scopes. Revocation invalidates related access and refresh tokens; unknown tokens succeed idempotently. Refresh tokens are reusable by default; Microsoft returns a replacement without invalidating the old token. Opt-in strict rotation detects reuse and revokes the token family.
|
|
151
151
|
- `prompt=none` returns `login_required` or `consent_required`; `login`, `consent`, `select_account`, `login_hint` and `max_age` are supported. HttpOnly, SameSite=Lax browser sessions last 24 hours. Cancel returns `access_denied` with state.
|
|
152
152
|
- Apple supports `code id_token`, `c_hash`, `form_post` with an automatic POST and a no-JavaScript Continue button, string `email_verified` / `is_private_email`, no userinfo endpoint, and first-consent-only `user` data. `name` / `email` scopes require `form_post`.
|
|
@@ -218,7 +218,7 @@ These routes use the shared admin-key and namespace controls. `revokeConsent(cli
|
|
|
218
218
|
|
|
219
219
|
### Sign in with Apple server-to-server notifications
|
|
220
220
|
|
|
221
|
-
Register an Apple client with `apple.notificationUrl` (an HTTP(S) URL; requires the JWT `apple` client form) and the
|
|
221
|
+
Register an Apple client with `apple.notificationUrl` (an HTTP(S) URL; requires the JWT `apple` client form) and the emulator behaves like Apple's [server-to-server notification endpoint](https://developer.apple.com/documentation/signinwithapplerestapi/processing-changes-for-sign-in-with-apple-accounts): it POSTs `{"payload": "<JWS>"}` as JSON. The JWS is signed by the current signing key (verify it against the JWKS) with `iss` = the issuer, `aud` = the client id, `iat` from the emulator clock and a random `jti`. `events` is a JSON string of `{ type, sub, event_time }`, where `sub` is the client's identity for the account and `event_time` is milliseconds from the emulator clock.
|
|
222
222
|
|
|
223
223
|
| Trigger | Event `type` | Sent to |
|
|
224
224
|
| --- | --- | --- |
|
|
@@ -250,7 +250,7 @@ const runtime = createRuntime({
|
|
|
250
250
|
|
|
251
251
|
### Shared service controls
|
|
252
252
|
|
|
253
|
-
The runtime supplies `/__admin/health`, `/__admin/reset`, snapshots,
|
|
253
|
+
The runtime supplies `/__admin/health`, `/__admin/reset`, snapshots, emulator clock, request journal, metrics, fault injection and namespace isolation. Use `x-mockingbird-namespace` for in-process tests or `/__admin/ns/<name>/…` for complete browser flows. Header-selected namespaces alone cannot persist across ordinary browser navigation. State, grants, sessions and consent live in the shared SQLite abstraction; there are no filesystem or Node imports in the main entry.
|
|
254
254
|
|
|
255
255
|
`OAUTH_PRESETS` includes `token_unavailable` and `access_denied`. Fault rules can also target a provider-specific path, e.g. `POST /__admin/faults` with `{"pathPrefix":"/auth/token","status":503,"body":{"error":"temporarily_unavailable"}}`. The only outbound requests are the Apple notifications above. Journals contain request metadata, never passwords or request bodies.
|
|
256
256
|
|
|
@@ -282,7 +282,7 @@ references below.
|
|
|
282
282
|
|
|
283
283
|
This is a ready-to-use local/test identity provider, **not a production authentication server or a claim that every proprietary provider feature is implemented**. Its ready tier covers the documented OAuth/OIDC login, identity, consent, token, provider-edge-case, and UI surface. Applications should still run a small final check against each real provider before release.
|
|
284
284
|
|
|
285
|
-
Vendor-hosted Google Identity Services/One Tap, native Apple AuthenticationServices, passkeys, MFA, CAPTCHA, password recovery, email delivery/relay forwarding (only Apple's notification of a forwarding change is sent), app-transfer migration, vendor risk engines, tokeninfo/introspection, logout, GitHub Apps installation/device flows, and Microsoft Graph/tenant administration are not implemented. Other configurable OIDC providers can use the generic profile, but their proprietary scopes and claims are not emulated. Scopes are limited to each profile plus explicitly configured additional scopes. Microsoft uses the configured
|
|
285
|
+
Vendor-hosted Google Identity Services/One Tap, native Apple AuthenticationServices, passkeys, MFA, CAPTCHA, password recovery, email delivery/relay forwarding (only Apple's notification of a forwarding change is sent), app-transfer migration, vendor risk engines, tokeninfo/introspection, logout, GitHub Apps installation/device flows, and Microsoft Graph/tenant administration are not implemented. Other configurable OIDC providers can use the generic profile, but their proprietary scopes and claims are not emulated. Scopes are limited to each profile plus explicitly configured additional scopes. Microsoft uses the configured emulator issuer, not real Entra tenant routing. GitHub is the OAuth app login surface, not the full REST API.
|
|
286
286
|
|
|
287
287
|
No implicit flow, dynamic client registration, wildcard redirect matching, persistent signing-key storage (keys are held in memory; supply them through `signingKeys` or derive them from a seed), or distributed-session coordination is provided. Private-use redirect schemes work only when their complete URI is explicitly registered; executable/local schemes such as `javascript:`, `data:` and `file:` are rejected. Sign-in and consent pages extend CSP `form-action` with the transaction's redirect origin (or custom scheme). Browser navigation responses use a provider-owned handoff document so the callback can relay through another origin without inheriting the consent form's policy; direct programmatic interaction requests retain their HTTP redirect response. Discovery, JWKS, token, userinfo and revoke answer `OPTIONS` preflights and reflect the request `Origin`, so browser (SPA + PKCE) clients can redeem codes directly; the interaction pages send no CORS headers. Snapshot restore is for the same runtime/instance; signing keys are not serialized. The default backing store is in-memory and state disappears when the process exits. A secure browser context and Web Crypto, Fetch and standard Web APIs are required; Node 22+, Bun and modern browsers provide them.
|
|
288
288
|
|
|
@@ -305,7 +305,7 @@ state.
|
|
|
305
305
|
The service-owned source lives in `examples/google-login/`: a real Hono app uses
|
|
306
306
|
`oauth4webapi` to discover OIDC providers, generate PKCE/state/nonce, exchange the code, verify
|
|
307
307
|
JWT signatures against JWKS, fetch identity data, and establish a session. GitHub mode uses its
|
|
308
|
-
explicit OAuth endpoints, numeric account ID, and `/user/emails` fallback. Popup mode keeps the host app visible while a separate sign-in window renders the
|
|
308
|
+
explicit OAuth endpoints, numeric account ID, and `/user/emails` fallback. Popup mode keeps the host app visible while a separate sign-in window renders the emulator's
|
|
309
309
|
actual HTML response. Redirect mode replaces the preview with the provider document and
|
|
310
310
|
returns to the app on callback. The popup closes on callback and the app updates with the result. Browsers that
|
|
311
311
|
block new windows use a separate modal dialog with its own provider document. Closing the
|
|
@@ -324,7 +324,7 @@ standard cookie headers. This mapping is a transport detail, not a browser cooki
|
|
|
324
324
|
|
|
325
325
|
### Presentation and account selection
|
|
326
326
|
|
|
327
|
-
The provider UI is neutral and labelled **OAuth
|
|
327
|
+
The provider UI is neutral and labelled **OAuth Emulator**, with no vendor or product branding.
|
|
328
328
|
Its **System / Light / Dark** controls work on standalone HTML pages; the selection persists
|
|
329
329
|
across pages in that browser session. The in-process example bridges the same controls into
|
|
330
330
|
the pasted pages. System mode follows the operating system, independently of the
|
|
@@ -346,7 +346,7 @@ const dispose = await mount(host, {
|
|
|
346
346
|
|
|
347
347
|
Popup versus redirect is an application presentation choice; both use the same authorization
|
|
348
348
|
endpoint and callback validation. The demo uses `prompt=select_account` to force the chooser.
|
|
349
|
-
For any integrating app, session reuse can also be disabled on the
|
|
349
|
+
For any integrating app, session reuse can also be disabled on the emulator itself:
|
|
350
350
|
|
|
351
351
|
```ts
|
|
352
352
|
import { OAuthAPI } from "@crvouga/mockingbird-service-oauth"
|
package/SUPPORT.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Generated from `openapi.yaml`; do not edit by hand.
|
|
4
4
|
|
|
5
5
|
- operations in spec: **32**
|
|
6
|
-
- supported by the
|
|
6
|
+
- supported by the emulator: **32**
|
|
7
7
|
- parity enabled: **4**
|
|
8
8
|
|
|
9
|
-
| operationId | route |
|
|
9
|
+
| operationId | route | emulator | parity | notes |
|
|
10
10
|
| --- | --- | --- | --- | --- |
|
|
11
11
|
| `Discovery` | `GET /.well-known/openid-configuration` | ✅ supported | ✅ | Google, Apple and Microsoft discovery metadata is checked against their public live endpoints by scripts/parity.ts. |
|
|
12
12
|
| `Jwks` | `GET /jwks` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. |
|
|
13
13
|
| `Authorize` | `GET /authorize` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. |
|
|
14
|
-
| `InteractionPage` | `GET /interaction` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. The pages carry the documented oauth-
|
|
15
|
-
| `Interact` | `POST /interaction` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. The pages carry the documented oauth-
|
|
14
|
+
| `InteractionPage` | `GET /interaction` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. The pages carry the documented oauth-emulator-* data-testid hooks (README, "Test hooks on the interaction pages"). |
|
|
15
|
+
| `Interact` | `POST /interaction` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. The pages carry the documented oauth-emulator-* data-testid hooks (README, "Test hooks on the interaction pages"). |
|
|
16
16
|
| `Token` | `POST /token` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. |
|
|
17
17
|
| `UserInfo` | `GET /userinfo` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. |
|
|
18
18
|
| `UserInfoPost` | `POST /userinfo` | ✅ supported | ❌ disabled | Interactive OAuth transactions are exercised by protocol and independent JOSE tests. |
|