@noodleseed/one 0.63.0 → 0.64.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.
Files changed (440) hide show
  1. package/dist/auth-discovery.d.ts +17 -0
  2. package/dist/auth-discovery.d.ts.map +1 -0
  3. package/dist/auth-discovery.js +54 -0
  4. package/dist/auth-discovery.js.map +1 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +3 -0
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/catalog-data-platform-auth.d.ts +7 -0
  9. package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -0
  10. package/dist/commands/catalog-data-platform-auth.js +47 -0
  11. package/dist/commands/catalog-data-platform-auth.js.map +1 -0
  12. package/dist/commands/catalog.d.ts.map +1 -1
  13. package/dist/commands/catalog.js +6 -3
  14. package/dist/commands/catalog.js.map +1 -1
  15. package/dist/commands/docs-mcp.d.ts +3 -3
  16. package/dist/commands/docs-mcp.js +3 -3
  17. package/dist/commands/platform-auth-finalization-args.d.ts +13 -0
  18. package/dist/commands/platform-auth-finalization-args.d.ts.map +1 -0
  19. package/dist/commands/platform-auth-finalization-args.js +29 -0
  20. package/dist/commands/platform-auth-finalization-args.js.map +1 -0
  21. package/dist/commands/platform-auth-migration-args.d.ts +71 -0
  22. package/dist/commands/platform-auth-migration-args.d.ts.map +1 -0
  23. package/dist/commands/platform-auth-migration-args.js +320 -0
  24. package/dist/commands/platform-auth-migration-args.js.map +1 -0
  25. package/dist/commands/platform-auth-migration-ops.d.ts +3 -0
  26. package/dist/commands/platform-auth-migration-ops.d.ts.map +1 -0
  27. package/dist/commands/platform-auth-migration-ops.js +369 -0
  28. package/dist/commands/platform-auth-migration-ops.js.map +1 -0
  29. package/dist/commands/project-setup.js +1 -1
  30. package/dist/commands/project-setup.js.map +1 -1
  31. package/dist/config.d.ts +4 -4
  32. package/dist/config.d.ts.map +1 -1
  33. package/dist/control-plane.d.ts +0 -11
  34. package/dist/control-plane.d.ts.map +1 -1
  35. package/dist/control-plane.js +1 -8
  36. package/dist/control-plane.js.map +1 -1
  37. package/dist/doctor.d.ts.map +1 -1
  38. package/dist/doctor.js +3 -5
  39. package/dist/doctor.js.map +1 -1
  40. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
  41. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
  42. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
  43. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  44. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
  45. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  46. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +2 -2
  47. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -1
  48. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +1 -1
  49. package/node_modules/@noodle-borg/auth/dist/verify.d.ts +1 -1
  50. package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
  51. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +26 -0
  52. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -1
  53. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +105 -1
  54. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -1
  55. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts +25 -0
  56. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts.map +1 -0
  57. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js +99 -0
  58. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js.map +1 -0
  59. package/node_modules/@noodle-borg/service/dist/index.d.ts +15 -0
  60. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  61. package/node_modules/@noodle-borg/service/dist/index.js +15 -0
  62. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  63. package/node_modules/@noodle-borg/service/dist/main.js +112 -19
  64. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  65. package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts +1 -1
  66. package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts.map +1 -1
  67. package/node_modules/@noodle-borg/service/dist/oauth/app.js +9 -1
  68. package/node_modules/@noodle-borg/service/dist/oauth/app.js.map +1 -1
  69. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts +24 -0
  70. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts.map +1 -0
  71. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js +88 -0
  72. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js.map +1 -0
  73. package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts +2 -0
  74. package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts.map +1 -1
  75. package/node_modules/@noodle-borg/service/dist/oauth/branding.js +3 -2
  76. package/node_modules/@noodle-borg/service/dist/oauth/branding.js.map +1 -1
  77. package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +1 -1
  78. package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -1
  79. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts +5 -0
  80. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts.map +1 -0
  81. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js +19 -0
  82. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js.map +1 -0
  83. package/node_modules/@noodle-borg/service/dist/oauth/consent.js +1 -1
  84. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.d.ts.map +1 -1
  85. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js +216 -28
  86. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js.map +1 -1
  87. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts +13 -0
  88. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts.map +1 -0
  89. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js +62 -0
  90. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js.map +1 -0
  91. package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts +4 -0
  92. package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts.map +1 -0
  93. package/node_modules/@noodle-borg/service/dist/oauth/metadata.js +20 -0
  94. package/node_modules/@noodle-borg/service/dist/oauth/metadata.js.map +1 -0
  95. package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts.map +1 -1
  96. package/node_modules/@noodle-borg/service/dist/oauth/paths.js +2 -0
  97. package/node_modules/@noodle-borg/service/dist/oauth/paths.js.map +1 -1
  98. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts +15 -0
  99. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts.map +1 -0
  100. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js +58 -0
  101. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js.map +1 -0
  102. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts +8 -0
  103. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js +49 -0
  105. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js.map +1 -0
  106. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts +3 -0
  107. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts.map +1 -0
  108. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js +7 -0
  109. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js.map +1 -0
  110. package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts +20 -25
  111. package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
  112. package/node_modules/@noodle-borg/service/dist/oauth/provider.js +105 -196
  113. package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
  114. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts +36 -0
  115. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts.map +1 -0
  116. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +157 -0
  117. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -0
  118. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts +4 -0
  119. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -0
  120. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +110 -0
  121. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -0
  122. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +7 -4
  123. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
  124. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +63 -120
  125. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
  126. package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +19 -6
  127. package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
  128. package/node_modules/@noodle-borg/service/dist/oauth/store.js +24 -2
  129. package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
  130. package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts +1 -1
  131. package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts.map +1 -1
  132. package/node_modules/@noodle-borg/service/dist/oauth/tokens.js +1 -1
  133. package/node_modules/@noodle-borg/service/dist/oauth/tokens.js.map +1 -1
  134. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts +4 -0
  135. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts.map +1 -0
  136. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js +8 -0
  137. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js.map +1 -0
  138. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts +34 -0
  139. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -0
  140. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +109 -0
  141. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -0
  142. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +22 -0
  143. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -0
  144. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js +30 -0
  145. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -0
  146. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts +21 -0
  147. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -0
  148. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +56 -0
  149. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -0
  150. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts +30 -0
  151. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -0
  152. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +94 -0
  153. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -0
  154. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts +33 -0
  155. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts.map +1 -0
  156. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js +27 -0
  157. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js.map +1 -0
  158. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts +13 -0
  159. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts.map +1 -0
  160. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js +63 -0
  161. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js.map +1 -0
  162. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts +20 -0
  163. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts.map +1 -0
  164. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js +40 -0
  165. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js.map +1 -0
  166. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts +115 -0
  167. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts.map +1 -0
  168. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js +310 -0
  169. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js.map +1 -0
  170. package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts +65 -0
  171. package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts.map +1 -0
  172. package/node_modules/@noodle-borg/service/dist/oauth/workos.js +85 -0
  173. package/node_modules/@noodle-borg/service/dist/oauth/workos.js.map +1 -0
  174. package/node_modules/@noodle-borg/service/dist/options.d.ts +11 -2
  175. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  176. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts +2 -0
  177. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts.map +1 -1
  178. package/node_modules/@noodle-borg/service/dist/personal-workspace.js +8 -2
  179. package/node_modules/@noodle-borg/service/dist/personal-workspace.js.map +1 -1
  180. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +67 -0
  181. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts.map +1 -0
  182. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js +54 -0
  183. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js.map +1 -0
  184. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts +25 -0
  185. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts.map +1 -0
  186. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js +61 -0
  187. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js.map +1 -0
  188. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts +32 -0
  189. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -0
  190. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +231 -0
  191. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -0
  192. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts +29 -0
  193. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts.map +1 -0
  194. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js +350 -0
  195. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js.map +1 -0
  196. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts +50 -0
  197. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -0
  198. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +239 -0
  199. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -0
  200. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts +66 -0
  201. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts.map +1 -0
  202. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js +77 -0
  203. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js.map +1 -0
  204. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts +40 -0
  205. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts.map +1 -0
  206. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js +355 -0
  207. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js.map +1 -0
  208. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts +41 -0
  209. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts.map +1 -0
  210. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js +230 -0
  211. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js.map +1 -0
  212. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +20 -0
  213. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -0
  214. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +126 -0
  215. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -0
  216. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts +8 -0
  217. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts.map +1 -0
  218. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js +86 -0
  219. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js.map +1 -0
  220. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts +42 -0
  221. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts.map +1 -0
  222. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js +368 -0
  223. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js.map +1 -0
  224. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts +86 -0
  225. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts.map +1 -0
  226. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js +474 -0
  227. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js.map +1 -0
  228. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts +17 -0
  229. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts.map +1 -0
  230. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js +435 -0
  231. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js.map +1 -0
  232. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts +202 -0
  233. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts.map +1 -0
  234. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js +313 -0
  235. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js.map +1 -0
  236. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts +48 -0
  237. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts.map +1 -0
  238. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js +158 -0
  239. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js.map +1 -0
  240. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts +43 -0
  241. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts.map +1 -0
  242. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js +92 -0
  243. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js.map +1 -0
  244. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts +31 -0
  245. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts.map +1 -0
  246. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js +94 -0
  247. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js.map +1 -0
  248. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts +102 -0
  249. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts.map +1 -0
  250. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js +2 -0
  251. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js.map +1 -0
  252. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts +17 -0
  253. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts.map +1 -0
  254. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js +367 -0
  255. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js.map +1 -0
  256. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts +10 -0
  257. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts.map +1 -0
  258. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js +37 -0
  259. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js.map +1 -0
  260. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts +36 -0
  261. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts.map +1 -0
  262. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js +156 -0
  263. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js.map +1 -0
  264. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts +4 -0
  265. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts.map +1 -0
  266. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js +162 -0
  267. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js.map +1 -0
  268. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts +92 -0
  269. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts.map +1 -0
  270. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js +271 -0
  271. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js.map +1 -0
  272. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts +13 -0
  273. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts.map +1 -0
  274. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js +67 -0
  275. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js.map +1 -0
  276. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts +15 -0
  277. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts.map +1 -0
  278. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js +47 -0
  279. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js.map +1 -0
  280. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +1569 -0
  281. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts.map +1 -0
  282. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js +274 -0
  283. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js.map +1 -0
  284. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts +41 -0
  285. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts.map +1 -0
  286. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js +163 -0
  287. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js.map +1 -0
  288. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts +34 -0
  289. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts.map +1 -0
  290. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js +274 -0
  291. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js.map +1 -0
  292. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts +3 -0
  293. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts.map +1 -0
  294. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js +120 -0
  295. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js.map +1 -0
  296. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts +79 -0
  297. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts.map +1 -0
  298. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js +88 -0
  299. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js.map +1 -0
  300. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts +6 -0
  301. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts.map +1 -0
  302. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js +38 -0
  303. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js.map +1 -0
  304. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts +61 -0
  305. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts.map +1 -0
  306. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js +292 -0
  307. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js.map +1 -0
  308. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts +19 -0
  309. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts.map +1 -0
  310. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js +121 -0
  311. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js.map +1 -0
  312. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +119 -0
  313. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts.map +1 -0
  314. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js +194 -0
  315. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js.map +1 -0
  316. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +36 -0
  317. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -0
  318. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +93 -0
  319. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -0
  320. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +32 -0
  321. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -0
  322. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +68 -0
  323. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -0
  324. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts +36 -0
  325. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts.map +1 -0
  326. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js +92 -0
  327. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js.map +1 -0
  328. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +23 -0
  329. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -0
  330. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +231 -0
  331. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -0
  332. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts +13 -0
  333. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -0
  334. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +399 -0
  335. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -0
  336. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts +18 -0
  337. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts.map +1 -0
  338. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js +25 -0
  339. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js.map +1 -0
  340. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts +15 -0
  341. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts.map +1 -0
  342. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js +74 -0
  343. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js.map +1 -0
  344. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +19 -0
  345. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -0
  346. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +249 -0
  347. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -0
  348. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts +34 -0
  349. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -0
  350. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +275 -0
  351. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -0
  352. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +98 -0
  353. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -0
  354. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +179 -0
  355. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -0
  356. package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +110 -0
  357. package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -0
  358. package/node_modules/@noodle-borg/service/dist/platform-identity.js +312 -0
  359. package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -0
  360. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts +6 -0
  361. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts.map +1 -0
  362. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js +36 -0
  363. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js.map +1 -0
  364. package/node_modules/@noodle-borg/service/dist/routes/billing-read.d.ts.map +1 -1
  365. package/node_modules/@noodle-borg/service/dist/routes/billing-read.js +3 -9
  366. package/node_modules/@noodle-borg/service/dist/routes/billing-read.js.map +1 -1
  367. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.d.ts.map +1 -1
  368. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js +3 -3
  369. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js.map +1 -1
  370. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.d.ts.map +1 -1
  371. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js +3 -1
  372. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js.map +1 -1
  373. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts +8 -0
  374. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts.map +1 -0
  375. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js +40 -0
  376. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js.map +1 -0
  377. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts +13 -0
  378. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts.map +1 -0
  379. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js +158 -0
  380. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js.map +1 -0
  381. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +21 -3
  382. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -1
  383. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  384. package/node_modules/@noodle-borg/service/dist/serve.js +61 -146
  385. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  386. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +1 -0
  387. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -1
  388. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +3 -0
  389. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -1
  390. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  391. package/node_modules/@noodle-borg/service/dist/service.js +17 -29
  392. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  393. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
  394. package/node_modules/@noodle-borg/service/dist/store/control-plane.js +60 -19
  395. package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
  396. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +1 -2
  397. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
  398. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +0 -40
  399. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
  400. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts +5 -0
  401. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts.map +1 -0
  402. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js +176 -0
  403. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js.map +1 -0
  404. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts +2 -0
  405. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
  406. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +43 -1
  407. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
  408. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js +2 -1
  409. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js.map +1 -1
  410. package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +71 -0
  411. package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -0
  412. package/node_modules/@noodle-borg/service/dist/workos-directory.js +175 -0
  413. package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -0
  414. package/node_modules/@noodle-borg/service/package.json +1 -0
  415. package/node_modules/@workos-inc/node/LICENSE +21 -0
  416. package/node_modules/@workos-inc/node/README.md +140 -0
  417. package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.cts +9727 -0
  418. package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.mts +9727 -0
  419. package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs +8426 -0
  420. package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs.map +1 -0
  421. package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs +8241 -0
  422. package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs.map +1 -0
  423. package/node_modules/@workos-inc/node/lib/index.cjs +449 -0
  424. package/node_modules/@workos-inc/node/lib/index.cjs.map +1 -0
  425. package/node_modules/@workos-inc/node/lib/index.d.cts +478 -0
  426. package/node_modules/@workos-inc/node/lib/index.d.mts +478 -0
  427. package/node_modules/@workos-inc/node/lib/index.mjs +394 -0
  428. package/node_modules/@workos-inc/node/lib/index.mjs.map +1 -0
  429. package/node_modules/@workos-inc/node/lib/index.worker.cjs +60 -0
  430. package/node_modules/@workos-inc/node/lib/index.worker.cjs.map +1 -0
  431. package/node_modules/@workos-inc/node/lib/index.worker.d.cts +16 -0
  432. package/node_modules/@workos-inc/node/lib/index.worker.d.mts +16 -0
  433. package/node_modules/@workos-inc/node/lib/index.worker.mjs +35 -0
  434. package/node_modules/@workos-inc/node/lib/index.worker.mjs.map +1 -0
  435. package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs +3224 -0
  436. package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs.map +1 -0
  437. package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs +3271 -0
  438. package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs.map +1 -0
  439. package/node_modules/@workos-inc/node/package.json +96 -0
  440. package/package.json +2 -1
