@noodleseed/one 0.63.1 → 0.65.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/dist/auth-discovery.d.ts +17 -0
- package/dist/auth-discovery.d.ts.map +1 -0
- package/dist/auth-discovery.js +54 -0
- package/dist/auth-discovery.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/catalog-data-platform-auth.d.ts +7 -0
- package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -0
- package/dist/commands/catalog-data-platform-auth.js +47 -0
- package/dist/commands/catalog-data-platform-auth.js.map +1 -0
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +6 -3
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/docs-mcp.d.ts +3 -3
- package/dist/commands/docs-mcp.js +3 -3
- package/dist/commands/platform-auth-finalization-args.d.ts +13 -0
- package/dist/commands/platform-auth-finalization-args.d.ts.map +1 -0
- package/dist/commands/platform-auth-finalization-args.js +29 -0
- package/dist/commands/platform-auth-finalization-args.js.map +1 -0
- package/dist/commands/platform-auth-migration-args.d.ts +71 -0
- package/dist/commands/platform-auth-migration-args.d.ts.map +1 -0
- package/dist/commands/platform-auth-migration-args.js +320 -0
- package/dist/commands/platform-auth-migration-args.js.map +1 -0
- package/dist/commands/platform-auth-migration-ops.d.ts +3 -0
- package/dist/commands/platform-auth-migration-ops.d.ts.map +1 -0
- package/dist/commands/platform-auth-migration-ops.js +369 -0
- package/dist/commands/platform-auth-migration-ops.js.map +1 -0
- package/dist/commands/project-setup.js +1 -1
- package/dist/commands/project-setup.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/control-plane.d.ts +0 -11
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +1 -8
- package/dist/control-plane.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +3 -5
- package/dist/doctor.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +2 -2
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +26 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +105 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js +99 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +15 -0
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/main.js +112 -19
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.js +9 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts +24 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js +88 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts +5 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js +19 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js +62 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.js +20 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js +2 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js +58 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js +49 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js +7 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts +20 -25
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +105 -196
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +157 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +110 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +7 -4
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +63 -120
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +19 -6
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +24 -2
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js +8 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +109 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js +30 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts +21 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +56 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts +30 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +94 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts +33 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js +27 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js +63 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js +40 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts +115 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js +310 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts +65 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.js +85 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts +11 -2
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/personal-workspace.js +8 -2
- package/node_modules/@noodle-borg/service/dist/personal-workspace.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +67 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js +54 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js +61 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts +32 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +231 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js +350 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts +50 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +239 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts +66 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js +77 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts +40 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js +355 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js +230 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +126 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js +86 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts +42 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js +368 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts +86 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js +474 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js +435 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts +202 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js +313 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts +48 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js +158 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts +43 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts +31 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js +94 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts +102 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js +2 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js +367 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts +10 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js +37 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js +156 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js +162 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js +271 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js +67 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js +47 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +1569 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js +274 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js +163 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js +274 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js +120 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts +79 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js +88 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js +38 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts +61 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js +292 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts +19 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js +121 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +119 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js +194 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +93 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +32 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +68 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +23 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +231 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +399 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js +25 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js +74 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +19 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +249 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +275 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +98 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +179 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +110 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js +312 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.js +3 -9
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js +3 -3
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js +3 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js +40 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js +158 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +21 -3
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +61 -146
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +3 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +17 -29
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/control-plane.js +60 -19
- package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +1 -2
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +0 -40
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts +5 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js +176 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +43 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js +2 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +71 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.js +175 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -0
- package/node_modules/@noodle-borg/service/package.json +1 -0
- package/node_modules/@workos-inc/node/LICENSE +21 -0
- package/node_modules/@workos-inc/node/README.md +140 -0
- package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.cts +9727 -0
- package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.mts +9727 -0
- package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs +8426 -0
- package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs +8241 -0
- package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.cjs +449 -0
- package/node_modules/@workos-inc/node/lib/index.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.d.cts +478 -0
- package/node_modules/@workos-inc/node/lib/index.d.mts +478 -0
- package/node_modules/@workos-inc/node/lib/index.mjs +394 -0
- package/node_modules/@workos-inc/node/lib/index.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.worker.cjs +60 -0
- package/node_modules/@workos-inc/node/lib/index.worker.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.worker.d.cts +16 -0
- package/node_modules/@workos-inc/node/lib/index.worker.d.mts +16 -0
- package/node_modules/@workos-inc/node/lib/index.worker.mjs +35 -0
- package/node_modules/@workos-inc/node/lib/index.worker.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs +3224 -0
- package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs +3271 -0
- package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs.map +1 -0
- package/node_modules/@workos-inc/node/package.json +96 -0
- package/package.json +2 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createJwtVerifier } from '@noodle-borg/auth';
|
|
2
|
+
import { noopLogger } from '@noodle-borg/transport-http';
|
|
3
|
+
import { createCustomerVerifierFactory } from '../customer-verifier.js';
|
|
4
|
+
import { geminiEnterpriseDefaultResourceForClient } from '../gemini-enterprise-oauth.js';
|
|
5
|
+
import { normalizeOAuthResource } from '../http-util.js';
|
|
6
|
+
import { ensurePersonalWorkspace } from '../personal-workspace.js';
|
|
7
|
+
import { PlatformPrincipalResolver } from '../platform-identity.js';
|
|
8
|
+
import { PostgresPlatformIdentityStore } from '../platform-identity-postgres.js';
|
|
9
|
+
import { allowedMcpBaseDomains, bridgeAuthForResource, managedSecretForResource, sealCustomerCredential, } from '../serve-resource-auth.js';
|
|
10
|
+
import { createDeveloperGrantAuthorizer, resolveDeveloperGrantStore, } from './developer-grant-bootstrap.js';
|
|
11
|
+
import { guardPlatformAccessTokenVerifier } from './platform-principal-guard.js';
|
|
12
|
+
/** Build the co-hosted authorization server and its durable upstream-human dependencies. */
|
|
13
|
+
export async function resolveServiceOAuthBootstrap(input) {
|
|
14
|
+
const { options } = input;
|
|
15
|
+
let authServerApp;
|
|
16
|
+
let resolvedVerifyOwnerToken = options.verifyOwnerToken;
|
|
17
|
+
let resolvedAuthServerIssuer = options.authServerIssuer;
|
|
18
|
+
let oauthStore;
|
|
19
|
+
let developerGrantStore = options.developerGrantStore;
|
|
20
|
+
let delegatedExchange;
|
|
21
|
+
const allowedMcpDomains = allowedMcpBaseDomains(options);
|
|
22
|
+
const rawCustomerVerifierFactory = createCustomerVerifierFactory({
|
|
23
|
+
allowInsecureLocalhost: options.customerVerifierAllowInsecureLocalhost === true,
|
|
24
|
+
...(options.customerVerifierFirebaseJwks !== undefined
|
|
25
|
+
? { firebaseJwks: options.customerVerifierFirebaseJwks }
|
|
26
|
+
: {}),
|
|
27
|
+
...(options.customerVerifierFirebaseJwksUri !== undefined
|
|
28
|
+
? { firebaseJwksUri: options.customerVerifierFirebaseJwksUri }
|
|
29
|
+
: {}),
|
|
30
|
+
});
|
|
31
|
+
if (options.oauth) {
|
|
32
|
+
if (input.pool) {
|
|
33
|
+
const { PostgresOAuthStore } = await import('./store-postgres.js');
|
|
34
|
+
const postgresOAuth = new PostgresOAuthStore(input.pool, {
|
|
35
|
+
enforcePlatformPrincipalSuspension: input.platformIdentityStore instanceof PostgresPlatformIdentityStore,
|
|
36
|
+
});
|
|
37
|
+
await postgresOAuth.ensureSchema();
|
|
38
|
+
oauthStore = postgresOAuth;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const { InMemoryOAuthStore } = await import('./store.js');
|
|
42
|
+
oauthStore = new InMemoryOAuthStore();
|
|
43
|
+
}
|
|
44
|
+
developerGrantStore = await resolveDeveloperGrantStore({
|
|
45
|
+
...(input.pool === undefined ? {} : { pool: input.pool }),
|
|
46
|
+
...(options.developerGrantStore === undefined ? {} : { store: options.developerGrantStore }),
|
|
47
|
+
});
|
|
48
|
+
const [{ NoodleOAuthProvider }, { createOAuthApp }, { createConfiguredWorkOSHumanAuthenticator },] = await Promise.all([import('./provider.js'), import('./app.js'), import('./workos.js')]);
|
|
49
|
+
// Normalize once so the token `iss`, the verifier's expected issuer, and the PRM `authorization_servers`
|
|
50
|
+
// entry are byte-identical (a trailing-slash `PUBLIC_BASE_URL` would otherwise desync them).
|
|
51
|
+
const oauthIssuer = options.oauth.issuer.replace(/\/+$/, '');
|
|
52
|
+
const workosAuthenticator = createConfiguredWorkOSHumanAuthenticator(oauthIssuer, options.oauth.workos);
|
|
53
|
+
if (options.oauth.google === undefined && workosAuthenticator === undefined) {
|
|
54
|
+
throw new Error('self-hosted OAuth requires at least one upstream human authenticator');
|
|
55
|
+
}
|
|
56
|
+
const { reconcileConfiguredConsoleOAuthClient } = await import('./first-party-client.js');
|
|
57
|
+
await reconcileConfiguredConsoleOAuthClient(oauthStore, options.oauth.consoleClient, normalizeOAuthResource(options.publicBaseUrl ?? oauthIssuer));
|
|
58
|
+
// The same issuer/signer pair backs delegated token-exchange assertions (ADR 0152) so customer
|
|
59
|
+
// token endpoints verify them against the already-published platform JWKS.
|
|
60
|
+
delegatedExchange = { issuer: oauthIssuer, signer: options.oauth.signer };
|
|
61
|
+
const provider = new NoodleOAuthProvider({
|
|
62
|
+
issuer: oauthIssuer,
|
|
63
|
+
store: oauthStore,
|
|
64
|
+
signer: options.oauth.signer,
|
|
65
|
+
...(options.oauth.google === undefined ? {} : { google: options.oauth.google }),
|
|
66
|
+
...(workosAuthenticator === undefined
|
|
67
|
+
? {}
|
|
68
|
+
: { upstreamAuthenticators: { workos: workosAuthenticator } }),
|
|
69
|
+
...(input.platformIdentityStore === undefined
|
|
70
|
+
? {}
|
|
71
|
+
: {
|
|
72
|
+
platformPrincipalResolver: new PlatformPrincipalResolver(input.platformIdentityStore),
|
|
73
|
+
}),
|
|
74
|
+
customerBridgeAuthForResource: async (resource) => {
|
|
75
|
+
const registry = input.registry();
|
|
76
|
+
return registry === undefined
|
|
77
|
+
? undefined
|
|
78
|
+
: bridgeAuthForResource(registry, resource, allowedMcpDomains);
|
|
79
|
+
},
|
|
80
|
+
managedSecretForResource: async (resource, name) => {
|
|
81
|
+
const registry = input.registry();
|
|
82
|
+
return registry === undefined
|
|
83
|
+
? undefined
|
|
84
|
+
: managedSecretForResource(registry, resource, name, allowedMcpDomains);
|
|
85
|
+
},
|
|
86
|
+
verifyCustomerBridgeToken: async (auth, token) => {
|
|
87
|
+
const identity = await rawCustomerVerifierFactory(auth)(token, auth.projectId ?? '');
|
|
88
|
+
return identity === null ? null : { ...identity, scopes: identity.scopes ?? [] };
|
|
89
|
+
},
|
|
90
|
+
sealCustomerCredential: (credential) => sealCustomerCredential(input.secretBox, credential),
|
|
91
|
+
signupAuthorizer: input.controlPlaneStore,
|
|
92
|
+
signupMode: options.controlPlaneSignupMode ?? 'restricted',
|
|
93
|
+
deniedSignupDomains: options.deniedSignupDomains ?? [],
|
|
94
|
+
deniedSignupSubjects: options.deniedSignupSubjects ?? [],
|
|
95
|
+
...(input.platformIdentityStore === undefined ||
|
|
96
|
+
(options.controlPlaneSignupMode ?? 'restricted') !== 'public'
|
|
97
|
+
? {}
|
|
98
|
+
: {
|
|
99
|
+
provisionPlatformPrincipal: async (identity) => {
|
|
100
|
+
await ensurePersonalWorkspace(input.controlPlaneStore, {
|
|
101
|
+
...identity,
|
|
102
|
+
superAdmin: false,
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
developerGrantAuthorizer: createDeveloperGrantAuthorizer({
|
|
107
|
+
controlPlane: input.controlPlaneStore,
|
|
108
|
+
grants: developerGrantStore,
|
|
109
|
+
registry: input.registry,
|
|
110
|
+
}),
|
|
111
|
+
logger: options.logger ?? noopLogger,
|
|
112
|
+
defaultResourceForClient: (client) => geminiEnterpriseDefaultResourceForClient(client, oauthIssuer),
|
|
113
|
+
...(options.oauth.allowedEmailDomain !== undefined
|
|
114
|
+
? { allowedEmailDomain: options.oauth.allowedEmailDomain }
|
|
115
|
+
: {}),
|
|
116
|
+
...(options.oauth.refreshTokenGraceSeconds !== undefined
|
|
117
|
+
? { refreshTokenGraceSeconds: options.oauth.refreshTokenGraceSeconds }
|
|
118
|
+
: {}),
|
|
119
|
+
...(options.oauth.refreshTokenRecoverySeconds !== undefined
|
|
120
|
+
? { refreshTokenRecoverySeconds: options.oauth.refreshTokenRecoverySeconds }
|
|
121
|
+
: {}),
|
|
122
|
+
...(input.platformAuth.rolloutStore === undefined
|
|
123
|
+
? {}
|
|
124
|
+
: { upstreamRolloutStore: input.platformAuth.rolloutStore }),
|
|
125
|
+
});
|
|
126
|
+
authServerApp = createOAuthApp(provider, {
|
|
127
|
+
trustProxy: options.tls?.trustProxy === true,
|
|
128
|
+
});
|
|
129
|
+
resolvedAuthServerIssuer = resolvedAuthServerIssuer ?? oauthIssuer;
|
|
130
|
+
// Resource-server verification uses the AS signing key directly (co-hosted, same process), so an
|
|
131
|
+
// owner-only endpoint validates tokens without an HTTP JWKS fetch. Multi-instance-safe because the key is
|
|
132
|
+
// shared via env.
|
|
133
|
+
resolvedVerifyOwnerToken =
|
|
134
|
+
resolvedVerifyOwnerToken ??
|
|
135
|
+
createJwtVerifier({
|
|
136
|
+
issuer: oauthIssuer,
|
|
137
|
+
keyResolver: await options.oauth.signer.verifierKey(),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (resolvedVerifyOwnerToken !== undefined && input.platformIdentityStore !== undefined) {
|
|
141
|
+
resolvedVerifyOwnerToken = guardPlatformAccessTokenVerifier(resolvedVerifyOwnerToken, new PlatformPrincipalResolver(input.platformIdentityStore));
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
rawCustomerVerifierFactory,
|
|
145
|
+
...(authServerApp === undefined ? {} : { authServerApp }),
|
|
146
|
+
...(resolvedVerifyOwnerToken === undefined
|
|
147
|
+
? {}
|
|
148
|
+
: { verifyOwnerToken: resolvedVerifyOwnerToken }),
|
|
149
|
+
...(resolvedAuthServerIssuer === undefined
|
|
150
|
+
? {}
|
|
151
|
+
: { authServerIssuer: resolvedAuthServerIssuer }),
|
|
152
|
+
...(oauthStore === undefined ? {} : { oauthStore }),
|
|
153
|
+
...(developerGrantStore === undefined ? {} : { developerGrantStore }),
|
|
154
|
+
...(delegatedExchange === undefined ? {} : { delegatedExchange }),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=service-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-bootstrap.js","sourceRoot":"","sources":["../../src/oauth/service-bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA2B,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,UAAU,EAA2B,MAAM,6BAA6B,CA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,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,GAAG,CAAC,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC;QACrE,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Pool } from 'pg';
|
|
2
|
+
/** Creates and additively upgrades the shared OAuth authorization-server tables. */
|
|
3
|
+
export declare function ensureOAuthStoreSchema(pool: Pool, enforcePlatformPrincipalSuspension: boolean): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=store-postgres-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-postgres-schema.d.ts","sourceRoot":"","sources":["../../src/oauth/store-postgres-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAK/B,oFAAoF;AACpF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,kCAAkC,EAAE,OAAO,GAC1C,OAAO,CAAC,IAAI,CAAC,CA8Hf"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { installPlatformAuthInventorySourceFenceTriggers } from '../platform-auth-inventory-source-fence-postgres.js';
|
|
2
|
+
import { ensureDeviceAuthorizationSchema } from './device-store-postgres-schema.js';
|
|
3
|
+
import { ensurePlatformPrincipalSuspensionRefreshTrigger } from './platform-principal-postgres.js';
|
|
4
|
+
/** Creates and additively upgrades the shared OAuth authorization-server tables. */
|
|
5
|
+
export async function ensureOAuthStoreSchema(pool, enforcePlatformPrincipalSuspension) {
|
|
6
|
+
await pool.query(`
|
|
7
|
+
CREATE TABLE IF NOT EXISTS oauth_clients (
|
|
8
|
+
client_id text PRIMARY KEY,
|
|
9
|
+
client jsonb NOT NULL,
|
|
10
|
+
first_party_owner text,
|
|
11
|
+
created_at timestamptz NOT NULL DEFAULT now()
|
|
12
|
+
)
|
|
13
|
+
`);
|
|
14
|
+
await pool.query('ALTER TABLE oauth_clients ADD COLUMN IF NOT EXISTS first_party_owner text');
|
|
15
|
+
await pool.query(`
|
|
16
|
+
ALTER TABLE oauth_clients DROP CONSTRAINT IF EXISTS oauth_clients_first_party_owner_check;
|
|
17
|
+
ALTER TABLE oauth_clients ADD CONSTRAINT oauth_clients_first_party_owner_check
|
|
18
|
+
CHECK (first_party_owner IS NULL OR first_party_owner = 'console')
|
|
19
|
+
`);
|
|
20
|
+
await pool.query(`
|
|
21
|
+
CREATE TABLE IF NOT EXISTS oauth_pending_authorizations (
|
|
22
|
+
state text PRIMARY KEY,
|
|
23
|
+
client_id text NOT NULL,
|
|
24
|
+
redirect_uri text NOT NULL,
|
|
25
|
+
code_challenge text NOT NULL,
|
|
26
|
+
client_state text,
|
|
27
|
+
resource text NOT NULL,
|
|
28
|
+
scope text,
|
|
29
|
+
upstream_provider text NOT NULL DEFAULT 'google',
|
|
30
|
+
expires_at timestamptz NOT NULL
|
|
31
|
+
)
|
|
32
|
+
`);
|
|
33
|
+
await pool.query(`
|
|
34
|
+
CREATE TABLE IF NOT EXISTS oauth_authorization_codes (
|
|
35
|
+
code text PRIMARY KEY,
|
|
36
|
+
client_id text NOT NULL,
|
|
37
|
+
code_challenge text NOT NULL,
|
|
38
|
+
redirect_uri text NOT NULL,
|
|
39
|
+
resource text NOT NULL,
|
|
40
|
+
owner_subject text NOT NULL,
|
|
41
|
+
owner_email text,
|
|
42
|
+
owner_locale text,
|
|
43
|
+
owner_time_zone text,
|
|
44
|
+
scope text,
|
|
45
|
+
identity_kind text,
|
|
46
|
+
identity_provider text,
|
|
47
|
+
developer_grant_id text,
|
|
48
|
+
expires_at timestamptz NOT NULL
|
|
49
|
+
)
|
|
50
|
+
`);
|
|
51
|
+
await pool.query(`
|
|
52
|
+
CREATE TABLE IF NOT EXISTS oauth_refresh_tokens (
|
|
53
|
+
token text PRIMARY KEY,
|
|
54
|
+
client_id text NOT NULL,
|
|
55
|
+
owner_subject text NOT NULL,
|
|
56
|
+
owner_email text,
|
|
57
|
+
owner_locale text,
|
|
58
|
+
owner_time_zone text,
|
|
59
|
+
resource text NOT NULL,
|
|
60
|
+
scope text,
|
|
61
|
+
identity_kind text,
|
|
62
|
+
identity_provider text,
|
|
63
|
+
developer_grant_id text,
|
|
64
|
+
expires_at timestamptz NOT NULL,
|
|
65
|
+
family_id text,
|
|
66
|
+
rotated_at timestamptz,
|
|
67
|
+
superseded_by text
|
|
68
|
+
)
|
|
69
|
+
`);
|
|
70
|
+
if (enforcePlatformPrincipalSuspension) {
|
|
71
|
+
await ensurePlatformPrincipalSuspensionRefreshTrigger(pool);
|
|
72
|
+
}
|
|
73
|
+
await pool.query("ALTER TABLE oauth_pending_authorizations ADD COLUMN IF NOT EXISTS upstream_provider text NOT NULL DEFAULT 'google'");
|
|
74
|
+
await pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS identity_kind text');
|
|
75
|
+
await pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS owner_locale text');
|
|
76
|
+
await pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS owner_time_zone text');
|
|
77
|
+
await pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS identity_provider text');
|
|
78
|
+
await pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS developer_grant_id text');
|
|
79
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS identity_kind text');
|
|
80
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS owner_locale text');
|
|
81
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS owner_time_zone text');
|
|
82
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS identity_provider text');
|
|
83
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS developer_grant_id text');
|
|
84
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS family_id text');
|
|
85
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS rotated_at timestamptz');
|
|
86
|
+
await pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS superseded_by text');
|
|
87
|
+
await pool.query('CREATE INDEX IF NOT EXISTS oauth_refresh_tokens_family_id_idx ON oauth_refresh_tokens (family_id)');
|
|
88
|
+
await pool.query(`
|
|
89
|
+
CREATE TABLE IF NOT EXISTS oauth_consent_grants (
|
|
90
|
+
client_id text NOT NULL,
|
|
91
|
+
owner_subject text NOT NULL,
|
|
92
|
+
resource text NOT NULL,
|
|
93
|
+
granted_at timestamptz NOT NULL DEFAULT now(),
|
|
94
|
+
PRIMARY KEY (client_id, owner_subject, resource)
|
|
95
|
+
)
|
|
96
|
+
`);
|
|
97
|
+
await pool.query(`
|
|
98
|
+
CREATE TABLE IF NOT EXISTS oauth_delegated_credentials (
|
|
99
|
+
resource text NOT NULL,
|
|
100
|
+
provider text NOT NULL,
|
|
101
|
+
subject text NOT NULL,
|
|
102
|
+
credential jsonb NOT NULL,
|
|
103
|
+
updated_at timestamptz NOT NULL,
|
|
104
|
+
PRIMARY KEY (resource, provider, subject)
|
|
105
|
+
)
|
|
106
|
+
`);
|
|
107
|
+
await ensureDeviceAuthorizationSchema(pool);
|
|
108
|
+
await installPlatformAuthInventorySourceFenceTriggers(pool);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=store-postgres-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-postgres-schema.js","sourceRoot":"","sources":["../../src/oauth/store-postgres-schema.ts"],"names":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AAM,IAAI,CAAC,KAAK,CACd,kFAAkF,CACnF,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CACd,mFAAmF,CACpF,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC7F,MAAM,IAAI,CAAC,KAAK,CACd,kFAAkF,CACnF,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;IACjG,MAAM,IAAI,CAAC,KAAK,CACd,mGAAmG,CACpG,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;GAQhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;GAShB,CAAC,CAAC;IACH,MAAM,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,+CAA+C,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -2,8 +2,7 @@ import type { OAuthClientInformationFull } from '@modelcontextprotocol/sdk/share
|
|
|
2
2
|
import type { Pool } from 'pg';
|
|
3
3
|
import type { DeviceAuthorizationIdentity, DeviceAuthorizationPoll, DeviceAuthorizationRecord, DeviceBrowserSessionRecord } from './device-store.js';
|
|
4
4
|
import type { AuthorizationCodeRecord, ConsentGrantRecord, DelegatedCredentialLookup, DelegatedCredentialRecord, OAuthStore, PendingAuthorizationRecord, RefreshRotation, RefreshRotationInput, RefreshTokenRecord } from './store.js';
|
|
5
|
-
/**
|
|
6
|
-
* Relational {@link OAuthStore} for the self-hosted authorization server (OA-2,
|
|
5
|
+
/** Relational {@link OAuthStore} for the self-hosted authorization server (OA-2,
|
|
7
6
|
* [ADR 0042](../../../../docs/decisions/0042-self-hosted-oauth-authorization-server.md)). Shares the injected
|
|
8
7
|
* `pg.Pool` with {@link PostgresArtifactStore} so the AS state lives in the same strongly-consistent store
|
|
9
8
|
* that backs deployments — any Cloud Run instance can complete a flow another started.
|
|
@@ -14,13 +13,16 @@ import type { AuthorizationCodeRecord, ConsentGrantRecord, DelegatedCredentialLo
|
|
|
14
13
|
*/
|
|
15
14
|
export declare class PostgresOAuthStore implements OAuthStore {
|
|
16
15
|
#private;
|
|
17
|
-
constructor(pool: Pool
|
|
16
|
+
constructor(pool: Pool, options?: {
|
|
17
|
+
readonly enforcePlatformPrincipalSuspension?: boolean;
|
|
18
|
+
});
|
|
18
19
|
/** Create the OAuth tables if absent (idempotent). Run once at startup before serving AS endpoints. */
|
|
19
20
|
ensureSchema(): Promise<void>;
|
|
20
21
|
getClient(clientId: string): Promise<OAuthClientInformationFull | undefined>;
|
|
21
22
|
putClient(client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
|
|
23
|
+
putFirstPartyClient(owner: 'console', client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
|
|
22
24
|
createPendingAuthorization(record: PendingAuthorizationRecord): Promise<void>;
|
|
23
|
-
consumePendingAuthorization(state: string): Promise<PendingAuthorizationRecord | undefined>;
|
|
25
|
+
consumePendingAuthorization(state: string, expectedUpstreamProvider: PendingAuthorizationRecord['upstreamProvider']): Promise<PendingAuthorizationRecord | undefined>;
|
|
24
26
|
createAuthorizationCode(record: AuthorizationCodeRecord): Promise<void>;
|
|
25
27
|
getAuthorizationCode(code: string): Promise<AuthorizationCodeRecord | undefined>;
|
|
26
28
|
redeemAuthorizationCode(code: string): Promise<AuthorizationCodeRecord | undefined>;
|
|
@@ -38,6 +40,7 @@ export declare class PostgresOAuthStore implements OAuthStore {
|
|
|
38
40
|
}): Promise<DeviceAuthorizationPoll>;
|
|
39
41
|
completeDeviceTokenIssuance(deviceCode: string, clientId: string): Promise<boolean>;
|
|
40
42
|
createRefreshToken(record: RefreshTokenRecord): Promise<void>;
|
|
43
|
+
getRefreshToken(token: string): Promise<RefreshTokenRecord | undefined>;
|
|
41
44
|
consumeRefreshToken(token: string): Promise<RefreshTokenRecord | undefined>;
|
|
42
45
|
createConsentGrant(grant: ConsentGrantRecord): Promise<void>;
|
|
43
46
|
hasConsentGrant(clientId: string, ownerSubject: string, resource: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-postgres.d.ts","sourceRoot":"","sources":["../../src/oauth/store-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAC3C,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"store-postgres.d.ts","sourceRoot":"","sources":["../../src/oauth/store-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAC3C,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,UAAU,EACV,0BAA0B,EAE1B,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAGpB;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;gBAIvC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE;QAAE,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,CAAA;KAAO;IAK/F,uGAAuG;IACjG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IAQ5E,SAAS,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAclF,mBAAmB,CACvB,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7B,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA8D9B,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASnF,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAUvE,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAU3E,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IASb,sBAAsB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBxE,sBAAsB,CAC1B,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAkBjD;;;;OAIG;IACG,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;CA2HhF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ensureDeviceAuthorizationSchema } from './device-store-postgres-schema.js';
|
|
2
1
|
import { deviceBrowserRowToRecord, deviceRowToRecord, } from './device-store-postgres-types.js';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { lockAndAssertPlatformRefreshPrincipal } from './platform-principal-postgres.js';
|
|
3
|
+
import { postgresEpochSeconds, postgresTimestampIsLive } from './postgres-time.js';
|
|
4
|
+
import { ensureOAuthStoreSchema } from './store-postgres-schema.js';
|
|
5
|
+
/** Relational {@link OAuthStore} for the self-hosted authorization server (OA-2,
|
|
5
6
|
* [ADR 0042](../../../../docs/decisions/0042-self-hosted-oauth-authorization-server.md)). Shares the injected
|
|
6
7
|
* `pg.Pool` with {@link PostgresArtifactStore} so the AS state lives in the same strongly-consistent store
|
|
7
8
|
* that backs deployments — any Cloud Run instance can complete a flow another started.
|
|
@@ -12,116 +13,44 @@ import { deviceBrowserRowToRecord, deviceRowToRecord, } from './device-store-pos
|
|
|
12
13
|
*/
|
|
13
14
|
export class PostgresOAuthStore {
|
|
14
15
|
#pool;
|
|
15
|
-
|
|
16
|
+
#enforcePlatformPrincipalSuspension;
|
|
17
|
+
constructor(pool, options = {}) {
|
|
16
18
|
this.#pool = pool;
|
|
19
|
+
this.#enforcePlatformPrincipalSuspension = options.enforcePlatformPrincipalSuspension === true;
|
|
17
20
|
}
|
|
18
21
|
/** Create the OAuth tables if absent (idempotent). Run once at startup before serving AS endpoints. */
|
|
19
22
|
async ensureSchema() {
|
|
20
|
-
await this.#pool
|
|
21
|
-
CREATE TABLE IF NOT EXISTS oauth_clients (
|
|
22
|
-
client_id text PRIMARY KEY,
|
|
23
|
-
client jsonb NOT NULL,
|
|
24
|
-
created_at timestamptz NOT NULL DEFAULT now()
|
|
25
|
-
)
|
|
26
|
-
`);
|
|
27
|
-
await this.#pool.query(`
|
|
28
|
-
CREATE TABLE IF NOT EXISTS oauth_pending_authorizations (
|
|
29
|
-
state text PRIMARY KEY,
|
|
30
|
-
client_id text NOT NULL,
|
|
31
|
-
redirect_uri text NOT NULL,
|
|
32
|
-
code_challenge text NOT NULL,
|
|
33
|
-
client_state text,
|
|
34
|
-
resource text NOT NULL,
|
|
35
|
-
scope text,
|
|
36
|
-
expires_at timestamptz NOT NULL
|
|
37
|
-
)
|
|
38
|
-
`);
|
|
39
|
-
await this.#pool.query(`
|
|
40
|
-
CREATE TABLE IF NOT EXISTS oauth_authorization_codes (
|
|
41
|
-
code text PRIMARY KEY,
|
|
42
|
-
client_id text NOT NULL,
|
|
43
|
-
code_challenge text NOT NULL,
|
|
44
|
-
redirect_uri text NOT NULL,
|
|
45
|
-
resource text NOT NULL,
|
|
46
|
-
owner_subject text NOT NULL,
|
|
47
|
-
owner_email text,
|
|
48
|
-
owner_locale text,
|
|
49
|
-
owner_time_zone text,
|
|
50
|
-
scope text,
|
|
51
|
-
identity_kind text,
|
|
52
|
-
identity_provider text,
|
|
53
|
-
developer_grant_id text,
|
|
54
|
-
expires_at timestamptz NOT NULL
|
|
55
|
-
)
|
|
56
|
-
`);
|
|
57
|
-
await this.#pool.query(`
|
|
58
|
-
CREATE TABLE IF NOT EXISTS oauth_refresh_tokens (
|
|
59
|
-
token text PRIMARY KEY,
|
|
60
|
-
client_id text NOT NULL,
|
|
61
|
-
owner_subject text NOT NULL,
|
|
62
|
-
owner_email text,
|
|
63
|
-
owner_locale text,
|
|
64
|
-
owner_time_zone text,
|
|
65
|
-
resource text NOT NULL,
|
|
66
|
-
scope text,
|
|
67
|
-
identity_kind text,
|
|
68
|
-
identity_provider text,
|
|
69
|
-
developer_grant_id text,
|
|
70
|
-
expires_at timestamptz NOT NULL,
|
|
71
|
-
family_id text,
|
|
72
|
-
rotated_at timestamptz,
|
|
73
|
-
superseded_by text
|
|
74
|
-
)
|
|
75
|
-
`);
|
|
76
|
-
await this.#pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS identity_kind text');
|
|
77
|
-
await this.#pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS owner_locale text');
|
|
78
|
-
await this.#pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS owner_time_zone text');
|
|
79
|
-
await this.#pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS identity_provider text');
|
|
80
|
-
await this.#pool.query('ALTER TABLE oauth_authorization_codes ADD COLUMN IF NOT EXISTS developer_grant_id text');
|
|
81
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS identity_kind text');
|
|
82
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS owner_locale text');
|
|
83
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS owner_time_zone text');
|
|
84
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS identity_provider text');
|
|
85
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS developer_grant_id text');
|
|
86
|
-
// Rotation hardening columns + family index (idempotent; covers tables created before this change).
|
|
87
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS family_id text');
|
|
88
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS rotated_at timestamptz');
|
|
89
|
-
await this.#pool.query('ALTER TABLE oauth_refresh_tokens ADD COLUMN IF NOT EXISTS superseded_by text');
|
|
90
|
-
await this.#pool.query('CREATE INDEX IF NOT EXISTS oauth_refresh_tokens_family_id_idx ON oauth_refresh_tokens (family_id)');
|
|
91
|
-
await this.#pool.query(`
|
|
92
|
-
CREATE TABLE IF NOT EXISTS oauth_consent_grants (
|
|
93
|
-
client_id text NOT NULL,
|
|
94
|
-
owner_subject text NOT NULL,
|
|
95
|
-
resource text NOT NULL,
|
|
96
|
-
granted_at timestamptz NOT NULL DEFAULT now(),
|
|
97
|
-
PRIMARY KEY (client_id, owner_subject, resource)
|
|
98
|
-
)
|
|
99
|
-
`);
|
|
100
|
-
await this.#pool.query(`
|
|
101
|
-
CREATE TABLE IF NOT EXISTS oauth_delegated_credentials (
|
|
102
|
-
resource text NOT NULL,
|
|
103
|
-
provider text NOT NULL,
|
|
104
|
-
subject text NOT NULL,
|
|
105
|
-
credential jsonb NOT NULL,
|
|
106
|
-
updated_at timestamptz NOT NULL,
|
|
107
|
-
PRIMARY KEY (resource, provider, subject)
|
|
108
|
-
)
|
|
109
|
-
`);
|
|
110
|
-
await ensureDeviceAuthorizationSchema(this.#pool);
|
|
23
|
+
await ensureOAuthStoreSchema(this.#pool, this.#enforcePlatformPrincipalSuspension);
|
|
111
24
|
}
|
|
112
25
|
async getClient(clientId) {
|
|
113
26
|
const { rows } = await this.#pool.query('SELECT client FROM oauth_clients WHERE client_id = $1', [clientId]);
|
|
114
27
|
return rows[0]?.client;
|
|
115
28
|
}
|
|
116
29
|
async putClient(client) {
|
|
117
|
-
await this.#pool.query(`INSERT INTO oauth_clients (client_id, client) VALUES ($1, $2::jsonb)
|
|
118
|
-
ON CONFLICT (client_id) DO UPDATE SET client = EXCLUDED.client
|
|
30
|
+
const result = await this.#pool.query(`INSERT INTO oauth_clients (client_id, client) VALUES ($1, $2::jsonb)
|
|
31
|
+
ON CONFLICT (client_id) DO UPDATE SET client = EXCLUDED.client
|
|
32
|
+
WHERE oauth_clients.first_party_owner IS NULL
|
|
33
|
+
RETURNING client_id`, [client.client_id, JSON.stringify(client)]);
|
|
34
|
+
if (result.rows[0] === undefined) {
|
|
35
|
+
throw new Error('OAuth client ID is reserved by a first-party client');
|
|
36
|
+
}
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
async putFirstPartyClient(owner, client) {
|
|
40
|
+
const result = await this.#pool.query(`INSERT INTO oauth_clients (client_id, client, first_party_owner)
|
|
41
|
+
VALUES ($1, $2::jsonb, $3)
|
|
42
|
+
ON CONFLICT (client_id) DO UPDATE SET client = EXCLUDED.client
|
|
43
|
+
WHERE oauth_clients.first_party_owner = EXCLUDED.first_party_owner
|
|
44
|
+
RETURNING client_id`, [client.client_id, JSON.stringify(client), owner]);
|
|
45
|
+
if (result.rows[0] === undefined) {
|
|
46
|
+
throw new Error('OAuth client ID is already registered through DCR');
|
|
47
|
+
}
|
|
119
48
|
return client;
|
|
120
49
|
}
|
|
121
50
|
async createPendingAuthorization(record) {
|
|
122
51
|
await this.#pool.query(`INSERT INTO oauth_pending_authorizations
|
|
123
|
-
(state, client_id, redirect_uri, code_challenge, client_state, resource, scope, expires_at)
|
|
124
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, to_timestamp($
|
|
52
|
+
(state, client_id, redirect_uri, code_challenge, client_state, resource, scope, upstream_provider, expires_at)
|
|
53
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, to_timestamp($9))`, [
|
|
125
54
|
record.state,
|
|
126
55
|
record.clientId,
|
|
127
56
|
record.redirectUri,
|
|
@@ -129,13 +58,16 @@ export class PostgresOAuthStore {
|
|
|
129
58
|
record.clientState ?? null,
|
|
130
59
|
record.resource,
|
|
131
60
|
record.scope ?? null,
|
|
61
|
+
record.upstreamProvider,
|
|
132
62
|
record.expiresAt,
|
|
133
63
|
]);
|
|
134
64
|
}
|
|
135
|
-
async consumePendingAuthorization(state) {
|
|
136
|
-
const { rows } = await this.#pool.query(
|
|
65
|
+
async consumePendingAuthorization(state, expectedUpstreamProvider) {
|
|
66
|
+
const { rows } = await this.#pool.query(`DELETE FROM oauth_pending_authorizations
|
|
67
|
+
WHERE state = $1 AND upstream_provider = $2
|
|
68
|
+
RETURNING *`, [state, expectedUpstreamProvider]);
|
|
137
69
|
const row = rows[0];
|
|
138
|
-
if (!row || !
|
|
70
|
+
if (!row || !postgresTimestampIsLive(row.expires_at))
|
|
139
71
|
return undefined;
|
|
140
72
|
return {
|
|
141
73
|
state: row.state,
|
|
@@ -145,7 +77,8 @@ export class PostgresOAuthStore {
|
|
|
145
77
|
...(row.client_state !== null ? { clientState: row.client_state } : {}),
|
|
146
78
|
resource: row.resource,
|
|
147
79
|
...(row.scope !== null ? { scope: row.scope } : {}),
|
|
148
|
-
|
|
80
|
+
upstreamProvider: row.upstream_provider,
|
|
81
|
+
expiresAt: postgresEpochSeconds(row.expires_at),
|
|
149
82
|
};
|
|
150
83
|
}
|
|
151
84
|
async createAuthorizationCode(record) {
|
|
@@ -178,7 +111,7 @@ export class PostgresOAuthStore {
|
|
|
178
111
|
async redeemAuthorizationCode(code) {
|
|
179
112
|
const { rows } = await this.#pool.query('DELETE FROM oauth_authorization_codes WHERE code = $1 RETURNING *', [code]);
|
|
180
113
|
const row = rows[0];
|
|
181
|
-
if (!row || !
|
|
114
|
+
if (!row || !postgresTimestampIsLive(row.expires_at))
|
|
182
115
|
return undefined;
|
|
183
116
|
return authCodeRowToRecord(row);
|
|
184
117
|
}
|
|
@@ -218,7 +151,7 @@ export class PostgresOAuthStore {
|
|
|
218
151
|
async consumeDeviceBrowserSession(state) {
|
|
219
152
|
const { rows } = await this.#pool.query('DELETE FROM oauth_device_browser_sessions WHERE state = $1 RETURNING *', [state]);
|
|
220
153
|
const row = rows[0];
|
|
221
|
-
if (row === undefined || !
|
|
154
|
+
if (row === undefined || !postgresTimestampIsLive(row.expires_at))
|
|
222
155
|
return undefined;
|
|
223
156
|
return deviceBrowserRowToRecord(row);
|
|
224
157
|
}
|
|
@@ -250,7 +183,7 @@ export class PostgresOAuthStore {
|
|
|
250
183
|
await client.query('BEGIN');
|
|
251
184
|
const { rows } = await client.query('SELECT * FROM oauth_device_authorizations WHERE device_code = $1 FOR UPDATE', [input.deviceCode]);
|
|
252
185
|
const row = rows[0];
|
|
253
|
-
if (row === undefined ||
|
|
186
|
+
if (row === undefined || postgresEpochSeconds(row.expires_at) <= input.nowSeconds) {
|
|
254
187
|
if (row !== undefined) {
|
|
255
188
|
await client.query('DELETE FROM oauth_device_authorizations WHERE device_code = $1', [
|
|
256
189
|
input.deviceCode,
|
|
@@ -275,7 +208,7 @@ export class PostgresOAuthStore {
|
|
|
275
208
|
? { status: 'access_denied' }
|
|
276
209
|
: { status: 'approved', record: deviceRowToRecord(row) };
|
|
277
210
|
}
|
|
278
|
-
if (
|
|
211
|
+
if (postgresEpochSeconds(row.next_poll_at) > input.nowSeconds) {
|
|
279
212
|
await client.query(`UPDATE oauth_device_authorizations
|
|
280
213
|
SET next_poll_at = next_poll_at + (interval_seconds * interval '1 second')
|
|
281
214
|
WHERE device_code = $1`, [input.deviceCode]);
|
|
@@ -321,10 +254,17 @@ export class PostgresOAuthStore {
|
|
|
321
254
|
record.familyId ?? null,
|
|
322
255
|
]);
|
|
323
256
|
}
|
|
257
|
+
async getRefreshToken(token) {
|
|
258
|
+
const { rows } = await this.#pool.query('SELECT * FROM oauth_refresh_tokens WHERE token = $1', [token]);
|
|
259
|
+
const row = rows[0];
|
|
260
|
+
if (!row || !postgresTimestampIsLive(row.expires_at))
|
|
261
|
+
return undefined;
|
|
262
|
+
return refreshRowToRecord(row);
|
|
263
|
+
}
|
|
324
264
|
async consumeRefreshToken(token) {
|
|
325
265
|
const { rows } = await this.#pool.query('DELETE FROM oauth_refresh_tokens WHERE token = $1 RETURNING *', [token]);
|
|
326
266
|
const row = rows[0];
|
|
327
|
-
if (!row || !
|
|
267
|
+
if (!row || !postgresTimestampIsLive(row.expires_at))
|
|
328
268
|
return undefined;
|
|
329
269
|
return refreshRowToRecord(row);
|
|
330
270
|
}
|
|
@@ -375,7 +315,16 @@ export class PostgresOAuthStore {
|
|
|
375
315
|
const client = await this.#pool.connect();
|
|
376
316
|
try {
|
|
377
317
|
await client.query('BEGIN');
|
|
378
|
-
|
|
318
|
+
if (this.#enforcePlatformPrincipalSuspension) {
|
|
319
|
+
const status = await lockAndAssertPlatformRefreshPrincipal(client, {
|
|
320
|
+
oldTokenHash,
|
|
321
|
+
clientId,
|
|
322
|
+
});
|
|
323
|
+
if (status !== 'continue') {
|
|
324
|
+
await client.query('COMMIT');
|
|
325
|
+
return { status };
|
|
326
|
+
}
|
|
327
|
+
}
|
|
379
328
|
const claimed = await client.query(`UPDATE oauth_refresh_tokens
|
|
380
329
|
SET rotated_at = to_timestamp($2), superseded_by = $3
|
|
381
330
|
WHERE token = $1 AND client_id = $4 AND rotated_at IS NULL AND expires_at > to_timestamp($5)
|
|
@@ -394,12 +343,12 @@ export class PostgresOAuthStore {
|
|
|
394
343
|
await client.query('COMMIT');
|
|
395
344
|
return { status: 'unknown' };
|
|
396
345
|
}
|
|
397
|
-
if (nowSeconds -
|
|
346
|
+
if (nowSeconds - postgresEpochSeconds(row.rotated_at) <= graceSeconds) {
|
|
398
347
|
await this.#insertSuccessor(client, row, newTokenHash, newExpiresAt, clientId);
|
|
399
348
|
await client.query('COMMIT');
|
|
400
349
|
return { status: 'grace', identity: rowIdentity(row) };
|
|
401
350
|
}
|
|
402
|
-
if (nowSeconds -
|
|
351
|
+
if (nowSeconds - postgresEpochSeconds(row.rotated_at) <= recoverySeconds &&
|
|
403
352
|
row.superseded_by !== null) {
|
|
404
353
|
const successor = await client.query(`SELECT * FROM oauth_refresh_tokens
|
|
405
354
|
WHERE token = $1 AND client_id = $2 AND rotated_at IS NULL AND expires_at > to_timestamp($3)
|
|
@@ -469,9 +418,9 @@ function refreshRowToRecord(row) {
|
|
|
469
418
|
...(row.identity_kind !== null ? { identityKind: row.identity_kind } : {}),
|
|
470
419
|
...(row.identity_provider !== null ? { identityProvider: row.identity_provider } : {}),
|
|
471
420
|
...(row.developer_grant_id !== null ? { developerGrantId: row.developer_grant_id } : {}),
|
|
472
|
-
expiresAt:
|
|
421
|
+
expiresAt: postgresEpochSeconds(row.expires_at),
|
|
473
422
|
...(row.family_id !== null ? { familyId: row.family_id } : {}),
|
|
474
|
-
...(row.rotated_at !== null ? { rotatedAt:
|
|
423
|
+
...(row.rotated_at !== null ? { rotatedAt: postgresEpochSeconds(row.rotated_at) } : {}),
|
|
475
424
|
...(row.superseded_by !== null ? { supersededBy: row.superseded_by } : {}),
|
|
476
425
|
};
|
|
477
426
|
}
|
|
@@ -509,13 +458,7 @@ function authCodeRowToRecord(row) {
|
|
|
509
458
|
...(row.identity_kind !== null ? { identityKind: row.identity_kind } : {}),
|
|
510
459
|
...(row.identity_provider !== null ? { identityProvider: row.identity_provider } : {}),
|
|
511
460
|
...(row.developer_grant_id !== null ? { developerGrantId: row.developer_grant_id } : {}),
|
|
512
|
-
expiresAt:
|
|
461
|
+
expiresAt: postgresEpochSeconds(row.expires_at),
|
|
513
462
|
};
|
|
514
463
|
}
|
|
515
|
-
function epochSeconds(date) {
|
|
516
|
-
return Math.floor(new Date(date).getTime() / 1000);
|
|
517
|
-
}
|
|
518
|
-
function live(expiresAt) {
|
|
519
|
-
return new Date(expiresAt).getTime() > Date.now();
|
|
520
|
-
}
|
|
521
464
|
//# sourceMappingURL=store-postgres.js.map
|