@@ -5,82 +5,77 @@ import type { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthToke
5
5
  import { type SigningKeyProvider, type VerifiedIdentity } from '@noodle-borg/auth';
6
6
  import { type Logger } from '@noodle-borg/transport-http';
7
7
  import type { Request, Response } from 'express';
8
- import type { SignupAuthorizer } from '../auth/deploy-gate.js';
8
+ import type { ControlPlaneSignupMode, SignupAuthorizer } from '../auth/deploy-gate.js';
9
+ import type { PlatformPrincipalResolver } from '../platform-identity.js';
9
10
  import type { SecretEnvelope, TenantBridgeAuthConfig } from '../store.js';
10
11
  import type { DeveloperGrantAuthorizer } from './developer-grant-authorizer.js';
11
12
  import { DeviceAuthorizationFlow } from './device-flow.js';
12
13
  import type { DeviceAuthorizationRecord, DeviceBrowserSessionRecord } from './device-store.js';
13
14
  import type { GoogleAuthenticator } from './google.js';
14
15
  import type { OAuthStore } from './store.js';
16
+ import { handleUpstreamHumanCallback } from './upstream-callback-handler.js';
17
+ import type { UpstreamHumanOAuthAuthenticator, UpstreamHumanRollout } from './upstream-human.js';
18
+ import type { UpstreamHumanRolloutStore } from './upstream-rollout-store.js';
15
19
  export interface NoodleOAuthProviderConfig {
16
- /** The authorization server issuer (its public origin, e.g. `https://cloud.noodleseed.dev`). */
17
20
  readonly issuer: string;
18
21
  readonly store: OAuthStore;
19
22
  readonly signer: SigningKeyProvider;
20
- readonly google: GoogleAuthenticator;
21
- /** When set, only users whose email ends with this domain may authorize (alpha gate, e.g. `@noodleseed.com`). */
23
+ readonly google?: GoogleAuthenticator;
24
+ readonly upstreamAuthenticators?: Readonly<{
25
+ readonly workos?: UpstreamHumanOAuthAuthenticator;
26
+ }>;
27
+ readonly upstreamRollout?: UpstreamHumanRollout;
28
+ readonly upstreamRolloutStore?: UpstreamHumanRolloutStore;
29
+ readonly platformPrincipalResolver?: PlatformPrincipalResolver;
22
30
  readonly allowedEmailDomain?: string;
31
+ readonly signupMode?: ControlPlaneSignupMode;
23
32
  readonly signupAuthorizer?: SignupAuthorizer;
33
+ readonly deniedSignupDomains?: readonly string[];
34
+ readonly deniedSignupSubjects?: readonly string[];
35
+ /** Idempotently establishes platform-owned account state before any Noodle credential is issued. */
36
+ readonly provisionPlatformPrincipal?: NoodlePlatformPrincipalProvisioner;
24
37
  readonly developerGrantAuthorizer?: DeveloperGrantAuthorizer;
25
- /** Compatibility hook for OAuth clients that cannot send RFC 8707 `resource` during authorization. */
26
38
  readonly defaultResourceForClient?: (client: OAuthClientInformationFull) => string | undefined;
27
- /** Resolve bridge auth for a resource-bound tenant MCP URL, when the deployment uses Noodle-managed bridge auth. */
28
39
  readonly customerBridgeAuthForResource?: (resource: string) => Promise<TenantBridgeAuthConfig | undefined>;
29
- /** Verify the upstream customer credential returned by the tenant app before Noodle issues an MCP token. */
30
40
  readonly verifyCustomerBridgeToken?: (auth: TenantBridgeAuthConfig, token: string) => Promise<VerifiedIdentity | null>;
31
41
  readonly managedSecretForResource?: (resource: string, name: string) => Promise<string | undefined>;
32
42
  readonly sealCustomerCredential?: (credential: string) => Promise<SecretEnvelope>;
33
43
  readonly fetchImpl?: typeof fetch;
34
44
  readonly accessTokenTtlSeconds?: number;
35
45
  readonly refreshTokenTtlSeconds?: number;
36
- /** Benign retry/concurrency window after refresh-token rotation. Default 30 seconds. */
37
46
  readonly refreshTokenGraceSeconds?: number;
38
- /** Recovery window for stale refresh tokens when the successor was never used. */
39
47
  readonly refreshTokenRecoverySeconds?: number;
40
48
  readonly authCodeTtlSeconds?: number;
41
49
  readonly pendingTtlSeconds?: number;
42
50
  readonly consentTtlSeconds?: number;
43
51
  readonly logger?: Logger;
44
- /** Clock injection (epoch ms), for deterministic time in tests. Defaults to `Date.now`. */
45
52
  readonly now?: () => number;
46
53
  }
47
- /** Self-hosted OAuth authorization server provider (OA-2, ADR 0042). */
48
54
  export declare class NoodleOAuthProvider implements OAuthServerProvider {
49
55
  #private;
50
56
  constructor(config: NoodleOAuthProviderConfig);
51
57
  get clientsStore(): OAuthRegisteredClientsStore;
52
58
  get deviceAuthorizationFlow(): DeviceAuthorizationFlow;
53
- /** Begin authorization: persist the pending request and redirect the user to "Sign in with Google". */
54
59
  authorize(client: OAuthClientInformationFull, params: AuthorizationParams, res: Response): Promise<void>;
55
- /** Return the stored PKCE challenge for a code (non-destructive — the SDK validates the verifier against it). */
56
60
  challengeForAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string): Promise<string>;
57
- /** Redeem an authorization code (single-use) and mint the owner's tokens. PKCE was validated by the SDK. */
58
61
  exchangeAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string, _codeVerifier?: string, redirectUri?: string, resource?: URL): Promise<OAuthTokens>;
59
- /** Complete the server-owned authorization-code bridge used by the RFC 8628 verification page. */
60
62
  completeDeviceAuthorization(session: DeviceBrowserSessionRecord, authorizationCode: string): Promise<boolean>;
61
- /** Mint normal access/refresh tokens after the device authorization has been approved and consumed. */
62
63
  issueDeviceTokens(record: DeviceAuthorizationRecord): Promise<OAuthTokens>;
63
- /** Rotate a refresh token with grace/recovery handling for concurrent or retried refreshes. */
64
64
  exchangeRefreshToken(client: OAuthClientInformationFull, refreshToken: string, _scopes?: string[], resource?: URL): Promise<OAuthTokens>;
65
- /** Verify an access token (issuer/signature/expiry). Provided for interface completeness — the data-plane
66
- * resource server verifies with its own audience-bound verifier; this is not on the AS request path. */
67
65
  verifyAccessToken(token: string): Promise<AuthInfo>;
68
- /** RFC 7009 revocation also invalidates the exact developer grant bound to this client token. */
69
66
  revokeToken(client: OAuthClientInformationFull, request: OAuthTokenRevocationRequest): Promise<void>;
70
- /** RFC 8414 authorization-server metadata (plus our `jwks_uri`), served at `/.well-known/oauth-authorization-server`. */
71
67
  metadata(): Record<string, unknown>;
72
- /** The public JWKS the resource server (and external validators) read to verify access tokens. */
73
68
  jwks(): Promise<{
74
69
  keys: unknown[];
75
70
  }>;
76
- /** Google callback: consume the pending auth, verify the Google identity, and render the consent page. */
77
71
  handleGoogleCallback(req: Request, res: Response): Promise<void>;
78
- /** Consent decision: on approve, mint a PKCE-bound code and redirect to the client; on deny, redirect with an error. */
72
+ handleWorkOSCallback(req: Request, res: Response): Promise<void>;
73
+ handleUpstreamProviderChoice(req: Request, res: Response): Promise<void>;
79
74
  handleConsent(req: Request, res: Response): Promise<void>;
80
75
  handleDeveloperGrant(req: Request, res: Response): Promise<void>;
81
- /** Customer bridge callback: verify the tenant app's customer token and issue a normal OAuth code. */
82
76
  handleFirebaseCustomerAuthorize(req: Request, res: Response): Promise<void>;
83
77
  handleFirebaseCustomerCallback(req: Request, res: Response): Promise<void>;
84
78
  handleMicrosoftCustomerCallback(req: Request, res: Response): Promise<void>;
85
79
  }
80
+ export type NoodlePlatformPrincipalProvisioner = NonNullable<Parameters<typeof handleUpstreamHumanCallback>[0]['provisionPlatformPrincipal']>;
86
81
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/oauth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAMpG,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,WAAW,EACZ,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK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C,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAGhE,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAGhE,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDxE,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCzD,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhE,+BAA+B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB3E,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA4D1E,+BAA+B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAuHlF;AAED,MAAM,MAAM,kCAAkC,GAAG,WAAW,CAC1D,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAChF,CAAC"}
@@ -1,28 +1,29 @@
1
1
  import { InvalidGrantError, InvalidRequestError, InvalidTokenError, } from '@modelcontextprotocol/sdk/server/auth/errors.js';
2
- import { createOAuthMetadata } from '@modelcontextprotocol/sdk/server/auth/router.js';
3
2
  import { createJwtVerifier, } from '@noodle-borg/auth';
4
3
  import { noopLogger } from '@noodle-borg/transport-http';
5
- import { jwtVerify, SignJWT } from 'jose';
6
- import { renderConsentPage } from './consent.js';
7
- import { isConsentClaims } from './consent-claims.js';
8
- import { bridgeAuthorizeUrl, customerBridgeAuthorizeFields, customerBridgeCallbackFields, microsoftCallbackUrl, renderFirebaseAuthorizePage, } from './customer-bridge.js';
9
- import { DeveloperGrantOAuthFlow, isDeveloperResourceForIssuer } from './developer-grant-flow.js';
4
+ import { initiateAuthorization } from './authorization-initiation.js';
5
+ import { signConsentToken, verifyConsentToken } from './consent-token.js';
6
+ import { customerBridgeAuthorizeFields, customerBridgeCallbackFields, microsoftCallbackUrl, renderFirebaseAuthorizePage, } from './customer-bridge.js';
7
+ import { DeveloperGrantOAuthFlow } from './developer-grant-flow.js';
10
8
  import { DeviceAuthorizationFlow } from './device-flow.js';
11
9
  import { completeDeviceAuthorization, issueDeviceTokens } from './device-provider.js';
12
10
  import { storedOAuthOwnerPreferences, verifiedIdentityOwnerPreferences, } from './identity-preferences.js';
11
+ import { noodleOAuthMetadata } from './metadata.js';
13
12
  import { exchangeMicrosoftAuthorizationCode, isConfiguredMicrosoftBridge, verifyMicrosoftIdToken, } from './microsoft.js';
14
- import { defaultResourceFromClient, hostOf, normalizeResource, resourcePath, trimTrailingSlash, } from './provider-util.js';
13
+ import { assertPlatformRefreshPrincipal } from './platform-principal-guard.js';
14
+ import { defaultResourceFromClient, normalizeResource, resourcePath, trimTrailingSlash, } from './provider-util.js';
15
15
  import { mintOAuthAccessToken, OAuthTokenIssuer } from './token-issuer.js';
16
16
  import { hashToken, randomToken } from './tokens.js';
17
+ import { handleUpstreamHumanCallback } from './upstream-callback-handler.js';
18
+ import { redirectPendingAuthorizationError } from './upstream-callback-support.js';
19
+ import { continueUpstreamProviderChoice } from './upstream-provider-choice.js';
17
20
  const ONE_HOUR = 3600;
18
21
  const THIRTY_DAYS = 30 * 24 * 3600;
19
22
  const TEN_MINUTES = 600;
20
23
  const FIVE_MINUTES = 300;
21
24
  const REFRESH_GRACE = 30;
22
25
  const REFRESH_RECOVERY = 300;
23
- const CONSENT_PATH = '/oauth/consent';
24
26
  const DEVICE_GRANT = 'urn:ietf:params:oauth:grant-type:device_code';
25
- /** Self-hosted OAuth authorization server provider (OA-2, ADR 0042). */
26
27
  export class NoodleOAuthProvider {
27
28
  #config;
28
29
  #accessTtl;
@@ -85,42 +86,32 @@ export class NoodleOAuthProvider {
85
86
  get deviceAuthorizationFlow() {
86
87
  return this.#deviceFlow;
87
88
  }
88
- /** Begin authorization: persist the pending request and redirect the user to "Sign in with Google". */
89
89
  async authorize(client, params, res) {
90
- // RFC 8707: the client MUST bind the token to a resource. Owner-only tokens are audience-bound to the
91
- // tenant MCP URL, so without it we cannot mint a usable token — fail before redirecting to Google.
92
- const resource = params.resource?.href ??
93
- defaultResourceFromClient(client) ??
94
- normalizeResource(this.#config.defaultResourceForClient?.(client));
95
- if (!resource) {
96
- throw new InvalidRequestError('the resource parameter is required');
97
- }
98
- const nonce = randomToken();
99
- await this.#config.store.createPendingAuthorization({
100
- state: hashToken(nonce),
101
- clientId: client.client_id,
102
- redirectUri: params.redirectUri,
103
- codeChallenge: params.codeChallenge,
104
- ...(params.state !== undefined ? { clientState: params.state } : {}),
105
- resource,
106
- ...(params.scopes && params.scopes.length > 0 ? { scope: params.scopes.join(' ') } : {}),
107
- expiresAt: this.#nowSeconds() + this.#pendingTtl,
90
+ await initiateAuthorization({
91
+ client,
92
+ params,
93
+ res,
94
+ issuer: this.#config.issuer,
95
+ store: this.#config.store,
96
+ ...(this.#config.google === undefined ? {} : { google: this.#config.google }),
97
+ ...(this.#config.upstreamAuthenticators?.workos === undefined
98
+ ? {}
99
+ : { workos: this.#config.upstreamAuthenticators.workos }),
100
+ ...(this.#config.upstreamRollout === undefined
101
+ ? {}
102
+ : { rollout: this.#config.upstreamRollout }),
103
+ ...(this.#config.upstreamRolloutStore === undefined
104
+ ? {}
105
+ : { rolloutStore: this.#config.upstreamRolloutStore }),
106
+ ...(this.#config.customerBridgeAuthForResource === undefined
107
+ ? {}
108
+ : { customerBridgeAuthForResource: this.#config.customerBridgeAuthForResource }),
109
+ ...(this.#config.defaultResourceForClient === undefined
110
+ ? {}
111
+ : { defaultResourceForClient: this.#config.defaultResourceForClient }),
112
+ pendingTtlSeconds: this.#pendingTtl,
113
+ nowSeconds: this.#nowSeconds(),
108
114
  });
109
- const bridgeAuth = await this.#config.customerBridgeAuthForResource?.(resource);
110
- if (bridgeAuth !== undefined) {
111
- const authorizeUrl = bridgeAuthorizeUrl(bridgeAuth, {
112
- issuer: this.#config.issuer,
113
- state: nonce,
114
- resource,
115
- clientId: client.client_id,
116
- });
117
- if (authorizeUrl === undefined) {
118
- throw new InvalidRequestError('customer bridge authorization is not configured');
119
- }
120
- res.redirect(302, authorizeUrl);
121
- return;
122
- }
123
- res.redirect(302, this.#config.google.authorizationUrl(nonce));
124
115
  }
125
116
  #withDefaultResource(client) {
126
117
  const defaultResource = this.#config.defaultResourceForClient?.(client);
@@ -128,7 +119,6 @@ export class NoodleOAuthProvider {
128
119
  return client;
129
120
  return { ...client, default_resource: defaultResource };
130
121
  }
131
- /** Return the stored PKCE challenge for a code (non-destructive — the SDK validates the verifier against it). */
132
122
  async challengeForAuthorizationCode(client, authorizationCode) {
133
123
  const record = await this.#config.store.getAuthorizationCode(hashToken(authorizationCode));
134
124
  if (!record || record.clientId !== client.client_id) {
@@ -136,7 +126,6 @@ export class NoodleOAuthProvider {
136
126
  }
137
127
  return record.codeChallenge;
138
128
  }
139
- /** Redeem an authorization code (single-use) and mint the owner's tokens. PKCE was validated by the SDK. */
140
129
  async exchangeAuthorizationCode(client, authorizationCode, _codeVerifier, redirectUri, resource) {
141
130
  const resolvedResource = resource?.href ??
142
131
  defaultResourceFromClient(client) ??
@@ -173,7 +162,6 @@ export class NoodleOAuthProvider {
173
162
  : {}),
174
163
  });
175
164
  }
176
- /** Complete the server-owned authorization-code bridge used by the RFC 8628 verification page. */
177
165
  async completeDeviceAuthorization(session, authorizationCode) {
178
166
  return completeDeviceAuthorization({
179
167
  store: this.#config.store,
@@ -182,11 +170,9 @@ export class NoodleOAuthProvider {
182
170
  authorizationCode,
183
171
  });
184
172
  }
185
- /** Mint normal access/refresh tokens after the device authorization has been approved and consumed. */
186
173
  issueDeviceTokens(record) {
187
174
  return issueDeviceTokens({ tokenIssuer: this.#tokenIssuer, record });
188
175
  }
189
- /** Rotate a refresh token with grace/recovery handling for concurrent or retried refreshes. */
190
176
  async exchangeRefreshToken(client, refreshToken, _scopes, resource) {
191
177
  const resolvedResource = resource?.href ??
192
178
  defaultResourceFromClient(client) ??
@@ -194,9 +180,14 @@ export class NoodleOAuthProvider {
194
180
  if (resolvedResource === undefined) {
195
181
  throw new InvalidRequestError('the resource parameter is required');
196
182
  }
183
+ const oldTokenHash = hashToken(refreshToken);
184
+ await assertPlatformRefreshPrincipal(this.#config.store, this.#config.platformPrincipalResolver, {
185
+ oldTokenHash,
186
+ client,
187
+ });
197
188
  const rawRefresh = randomToken();
198
189
  const rotation = await this.#config.store.rotateRefreshToken({
199
- oldTokenHash: hashToken(refreshToken),
190
+ oldTokenHash,
200
191
  clientId: client.client_id,
201
192
  newTokenHash: hashToken(rawRefresh),
202
193
  newExpiresAt: this.#nowSeconds() + this.#refreshTtl,
@@ -204,7 +195,7 @@ export class NoodleOAuthProvider {
204
195
  recoverySeconds: this.#refreshRecoveryTtl,
205
196
  nowSeconds: this.#nowSeconds(),
206
197
  });
207
- if (rotation.status === 'reuse' || rotation.status === 'unknown') {
198
+ if (!('identity' in rotation)) {
208
199
  this.#logRefresh(rotation.status, client.client_id, resolvedResource);
209
200
  throw new InvalidGrantError('invalid refresh token');
210
201
  }
@@ -245,8 +236,6 @@ export class NoodleOAuthProvider {
245
236
  ...(identity.scope !== undefined ? { scope: identity.scope } : {}),
246
237
  };
247
238
  }
248
- /** Verify an access token (issuer/signature/expiry). Provided for interface completeness — the data-plane
249
- * resource server verifies with its own audience-bound verifier; this is not on the AS request path. */
250
239
  async verifyAccessToken(token) {
251
240
  const identity = await this.#verify()(token);
252
241
  if (!identity)
@@ -258,7 +247,6 @@ export class NoodleOAuthProvider {
258
247
  ...(identity.expiresAt !== undefined ? { expiresAt: identity.expiresAt } : {}),
259
248
  };
260
249
  }
261
- /** RFC 7009 revocation also invalidates the exact developer grant bound to this client token. */
262
250
  async revokeToken(client, request) {
263
251
  try {
264
252
  const identity = await this.#verify()(request.token);
@@ -272,120 +260,67 @@ export class NoodleOAuthProvider {
272
260
  at: new Date(this.#now()).toISOString(),
273
261
  });
274
262
  }
275
- catch {
276
- // RFC 7009 requires invalid and already-revoked tokens to be indistinguishable no-ops.
277
- }
263
+ catch { }
278
264
  }
279
- /** RFC 8414 authorization-server metadata (plus our `jwks_uri`), served at `/.well-known/oauth-authorization-server`. */
280
265
  metadata() {
281
266
  const issuer = trimTrailingSlash(this.#config.issuer);
282
- const base = createOAuthMetadata({ provider: this, issuerUrl: new URL(issuer) });
283
- // The SDK emits `issuer` as `URL.href`, which appends a trailing slash for a path-less origin
284
- // (`https://h` → `https://h/`). RFC 8414 §3.3 requires the metadata `issuer` to be identical to the
285
- // issuer used to build the well-known URL, and our token `iss` + the PRM `authorization_servers` entry
286
- // use the no-slash form — so normalize it back for consistency across all three.
287
- const grants = Array.isArray(base.grant_types_supported)
288
- ? base.grant_types_supported
289
- : ['authorization_code', 'refresh_token'];
290
- return {
291
- ...base,
292
- issuer,
293
- grant_types_supported: [...new Set([...grants, DEVICE_GRANT])],
294
- device_authorization_endpoint: `${issuer}/device_authorization`,
295
- jwks_uri: `${issuer}/.well-known/jwks.json`,
296
- };
267
+ return noodleOAuthMetadata(this, issuer, DEVICE_GRANT);
297
268
  }
298
- /** The public JWKS the resource server (and external validators) read to verify access tokens. */
299
269
  jwks() {
300
270
  return this.#config.signer.publicJwks();
301
271
  }
302
- /** Google callback: consume the pending auth, verify the Google identity, and render the consent page. */
303
272
  async handleGoogleCallback(req, res) {
304
- if (typeof req.query.error === 'string') {
305
- res.status(400).type('text/plain').send(`Google sign-in failed: ${req.query.error}`);
306
- return;
307
- }
308
- const code = typeof req.query.code === 'string' ? req.query.code : undefined;
309
- const state = typeof req.query.state === 'string' ? req.query.state : undefined;
310
- if (!code || !state) {
311
- res.status(400).type('text/plain').send('missing authorization code or state');
312
- return;
313
- }
314
- const pending = await this.#config.store.consumePendingAuthorization(hashToken(state));
315
- if (!pending) {
316
- res.status(400).type('text/plain').send('unknown or expired authorization request');
317
- return;
318
- }
319
- let identity;
320
- try {
321
- identity = await this.#config.google.exchange(code);
322
- }
323
- catch {
324
- res.status(400).type('text/plain').send('Google authentication failed');
325
- return;
326
- }
327
- if (this.#config.allowedEmailDomain &&
328
- !identity.email.toLowerCase().endsWith(this.#config.allowedEmailDomain.toLowerCase()) &&
329
- !(await this.#config.signupAuthorizer?.isSignupAllowed({
330
- subject: identity.subject,
331
- email: identity.email.toLowerCase(),
332
- }))) {
333
- res.status(403).type('text/plain').send('this Google account is not permitted');
334
- return;
335
- }
336
- const preferences = storedOAuthOwnerPreferences(identity);
337
- if (isDeveloperResourceForIssuer(pending.resource, this.#config.issuer)) {
338
- if (this.#developerGrantFlow === undefined) {
339
- res.status(400).type('text/plain').send('developer access is not configured');
340
- return;
341
- }
342
- await this.#developerGrantFlow.renderSelection(pending, identity, res);
343
- return;
344
- }
345
- // Remembered consent: if this human already approved this (client, subject, resource), skip the
346
- // interstitial and issue the code directly — a re-authorizing client (e.g. ChatGPT, which does not persist
347
- // its MCP session) never re-prompts the user. A new client or resource has no grant and still consents
348
- // (ADR 0042 confused-deputy guard intact).
349
- if (await this.#config.store.hasConsentGrant(pending.clientId, identity.subject, pending.resource)) {
350
- await this.#tokenIssuer.issueAuthorizationCode(res, {
351
- clientId: pending.clientId,
352
- codeChallenge: pending.codeChallenge,
353
- redirectUri: pending.redirectUri,
354
- resource: pending.resource,
355
- ownerSubject: identity.subject,
356
- ownerEmail: identity.email,
357
- ...preferences,
358
- ...(pending.clientState !== undefined ? { clientState: pending.clientState } : {}),
359
- ...(pending.scope !== undefined ? { scope: pending.scope } : {}),
360
- });
361
- return;
362
- }
363
- const consentToken = await this.#signConsent({
364
- kind: 'consent',
365
- clientId: pending.clientId,
366
- redirectUri: pending.redirectUri,
367
- codeChallenge: pending.codeChallenge,
368
- resource: pending.resource,
369
- ownerSubject: identity.subject,
370
- ownerEmail: identity.email,
371
- ...preferences,
372
- ...(pending.clientState !== undefined ? { clientState: pending.clientState } : {}),
373
- ...(pending.scope !== undefined ? { scope: pending.scope } : {}),
273
+ await this.#handleUpstreamCallback('google', req, res);
274
+ }
275
+ async handleWorkOSCallback(req, res) {
276
+ await this.#handleUpstreamCallback('workos', req, res);
277
+ }
278
+ async handleUpstreamProviderChoice(req, res) {
279
+ await continueUpstreamProviderChoice({
280
+ req,
281
+ res,
282
+ store: this.#config.store,
283
+ ...(this.#config.google === undefined ? {} : { google: this.#config.google }),
284
+ ...(this.#config.upstreamAuthenticators?.workos === undefined
285
+ ? {}
286
+ : { workos: this.#config.upstreamAuthenticators.workos }),
287
+ });
288
+ }
289
+ async #handleUpstreamCallback(upstreamProvider, req, res) {
290
+ await handleUpstreamHumanCallback({
291
+ provider: upstreamProvider,
292
+ req,
293
+ res,
294
+ store: this.#config.store,
295
+ issuer: this.#config.issuer,
296
+ ...(this.#config.google === undefined ? {} : { google: this.#config.google }),
297
+ ...(this.#config.upstreamAuthenticators?.workos === undefined
298
+ ? {}
299
+ : { workos: this.#config.upstreamAuthenticators.workos }),
300
+ ...(this.#config.platformPrincipalResolver === undefined
301
+ ? {}
302
+ : { resolver: this.#config.platformPrincipalResolver }),
303
+ ...(this.#config.signupAuthorizer === undefined
304
+ ? {}
305
+ : { signupAuthorizer: this.#config.signupAuthorizer }),
306
+ signupMode: this.#config.signupMode ?? 'restricted',
307
+ ...(this.#config.allowedEmailDomain === undefined
308
+ ? {}
309
+ : { allowedEmailDomain: this.#config.allowedEmailDomain }),
310
+ deniedSignupDomains: this.#config.deniedSignupDomains ?? [],
311
+ deniedSignupSubjects: this.#config.deniedSignupSubjects ?? [],
312
+ ...(this.#config.provisionPlatformPrincipal === undefined
313
+ ? {}
314
+ : { provisionPlatformPrincipal: this.#config.provisionPlatformPrincipal }),
315
+ ...(this.#developerGrantFlow === undefined
316
+ ? {}
317
+ : { developerGrantFlow: this.#developerGrantFlow }),
318
+ tokenIssuer: this.#tokenIssuer,
319
+ signConsent: (claims) => signConsentToken(claims, this.#config.signer, this.#config.issuer, this.#consentTtl),
320
+ logger: this.#logger,
321
+ now: this.#now,
374
322
  });
375
- const client = await this.#config.store.getClient(pending.clientId);
376
- res
377
- .status(200)
378
- .type('html')
379
- .send(renderConsentPage({
380
- clientName: client?.client_name ?? pending.clientId,
381
- resourceHost: hostOf(pending.resource),
382
- redirectHost: hostOf(pending.redirectUri),
383
- userEmail: identity.email,
384
- consentToken,
385
- consentAction: CONSENT_PATH,
386
- }));
387
323
  }
388
- /** Consent decision: on approve, mint a PKCE-bound code and redirect to the client; on deny, redirect with an error. */
389
324
  async handleConsent(req, res) {
390
325
  const body = (req.body ?? {});
391
326
  const consentToken = typeof body.consent_token === 'string' ? body.consent_token : undefined;
@@ -396,7 +331,7 @@ export class NoodleOAuthProvider {
396
331
  }
397
332
  let claims;
398
333
  try {
399
- claims = await this.#verifyConsent(consentToken);
334
+ claims = await verifyConsentToken(consentToken, this.#config.signer, this.#config.issuer);
400
335
  }
401
336
  catch {
402
337
  res.status(400).type('text/plain').send('invalid or expired consent');
@@ -410,7 +345,6 @@ export class NoodleOAuthProvider {
410
345
  res.redirect(302, redirect.href);
411
346
  return;
412
347
  }
413
- // Remember this approval so a later authorization for the same (client, subject, resource) is silent.
414
348
  await this.#config.store.createConsentGrant({
415
349
  clientId: claims.clientId,
416
350
  ownerSubject: claims.ownerSubject,
@@ -436,7 +370,6 @@ export class NoodleOAuthProvider {
436
370
  }
437
371
  await this.#developerGrantFlow.handleDecision(req, res);
438
372
  }
439
- /** Customer bridge callback: verify the tenant app's customer token and issue a normal OAuth code. */
440
373
  async handleFirebaseCustomerAuthorize(req, res) {
441
374
  const input = customerBridgeAuthorizeFields(req);
442
375
  const auth = input.resource !== undefined
@@ -456,7 +389,7 @@ export class NoodleOAuthProvider {
456
389
  const input = customerBridgeCallbackFields(req);
457
390
  const state = input.state;
458
391
  if (input.error !== undefined) {
459
- await this.#redirectPendingError(res, state, input.error);
392
+ await this.#redirectPendingError(res, state, input.error, 'customer_firebase');
460
393
  return;
461
394
  }
462
395
  const idToken = input.id_token;
@@ -464,7 +397,7 @@ export class NoodleOAuthProvider {
464
397
  res.status(400).type('text/plain').send('missing state or id_token');
465
398
  return;
466
399
  }
467
- const pending = await this.#config.store.consumePendingAuthorization(hashToken(state));
400
+ const pending = await this.#config.store.consumePendingAuthorization(hashToken(state), 'customer_firebase');
468
401
  if (!pending) {
469
402
  res.status(400).type('text/plain').send('unknown or expired authorization request');
470
403
  return;
@@ -511,7 +444,7 @@ export class NoodleOAuthProvider {
511
444
  const input = customerBridgeCallbackFields(req);
512
445
  const state = input.state;
513
446
  if (input.error !== undefined) {
514
- await this.#redirectPendingError(res, state, input.error);
447
+ await this.#redirectPendingError(res, state, input.error, 'customer_microsoft');
515
448
  return;
516
449
  }
517
450
  const code = input.code;
@@ -519,7 +452,7 @@ export class NoodleOAuthProvider {
519
452
  res.status(400).type('text/plain').send('missing state or code');
520
453
  return;
521
454
  }
522
- const pending = await this.#config.store.consumePendingAuthorization(hashToken(state));
455
+ const pending = await this.#config.store.consumePendingAuthorization(hashToken(state), 'customer_microsoft');
523
456
  if (!pending) {
524
457
  res.status(400).type('text/plain').send('unknown or expired authorization request');
525
458
  return;
@@ -585,22 +518,6 @@ export class NoodleOAuthProvider {
585
518
  identityProvider: 'microsoft',
586
519
  });
587
520
  }
588
- async #signConsent(claims) {
589
- const key = await this.#config.signer.signingKey();
590
- return new SignJWT({ ...claims })
591
- .setProtectedHeader({ alg: key.alg, kid: key.kid })
592
- .setIssuer(this.#config.issuer)
593
- .setIssuedAt()
594
- .setExpirationTime(`${this.#consentTtl}s`)
595
- .sign(key.privateKey);
596
- }
597
- async #verifyConsent(token) {
598
- const getKey = await this.#config.signer.verifierKey();
599
- const { payload } = await jwtVerify(token, getKey, { issuer: this.#config.issuer });
600
- if (!isConsentClaims(payload))
601
- throw new Error('not a consent token');
602
- return payload;
603
- }
604
521
  #verify() {
605
522
  if (!this.#verifier) {
606
523
  this.#verifier = createJwtVerifier({
@@ -610,7 +527,6 @@ export class NoodleOAuthProvider {
610
527
  }
611
528
  return this.#verifier;
612
529
  }
613
- // A resolver that defers to the signer's public key on first use (the signer's key set is stable).
614
530
  #lazyKey = async (header, input) => {
615
531
  const getKey = await this.#config.signer.verifierKey();
616
532
  return getKey(header, input);
@@ -624,21 +540,14 @@ export class NoodleOAuthProvider {
624
540
  resourcePath: resourcePath(resource),
625
541
  });
626
542
  }
627
- async #redirectPendingError(res, state, error) {
628
- if (state === undefined) {
629
- res.status(400).type('text/plain').send(`customer authorization failed: ${error}`);
630
- return;
631
- }
632
- const pending = await this.#config.store.consumePendingAuthorization(hashToken(state));
633
- if (!pending) {
634
- res.status(400).type('text/plain').send('unknown or expired authorization request');
635
- return;
636
- }
637
- const redirect = new URL(pending.redirectUri);
638
- redirect.searchParams.set('error', error);
639
- if (pending.clientState !== undefined)
640
- redirect.searchParams.set('state', pending.clientState);
641
- res.redirect(302, redirect.href);
543
+ async #redirectPendingError(res, state, error, callbackKind) {
544
+ return redirectPendingAuthorizationError({
545
+ store: this.#config.store,
546
+ res,
547
+ state,
548
+ error,
549
+ callbackKind,
550
+ });
642
551
  }
643
552
  }
644
553
  //# sourceMappingURL=provider.js.map