@plitzi/sdk-server 0.39.0 → 0.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +364 -61
- package/dist/adapters/authAdapters.d.ts +2 -1
- package/dist/adapters/cloudAdapters.d.ts +2 -1
- package/dist/adapters/jsonAdapters.d.ts +2 -1
- package/dist/adapters/space/index.d.ts +3 -3
- package/dist/adapters/space/resolvers.d.ts +41 -4
- package/dist/adapters/space/types.d.ts +11 -1
- package/dist/auth.d.ts +9 -29
- package/dist/auth.js +2323 -22
- package/dist/bundle.d.ts +6 -0
- package/dist/bundle.js +171 -0
- package/dist/cache.d.ts +7 -0
- package/dist/cache.js +1 -0
- package/dist/chunks/buildBody-W9D8ySNY.js +1450 -0
- package/dist/chunks/core-TlrWmT4B.js +2118 -0
- package/dist/chunks/createServer-Bd_b7T3k.js +2956 -0
- package/dist/chunks/platform-DhdFYWm5.js +38 -0
- package/dist/{core/auth/routes.js → chunks/renewal-D98v6-Jd.js} +23 -4
- package/dist/chunks/template-M3IEZ6os.js +42 -0
- package/dist/{core/auth/throttle.js → chunks/throttle-BH7JLIOF.js} +4 -5
- package/dist/chunks/token-B2uY9JzU.js +824 -0
- package/dist/chunks/views/inline/keepTaps.js +1 -0
- package/dist/chunks/views/inline/motionSeen.js +2 -0
- package/dist/{modules/ssr → chunks}/views/template.ejs +62 -100
- package/dist/core/auth/api/admin.d.ts +2 -3
- package/dist/core/auth/api/context.d.ts +24 -29
- package/dist/core/auth/api/factors.d.ts +1 -2
- package/dist/core/auth/api/index.d.ts +30 -30
- package/dist/core/auth/api/profile.d.ts +1 -1
- package/dist/core/auth/api/session.d.ts +1 -2
- package/dist/core/auth/api/types.d.ts +2 -280
- package/dist/core/auth/api/values.d.ts +2 -3
- package/dist/core/auth/createAuth.d.ts +67 -76
- package/dist/core/auth/oauth/index.d.ts +1 -1
- package/dist/core/auth/oauth/providers/oidc.d.ts +0 -6
- package/dist/core/auth/renewal.d.ts +1 -3
- package/dist/core/auth/routes.d.ts +1 -5
- package/dist/core/auth/throttle.d.ts +2 -2
- package/dist/core/createServer.d.ts +14 -5
- package/dist/core/handlers/authMiddleware.d.ts +1 -2
- package/dist/core/handlers/authRouteHandlers.d.ts +1 -2
- package/dist/core/handlers/csrfMiddleware.d.ts +1 -2
- package/dist/core/handlers/oauthRouteHandlers.d.ts +1 -1
- package/dist/core/handlers/socialRouteHandlers.d.ts +2 -3
- package/dist/core/handlers/types.d.ts +1 -3
- package/dist/core/http/pageContext.d.ts +25 -0
- package/dist/core/http/stages/authApi.d.ts +1 -1
- package/dist/core/http/stages/authRoutes.d.ts +4 -10
- package/dist/core/http/stages/cspReport.d.ts +6 -0
- package/dist/core/http/stages/defaultFavicon.d.ts +3 -0
- package/dist/core/http/stages/exchangeRoute.d.ts +3 -2
- package/dist/core/http/stages/fontAssets.d.ts +3 -2
- package/dist/core/http/stages/googleFonts.d.ts +7 -0
- package/dist/core/http/stages/images.d.ts +4 -3
- package/dist/core/http/stages/livePages.d.ts +3 -2
- package/dist/core/http/stages/oauth.d.ts +2 -2
- package/dist/core/http/stages/pluginAssets.d.ts +2 -1
- package/dist/core/http/stages/{static.d.ts → sdkAssets.d.ts} +1 -4
- package/dist/core/http/stages/sessionRenewal.d.ts +4 -3
- package/dist/core/http/stages/signInRoute.d.ts +3 -2
- package/dist/core/oauth/authorize.d.ts +1 -1
- package/dist/core/oauth/challenge.d.ts +1 -1
- package/dist/core/oauth/consentPage.d.ts +1 -1
- package/dist/core/oauth/issueContext.d.ts +1 -1
- package/dist/core/oauth/metadata.d.ts +1 -5
- package/dist/core/oauth/records.d.ts +1 -1
- package/dist/core/oauth/register.d.ts +1 -1
- package/dist/core/oauth/respond.d.ts +1 -1
- package/dist/core/oauth/token.d.ts +1 -1
- package/dist/core/platform.d.ts +13 -0
- package/dist/core/sdkAssets.d.ts +11 -1
- package/dist/core/server/pageServer.d.ts +4 -3
- package/dist/core/server/{fleet/relay.d.ts → relay.d.ts} +1 -2
- package/dist/core/server/reportCacheSharing.d.ts +11 -0
- package/dist/core/services/registry.d.ts +4 -2
- package/dist/core/services/resolve.d.ts +1 -9
- package/dist/core/services/robotsTxt.d.ts +2 -1
- package/dist/core/services/rsc.d.ts +2 -1
- package/dist/core/services/servedSpace.d.ts +1 -1
- package/dist/core/services/sitemapXml.d.ts +2 -1
- package/dist/core/services/spaceDocument.d.ts +2 -1
- package/dist/core/services/ssr.d.ts +2 -1
- package/dist/core/services/styleSheet.d.ts +3 -0
- package/dist/env.js +1 -2
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +517 -5
- package/dist/helpers/buildServerInfo.d.ts +3 -1
- package/dist/helpers/cache/cacheManager.d.ts +1 -1
- package/dist/helpers/cache/defaults.d.ts +22 -1
- package/dist/helpers/cache/index.d.ts +11 -4
- package/dist/helpers/cache/keys.d.ts +27 -4
- package/dist/helpers/cache/limits.d.ts +16 -0
- package/dist/helpers/cache/pages.d.ts +20 -0
- package/dist/helpers/cache/queryParams.d.ts +11 -0
- package/dist/helpers/cache/serverCaches.d.ts +24 -11
- package/dist/helpers/cache/sharedCache.d.ts +29 -0
- package/dist/helpers/hydrationPayload.d.ts +35 -8
- package/dist/helpers/metrics.d.ts +5 -1
- package/dist/helpers/paintedCookie.d.ts +13 -0
- package/dist/helpers/visitorScheme.d.ts +10 -0
- package/dist/hosts/authoringHost/index.d.ts +1 -1
- package/dist/hosts/project/agentRuns.d.ts +1 -1
- package/dist/hosts/project/bundle.d.ts +22 -0
- package/dist/hosts/project/laterAsks.d.ts +1 -1
- package/dist/hosts/project/plugins.d.ts +3 -2
- package/dist/hosts/project/serveProject.d.ts +17 -7
- package/dist/hosts/project/spaceFailure.d.ts +1 -1
- package/dist/index.d.ts +9 -18
- package/dist/index.js +168 -24
- package/dist/modules/fonts/googleFonts.d.ts +27 -0
- package/dist/modules/images/imageProxy.d.ts +1 -1
- package/dist/modules/rsc/connectorRscData.d.ts +10 -12
- package/dist/modules/rsc/externalQueryReader.d.ts +28 -5
- package/dist/modules/rsc/handler.d.ts +3 -1
- package/dist/modules/rsc/matchRscPage.d.ts +0 -8
- package/dist/modules/rsc/publicFileResolver.d.ts +1 -1
- package/dist/modules/rsc/resolveRscData.d.ts +3 -31
- package/dist/modules/ssr/Component.d.ts +6 -3
- package/dist/modules/ssr/applySSRResult.d.ts +2 -6
- package/dist/modules/ssr/buildBody.d.ts +7 -2
- package/dist/modules/ssr/defaultFavicon.d.ts +10 -0
- package/dist/modules/ssr/earlyHints.d.ts +18 -0
- package/dist/modules/ssr/handler.d.ts +4 -2
- package/dist/modules/ssr/loadPluginComponents.d.ts +2 -1
- package/dist/modules/ssr/meterPage.d.ts +4 -0
- package/dist/modules/ssr/pageCache.d.ts +47 -0
- package/dist/modules/ssr/prepareRender.d.ts +11 -3
- package/dist/modules/ssr/preview.d.ts +5 -3
- package/dist/modules/ssr/redisPageStore.d.ts +29 -0
- package/dist/modules/ssr/registerExternalPlugins.d.ts +1 -1
- package/dist/modules/ssr/renderTurns.d.ts +34 -0
- package/dist/modules/ssr/reportMissingPlugins.d.ts +0 -7
- package/dist/modules/ssr/scriptPolicy.d.ts +39 -0
- package/dist/modules/ssr/spaceDocument.d.ts +25 -2
- package/dist/modules/ssr/streamBody.d.ts +9 -3
- package/dist/modules/ssr/styleSheet.d.ts +15 -0
- package/dist/modules/ssr/template.d.ts +8 -1
- package/dist/oauth.js +139 -9
- package/dist/platform.d.ts +6 -0
- package/dist/platform.js +1 -0
- package/dist/project.js +939 -1
- package/dist/spaces.d.ts +7 -0
- package/dist/spaces.js +1 -0
- package/dist/ssr.d.ts +1 -2
- package/dist/ssr.js +1 -4
- package/dist/types/config.d.ts +252 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/server.d.ts +111 -0
- package/package.json +41 -83
- package/skills/plitzi-authoring/recipes/server-data.ts +4 -0
- package/skills/plitzi-authoring/reference/accessibility.md +9 -2
- package/skills/plitzi-authoring/reference/auth.md +6 -1
- package/skills/plitzi-authoring/reference/authoring-errors.md +7 -4
- package/skills/plitzi-authoring/reference/flows.md +9 -9
- package/skills/plitzi-authoring/reference/kept-state.md +12 -0
- package/skills/plitzi-authoring/reference/lists.md +7 -1
- package/skills/plitzi-authoring/reference/plugins.md +5 -2
- package/skills/plitzi-authoring/reference/testing.md +3 -3
- package/dist/actions.d.ts +0 -87
- package/dist/actions.js +0 -23
- package/dist/adapters/authAdapters.js +0 -12
- package/dist/adapters/cloudAdapters.js +0 -364
- package/dist/adapters/jsonAdapters.js +0 -88
- package/dist/adapters/space/index.js +0 -122
- package/dist/adapters/space/resolvers.js +0 -79
- package/dist/adapters/space/types.js +0 -41
- package/dist/core/auth/api/accounts.js +0 -175
- package/dist/core/auth/api/admin.js +0 -146
- package/dist/core/auth/api/context.js +0 -262
- package/dist/core/auth/api/factors.js +0 -209
- package/dist/core/auth/api/index.js +0 -43
- package/dist/core/auth/api/profile.js +0 -243
- package/dist/core/auth/api/session.js +0 -312
- package/dist/core/auth/api/values.js +0 -90
- package/dist/core/auth/authorize.d.ts +0 -96
- package/dist/core/auth/authorize.js +0 -92
- package/dist/core/auth/createAuth.js +0 -216
- package/dist/core/auth/credentials.d.ts +0 -40
- package/dist/core/auth/credentials.js +0 -56
- package/dist/core/auth/csrf.d.ts +0 -143
- package/dist/core/auth/csrf.js +0 -295
- package/dist/core/auth/domains.d.ts +0 -41
- package/dist/core/auth/domains.js +0 -78
- package/dist/core/auth/identity.d.ts +0 -118
- package/dist/core/auth/identity.js +0 -194
- package/dist/core/auth/oauth/client.js +0 -52
- package/dist/core/auth/oauth/index.js +0 -130
- package/dist/core/auth/oauth/providers/github.js +0 -48
- package/dist/core/auth/oauth/providers/google.js +0 -30
- package/dist/core/auth/oauth/providers/oidc.js +0 -197
- package/dist/core/auth/oauth/state.js +0 -57
- package/dist/core/auth/oauth/types.js +0 -16
- package/dist/core/auth/passwords.d.ts +0 -15
- package/dist/core/auth/passwords.js +0 -32
- package/dist/core/auth/redirects.js +0 -31
- package/dist/core/auth/renewal.js +0 -24
- package/dist/core/auth/session.d.ts +0 -194
- package/dist/core/auth/session.js +0 -237
- package/dist/core/auth/sessionActivity.d.ts +0 -11
- package/dist/core/auth/sessionActivity.js +0 -14
- package/dist/core/auth/spaceTokens.d.ts +0 -173
- package/dist/core/auth/spaceTokens.js +0 -264
- package/dist/core/auth/tokens.d.ts +0 -224
- package/dist/core/auth/tokens.js +0 -264
- package/dist/core/auth/totp.js +0 -123
- package/dist/core/configSeam.d.ts +0 -10
- package/dist/core/configSeam.js +0 -151
- package/dist/core/createServer.js +0 -119
- package/dist/core/fontStore.js +0 -53
- package/dist/core/freePort.d.ts +0 -24
- package/dist/core/freePort.js +0 -74
- package/dist/core/handlers/authMiddleware.js +0 -38
- package/dist/core/handlers/authRouteHandlers.js +0 -112
- package/dist/core/handlers/csrfMiddleware.js +0 -56
- package/dist/core/handlers/oauthRouteHandlers.js +0 -161
- package/dist/core/handlers/socialRouteHandlers.js +0 -169
- package/dist/core/health.d.ts +0 -21
- package/dist/core/health.js +0 -40
- package/dist/core/http/dispatcher.d.ts +0 -15
- package/dist/core/http/dispatcher.js +0 -115
- package/dist/core/http/navigation.d.ts +0 -14
- package/dist/core/http/navigation.js +0 -19
- package/dist/core/http/securityHeaders.d.ts +0 -2
- package/dist/core/http/securityHeaders.js +0 -17
- package/dist/core/http/socketResponse.d.ts +0 -18
- package/dist/core/http/socketResponse.js +0 -59
- package/dist/core/http/sse.d.ts +0 -26
- package/dist/core/http/sse.js +0 -78
- package/dist/core/http/stages/authApi.js +0 -66
- package/dist/core/http/stages/authRoutes.js +0 -116
- package/dist/core/http/stages/crossSiteWrites.d.ts +0 -24
- package/dist/core/http/stages/crossSiteWrites.js +0 -45
- package/dist/core/http/stages/exchangeRoute.js +0 -69
- package/dist/core/http/stages/fontAssets.js +0 -27
- package/dist/core/http/stages/health.d.ts +0 -11
- package/dist/core/http/stages/health.js +0 -34
- package/dist/core/http/stages/images.js +0 -49
- package/dist/core/http/stages/livePages.js +0 -80
- package/dist/core/http/stages/middlewares.d.ts +0 -2
- package/dist/core/http/stages/middlewares.js +0 -23
- package/dist/core/http/stages/oauth.js +0 -118
- package/dist/core/http/stages/pluginAssets.js +0 -21
- package/dist/core/http/stages/sessionRenewal.js +0 -82
- package/dist/core/http/stages/signInRoute.js +0 -139
- package/dist/core/http/stages/static.js +0 -48
- package/dist/core/http/types.d.ts +0 -56
- package/dist/core/http/webExchange.d.ts +0 -18
- package/dist/core/http/webExchange.js +0 -53
- package/dist/core/mimeTypes.d.ts +0 -13
- package/dist/core/mimeTypes.js +0 -42
- package/dist/core/oauth/authorize.js +0 -279
- package/dist/core/oauth/challenge.js +0 -33
- package/dist/core/oauth/consentPage.js +0 -134
- package/dist/core/oauth/issueContext.js +0 -32
- package/dist/core/oauth/metadata.js +0 -71
- package/dist/core/oauth/params.js +0 -5
- package/dist/core/oauth/pkce.js +0 -15
- package/dist/core/oauth/records.js +0 -49
- package/dist/core/oauth/register.js +0 -76
- package/dist/core/oauth/respond.js +0 -59
- package/dist/core/oauth/token.js +0 -145
- package/dist/core/previewToken.d.ts +0 -21
- package/dist/core/previewToken.js +0 -32
- package/dist/core/requestParser.d.ts +0 -22
- package/dist/core/requestParser.js +0 -79
- package/dist/core/sdkAssets.js +0 -46
- package/dist/core/server/baseServer.d.ts +0 -30
- package/dist/core/server/baseServer.js +0 -106
- package/dist/core/server/closeOnSignals.d.ts +0 -28
- package/dist/core/server/closeOnSignals.js +0 -47
- package/dist/core/server/drain.d.ts +0 -18
- package/dist/core/server/drain.js +0 -82
- package/dist/core/server/fleet/channel.d.ts +0 -103
- package/dist/core/server/fleet/channel.js +0 -191
- package/dist/core/server/fleet/link.d.ts +0 -23
- package/dist/core/server/fleet/link.js +0 -70
- package/dist/core/server/fleet/relay.js +0 -112
- package/dist/core/server/fleet/role.d.ts +0 -46
- package/dist/core/server/fleet/role.js +0 -59
- package/dist/core/server/fleet/stores.d.ts +0 -21
- package/dist/core/server/fleet/stores.js +0 -46
- package/dist/core/server/fleet/supervisor.d.ts +0 -28
- package/dist/core/server/fleet/supervisor.js +0 -120
- package/dist/core/server/pageServer.js +0 -124
- package/dist/core/services/action.d.ts +0 -11
- package/dist/core/services/action.js +0 -123
- package/dist/core/services/functionRoutes.d.ts +0 -9
- package/dist/core/services/functionRoutes.js +0 -53
- package/dist/core/services/realtime.d.ts +0 -8
- package/dist/core/services/realtime.js +0 -62
- package/dist/core/services/registry.js +0 -47
- package/dist/core/services/resolve.js +0 -25
- package/dist/core/services/robotsTxt.js +0 -50
- package/dist/core/services/rsc.js +0 -13
- package/dist/core/services/servedSpace.js +0 -16
- package/dist/core/services/sitemapXml.js +0 -37
- package/dist/core/services/spaceDocument.js +0 -11
- package/dist/core/services/ssr.js +0 -13
- package/dist/core/staticFiles.d.ts +0 -3
- package/dist/core/staticFiles.js +0 -49
- package/dist/core/transports.d.ts +0 -31
- package/dist/core/transports.js +0 -61
- package/dist/core/unusedPort.d.ts +0 -10
- package/dist/core/unusedPort.js +0 -38
- package/dist/functions-api.d.ts +0 -679
- package/dist/functions.d.ts +0 -21
- package/dist/functions.js +0 -6
- package/dist/functionsRunner.d.ts +0 -20
- package/dist/functionsRunner.js +0 -7
- package/dist/helpers/atomicFile.d.ts +0 -10
- package/dist/helpers/atomicFile.js +0 -33
- package/dist/helpers/buildResponseHelpers.d.ts +0 -21
- package/dist/helpers/buildResponseHelpers.js +0 -84
- package/dist/helpers/buildServerInfo.js +0 -86
- package/dist/helpers/cache/CompressedFileCache.d.ts +0 -18
- package/dist/helpers/cache/CompressedFileCache.js +0 -44
- package/dist/helpers/cache/TtlCache.d.ts +0 -15
- package/dist/helpers/cache/TtlCache.js +0 -57
- package/dist/helpers/cache/cacheManager.js +0 -50
- package/dist/helpers/cache/defaults.js +0 -9
- package/dist/helpers/cache/keys.js +0 -130
- package/dist/helpers/cache/serverCaches.js +0 -15
- package/dist/helpers/compress.d.ts +0 -20
- package/dist/helpers/compress.js +0 -61
- package/dist/helpers/debugAuthorization.d.ts +0 -24
- package/dist/helpers/debugAuthorization.js +0 -27
- package/dist/helpers/escapeHtml.js +0 -13
- package/dist/helpers/escapeJson.js +0 -4
- package/dist/helpers/fileStore.d.ts +0 -60
- package/dist/helpers/fileStore.js +0 -127
- package/dist/helpers/flagOverrides.d.ts +0 -30
- package/dist/helpers/flagOverrides.js +0 -26
- package/dist/helpers/hydrationPayload.js +0 -57
- package/dist/helpers/metrics.js +0 -37
- package/dist/helpers/normalizePlugins.js +0 -16
- package/dist/helpers/offlineDataLoader.js +0 -15
- package/dist/helpers/onAbort.d.ts +0 -12
- package/dist/helpers/onAbort.js +0 -22
- package/dist/helpers/outboundGuard.d.ts +0 -64
- package/dist/helpers/outboundGuard.js +0 -218
- package/dist/helpers/paintedCookie.js +0 -13
- package/dist/helpers/readCookie.js +0 -11
- package/dist/helpers/reportReactBuild.js +0 -18
- package/dist/helpers/resolveDebugMode.js +0 -13
- package/dist/helpers/runMiddlewares.d.ts +0 -2
- package/dist/helpers/runMiddlewares.js +0 -21
- package/dist/helpers/serverLog.d.ts +0 -37
- package/dist/helpers/serverLog.js +0 -116
- package/dist/helpers/wsFrame.d.ts +0 -3
- package/dist/helpers/wsFrame.js +0 -5
- package/dist/hosts/authoringHost/index.js +0 -118
- package/dist/hosts/project/agentRuns.js +0 -107
- package/dist/hosts/project/laterAsks.js +0 -117
- package/dist/hosts/project/plugins.js +0 -185
- package/dist/hosts/project/serveProject.js +0 -396
- package/dist/hosts/project/spaceFailure.js +0 -86
- package/dist/hosts/project/watchSpace.js +0 -86
- package/dist/kernel.d.ts +0 -25
- package/dist/kernel.js +0 -10
- package/dist/middlewares/auth.d.ts +0 -2
- package/dist/middlewares/auth.js +0 -10
- package/dist/middlewares/basicAuth.d.ts +0 -6
- package/dist/middlewares/basicAuth.js +0 -67
- package/dist/middlewares/spaceDeployment.d.ts +0 -2
- package/dist/middlewares/spaceDeployment.js +0 -17
- package/dist/modules/actions/connectorWrite.d.ts +0 -11
- package/dist/modules/actions/connectorWrite.js +0 -83
- package/dist/modules/actions/index.d.ts +0 -78
- package/dist/modules/actions/index.js +0 -129
- package/dist/modules/actions/jobs/failureStreak.d.ts +0 -17
- package/dist/modules/actions/jobs/failureStreak.js +0 -47
- package/dist/modules/actions/jobs/fileQueue.d.ts +0 -34
- package/dist/modules/actions/jobs/fileQueue.js +0 -72
- package/dist/modules/actions/jobs/index.d.ts +0 -34
- package/dist/modules/actions/jobs/index.js +0 -60
- package/dist/modules/actions/jobs/later.d.ts +0 -43
- package/dist/modules/actions/jobs/later.js +0 -69
- package/dist/modules/actions/jobs/memoryQueue.d.ts +0 -33
- package/dist/modules/actions/jobs/memoryQueue.js +0 -42
- package/dist/modules/actions/jobs/queueDocument.d.ts +0 -14
- package/dist/modules/actions/jobs/queueDocument.js +0 -22
- package/dist/modules/actions/jobs/queueRules.d.ts +0 -39
- package/dist/modules/actions/jobs/queueRules.js +0 -270
- package/dist/modules/actions/jobs/scheduler.d.ts +0 -64
- package/dist/modules/actions/jobs/scheduler.js +0 -133
- package/dist/modules/actions/jobs/schedules.d.ts +0 -23
- package/dist/modules/actions/jobs/schedules.js +0 -47
- package/dist/modules/actions/jobs/storeClock.d.ts +0 -16
- package/dist/modules/actions/jobs/storeClock.js +0 -32
- package/dist/modules/actions/jobs/worker.d.ts +0 -67
- package/dist/modules/actions/jobs/worker.js +0 -361
- package/dist/modules/actions/moduleFor.d.ts +0 -3
- package/dist/modules/actions/moduleFor.js +0 -44
- package/dist/modules/actions/runtime/check.d.ts +0 -24
- package/dist/modules/actions/runtime/check.js +0 -122
- package/dist/modules/actions/runtime/credentials.d.ts +0 -10
- package/dist/modules/actions/runtime/credentials.js +0 -28
- package/dist/modules/actions/runtime/email.d.ts +0 -39
- package/dist/modules/actions/runtime/email.js +0 -91
- package/dist/modules/actions/runtime/errors.d.ts +0 -42
- package/dist/modules/actions/runtime/errors.js +0 -53
- package/dist/modules/actions/runtime/fileKv.d.ts +0 -35
- package/dist/modules/actions/runtime/fileKv.js +0 -81
- package/dist/modules/actions/runtime/flags.d.ts +0 -16
- package/dist/modules/actions/runtime/flags.js +0 -49
- package/dist/modules/actions/runtime/guards.d.ts +0 -144
- package/dist/modules/actions/runtime/guards.js +0 -255
- package/dist/modules/actions/runtime/kvChange.d.ts +0 -67
- package/dist/modules/actions/runtime/kvChange.js +0 -45
- package/dist/modules/actions/runtime/kvList.d.ts +0 -55
- package/dist/modules/actions/runtime/kvList.js +0 -56
- package/dist/modules/actions/runtime/kvStore.d.ts +0 -35
- package/dist/modules/actions/runtime/kvStore.js +0 -81
- package/dist/modules/actions/runtime/limits.d.ts +0 -11
- package/dist/modules/actions/runtime/limits.js +0 -35
- package/dist/modules/actions/runtime/memoryKv.d.ts +0 -28
- package/dist/modules/actions/runtime/memoryKv.js +0 -110
- package/dist/modules/actions/runtime/namespaceKv.d.ts +0 -9
- package/dist/modules/actions/runtime/namespaceKv.js +0 -35
- package/dist/modules/actions/runtime/precheck.d.ts +0 -27
- package/dist/modules/actions/runtime/precheck.js +0 -41
- package/dist/modules/actions/runtime/projectData.d.ts +0 -18
- package/dist/modules/actions/runtime/projectData.js +0 -69
- package/dist/modules/actions/runtime/rateLimit.d.ts +0 -26
- package/dist/modules/actions/runtime/rateLimit.js +0 -25
- package/dist/modules/actions/runtime/redisKv.d.ts +0 -27
- package/dist/modules/actions/runtime/redisKv.js +0 -46
- package/dist/modules/actions/runtime/renderResolver.d.ts +0 -16
- package/dist/modules/actions/runtime/renderResolver.js +0 -240
- package/dist/modules/actions/runtime/renderShare.d.ts +0 -12
- package/dist/modules/actions/runtime/renderShare.js +0 -70
- package/dist/modules/actions/runtime/report.d.ts +0 -14
- package/dist/modules/actions/runtime/report.js +0 -23
- package/dist/modules/actions/runtime/runAction.d.ts +0 -26
- package/dist/modules/actions/runtime/runAction.js +0 -606
- package/dist/modules/actions/runtime/runLogger.d.ts +0 -36
- package/dist/modules/actions/runtime/runLogger.js +0 -72
- package/dist/modules/actions/runtime/scope.d.ts +0 -40
- package/dist/modules/actions/runtime/scope.js +0 -129
- package/dist/modules/actions/runtime/signing.d.ts +0 -27
- package/dist/modules/actions/runtime/signing.js +0 -50
- package/dist/modules/actions/runtime/taskContext.d.ts +0 -51
- package/dist/modules/actions/runtime/taskContext.js +0 -125
- package/dist/modules/actions/runtime/triggers.d.ts +0 -12
- package/dist/modules/actions/runtime/triggers.js +0 -14
- package/dist/modules/actions/taskCatalog.d.ts +0 -28
- package/dist/modules/actions/taskCatalog.js +0 -25
- package/dist/modules/actions/tasks/auth.d.ts +0 -2
- package/dist/modules/actions/tasks/auth.js +0 -42
- package/dist/modules/actions/tasks/builtins.d.ts +0 -10
- package/dist/modules/actions/tasks/builtins.js +0 -32
- package/dist/modules/actions/tasks/connector.d.ts +0 -2
- package/dist/modules/actions/tasks/connector.js +0 -145
- package/dist/modules/actions/tasks/db.d.ts +0 -2
- package/dist/modules/actions/tasks/db.js +0 -59
- package/dist/modules/actions/tasks/email.d.ts +0 -2
- package/dist/modules/actions/tasks/email.js +0 -72
- package/dist/modules/actions/tasks/flow.d.ts +0 -3
- package/dist/modules/actions/tasks/flow.js +0 -282
- package/dist/modules/actions/tasks/helpers.d.ts +0 -16
- package/dist/modules/actions/tasks/helpers.js +0 -30
- package/dist/modules/actions/tasks/http.d.ts +0 -2
- package/dist/modules/actions/tasks/http.js +0 -111
- package/dist/modules/actions/tasks/kv.d.ts +0 -2
- package/dist/modules/actions/tasks/kv.js +0 -146
- package/dist/modules/actions/tasks/list.d.ts +0 -2
- package/dist/modules/actions/tasks/list.js +0 -154
- package/dist/modules/actions/tasks/realtime.d.ts +0 -2
- package/dist/modules/actions/tasks/realtime.js +0 -104
- package/dist/modules/actions/tasks/registry.d.ts +0 -26
- package/dist/modules/actions/tasks/registry.js +0 -63
- package/dist/modules/actions/tasks/transform.d.ts +0 -2
- package/dist/modules/actions/tasks/transform.js +0 -36
- package/dist/modules/actions/transport/callHandler.d.ts +0 -24
- package/dist/modules/actions/transport/callHandler.js +0 -296
- package/dist/modules/actions/transport/cancelHandler.d.ts +0 -23
- package/dist/modules/actions/transport/cancelHandler.js +0 -23
- package/dist/modules/actions/transport/catalogHandler.d.ts +0 -21
- package/dist/modules/actions/transport/catalogHandler.js +0 -22
- package/dist/modules/actions/transport/stream.d.ts +0 -22
- package/dist/modules/actions/transport/stream.js +0 -36
- package/dist/modules/actions/transport/verifySignature.d.ts +0 -16
- package/dist/modules/actions/transport/verifySignature.js +0 -72
- package/dist/modules/actions/transport/webhookHandler.d.ts +0 -25
- package/dist/modules/actions/transport/webhookHandler.js +0 -207
- package/dist/modules/actions/types.d.ts +0 -520
- package/dist/modules/connectors/engine.d.ts +0 -47
- package/dist/modules/connectors/engine.js +0 -222
- package/dist/modules/connectors/getByPath.d.ts +0 -8
- package/dist/modules/connectors/getByPath.js +0 -21
- package/dist/modules/connectors/index.d.ts +0 -7
- package/dist/modules/connectors/projection.d.ts +0 -18
- package/dist/modules/connectors/projection.js +0 -108
- package/dist/modules/connectors/resolver.d.ts +0 -27
- package/dist/modules/connectors/resolver.js +0 -74
- package/dist/modules/connectors/types.d.ts +0 -19
- package/dist/modules/functions/build.d.ts +0 -27
- package/dist/modules/functions/build.js +0 -216
- package/dist/modules/functions/capabilities.d.ts +0 -22
- package/dist/modules/functions/capabilities.js +0 -435
- package/dist/modules/functions/config.d.ts +0 -76
- package/dist/modules/functions/config.js +0 -40
- package/dist/modules/functions/context.d.ts +0 -20
- package/dist/modules/functions/context.js +0 -146
- package/dist/modules/functions/contract.d.ts +0 -329
- package/dist/modules/functions/contract.js +0 -9
- package/dist/modules/functions/driver.d.ts +0 -37
- package/dist/modules/functions/driver.js +0 -368
- package/dist/modules/functions/jobControl.d.ts +0 -21
- package/dist/modules/functions/jobControl.js +0 -43
- package/dist/modules/functions/jobs.d.ts +0 -98
- package/dist/modules/functions/jobs.js +0 -438
- package/dist/modules/functions/load.d.ts +0 -22
- package/dist/modules/functions/load.js +0 -49
- package/dist/modules/functions/local.d.ts +0 -31
- package/dist/modules/functions/local.js +0 -64
- package/dist/modules/functions/manifest.d.ts +0 -31
- package/dist/modules/functions/manifest.js +0 -337
- package/dist/modules/functions/native.d.ts +0 -9
- package/dist/modules/functions/native.js +0 -22
- package/dist/modules/functions/oauth.d.ts +0 -33
- package/dist/modules/functions/oauth.js +0 -360
- package/dist/modules/functions/protocol.d.ts +0 -344
- package/dist/modules/functions/protocol.js +0 -32
- package/dist/modules/functions/routes.d.ts +0 -51
- package/dist/modules/functions/routes.js +0 -242
- package/dist/modules/functions/runner/messages.d.ts +0 -4
- package/dist/modules/functions/runner/messages.js +0 -229
- package/dist/modules/functions/runner/remote.d.ts +0 -19
- package/dist/modules/functions/runner/remote.js +0 -168
- package/dist/modules/functions/runner/service.d.ts +0 -32
- package/dist/modules/functions/runner/service.js +0 -255
- package/dist/modules/functions/sandbox/guest/bytes.d.ts +0 -27
- package/dist/modules/functions/sandbox/guest/bytes.js +0 -108
- package/dist/modules/functions/sandbox/guest/crypto.d.ts +0 -47
- package/dist/modules/functions/sandbox/guest/crypto.js +0 -144
- package/dist/modules/functions/sandbox/guest/events.d.ts +0 -152
- package/dist/modules/functions/sandbox/guest/events.js +0 -143
- package/dist/modules/functions/sandbox/guest/fetch.d.ts +0 -305
- package/dist/modules/functions/sandbox/guest/fetch.js +0 -237
- package/dist/modules/functions/sandbox/guest/index.d.ts +0 -28
- package/dist/modules/functions/sandbox/guest/index.js +0 -130
- package/dist/modules/functions/sandbox/guest/types.d.ts +0 -38
- package/dist/modules/functions/sandbox/isolate.d.ts +0 -37
- package/dist/modules/functions/sandbox/isolate.js +0 -360
- package/dist/modules/functions/sandbox/prelude.d.ts +0 -2
- package/dist/modules/functions/sandbox/prelude.js +0 -49
- package/dist/modules/functions/scope.d.ts +0 -30
- package/dist/modules/functions/scope.js +0 -28
- package/dist/modules/functions/space.d.ts +0 -47
- package/dist/modules/functions/space.js +0 -185
- package/dist/modules/functions/tryEntry.d.ts +0 -9
- package/dist/modules/functions/tryEntry.js +0 -49
- package/dist/modules/images/allowlist.js +0 -18
- package/dist/modules/images/imageProxy.js +0 -291
- package/dist/modules/images/transform.js +0 -28
- package/dist/modules/mongo/index.d.ts +0 -4
- package/dist/modules/mongo/jobQueue.d.ts +0 -38
- package/dist/modules/mongo/jobQueue.js +0 -453
- package/dist/modules/mongo/kv.d.ts +0 -15
- package/dist/modules/mongo/kv.js +0 -129
- package/dist/modules/mysql/accounts.d.ts +0 -5
- package/dist/modules/mysql/accounts.js +0 -378
- package/dist/modules/mysql/admin.d.ts +0 -58
- package/dist/modules/mysql/admin.js +0 -133
- package/dist/modules/mysql/config.d.ts +0 -82
- package/dist/modules/mysql/config.js +0 -30
- package/dist/modules/mysql/identities.d.ts +0 -35
- package/dist/modules/mysql/identities.js +0 -43
- package/dist/modules/mysql/index.d.ts +0 -68
- package/dist/modules/mysql/index.js +0 -62
- package/dist/modules/mysql/jobs/index.d.ts +0 -5
- package/dist/modules/mysql/jobs/jobQueue.d.ts +0 -40
- package/dist/modules/mysql/jobs/jobQueue.js +0 -458
- package/dist/modules/mysql/jobs/kv.d.ts +0 -18
- package/dist/modules/mysql/jobs/kv.js +0 -108
- package/dist/modules/mysql/jobs/schema.d.ts +0 -28
- package/dist/modules/mysql/jobs/schema.js +0 -109
- package/dist/modules/mysql/pool.d.ts +0 -3
- package/dist/modules/mysql/pool.js +0 -88
- package/dist/modules/mysql/query.d.ts +0 -12
- package/dist/modules/mysql/query.js +0 -21
- package/dist/modules/mysql/schema.d.ts +0 -43
- package/dist/modules/mysql/schema.js +0 -390
- package/dist/modules/mysql/sessions.d.ts +0 -23
- package/dist/modules/mysql/sessions.js +0 -52
- package/dist/modules/mysql/spaceTokens.d.ts +0 -11
- package/dist/modules/mysql/spaceTokens.js +0 -59
- package/dist/modules/realtime/declarations.d.ts +0 -11
- package/dist/modules/realtime/declarations.js +0 -26
- package/dist/modules/realtime/failure.d.ts +0 -6
- package/dist/modules/realtime/failure.js +0 -11
- package/dist/modules/realtime/grants.d.ts +0 -23
- package/dist/modules/realtime/grants.js +0 -61
- package/dist/modules/realtime/handlers.d.ts +0 -85
- package/dist/modules/realtime/handlers.js +0 -266
- package/dist/modules/realtime/hub.d.ts +0 -71
- package/dist/modules/realtime/hub.js +0 -184
- package/dist/modules/realtime/index.d.ts +0 -75
- package/dist/modules/realtime/index.js +0 -89
- package/dist/modules/realtime/jobs.d.ts +0 -20
- package/dist/modules/realtime/jobs.js +0 -41
- package/dist/modules/realtime/memoryPubSub.d.ts +0 -10
- package/dist/modules/realtime/memoryPubSub.js +0 -43
- package/dist/modules/realtime/message.d.ts +0 -3
- package/dist/modules/realtime/message.js +0 -5
- package/dist/modules/realtime/presence.d.ts +0 -33
- package/dist/modules/realtime/presence.js +0 -56
- package/dist/modules/realtime/redisPubSub.d.ts +0 -24
- package/dist/modules/realtime/redisPubSub.js +0 -36
- package/dist/modules/realtime/retained.d.ts +0 -25
- package/dist/modules/realtime/retained.js +0 -47
- package/dist/modules/realtime/socket.d.ts +0 -30
- package/dist/modules/realtime/socket.js +0 -123
- package/dist/modules/rsc/connectorRscData.js +0 -79
- package/dist/modules/rsc/externalQueryReader.js +0 -43
- package/dist/modules/rsc/handler.js +0 -176
- package/dist/modules/rsc/matchRscPage.js +0 -26
- package/dist/modules/rsc/publicFileResolver.js +0 -73
- package/dist/modules/rsc/resolveRscData.js +0 -146
- package/dist/modules/runtime/bundle.d.ts +0 -29
- package/dist/modules/runtime/bundle.js +0 -117
- package/dist/modules/runtime/contract.d.ts +0 -37
- package/dist/modules/runtime/contract.js +0 -21
- package/dist/modules/runtime/host.d.ts +0 -38
- package/dist/modules/runtime/host.js +0 -68
- package/dist/modules/runtime/inside.d.ts +0 -36
- package/dist/modules/runtime/inside.js +0 -95
- package/dist/modules/runtime/runner.d.ts +0 -12
- package/dist/modules/runtime/runner.js +0 -48
- package/dist/modules/runtime/stages.d.ts +0 -53
- package/dist/modules/runtime/stages.js +0 -117
- package/dist/modules/sqlite/jobQueue.d.ts +0 -35
- package/dist/modules/sqlite/jobQueue.js +0 -56
- package/dist/modules/sqlite/kv.d.ts +0 -34
- package/dist/modules/sqlite/kv.js +0 -91
- package/dist/modules/sqlite/open.d.ts +0 -3
- package/dist/modules/sqlite/open.js +0 -13
- package/dist/modules/ssr/Component.js +0 -37
- package/dist/modules/ssr/applySSRResult.js +0 -54
- package/dist/modules/ssr/buildBody.js +0 -35
- package/dist/modules/ssr/handler.js +0 -103
- package/dist/modules/ssr/loadPluginComponents.js +0 -81
- package/dist/modules/ssr/prepareRender.js +0 -332
- package/dist/modules/ssr/preview.js +0 -70
- package/dist/modules/ssr/registerExternalPlugins.js +0 -111
- package/dist/modules/ssr/reportMissingPlugins.js +0 -24
- package/dist/modules/ssr/resolvePageSeo.js +0 -41
- package/dist/modules/ssr/spaceDocument.js +0 -85
- package/dist/modules/ssr/streamBody.js +0 -69
- package/dist/modules/ssr/template.js +0 -10
- package/dist/mongo.d.ts +0 -25
- package/dist/mongo.js +0 -3
- package/dist/mysql.d.ts +0 -37
- package/dist/mysql.js +0 -7
- package/dist/plugins/compile.js +0 -53
- package/dist/plugins/copy.js +0 -28
- package/dist/plugins/detect.js +0 -9
- package/dist/plugins/manager.js +0 -508
- package/dist/plugins/validate.js +0 -23
- package/dist/plugins/watch.js +0 -79
- package/dist/runtime.d.ts +0 -16
- package/dist/runtime.js +0 -7
- package/dist/sqlite.d.ts +0 -24
- package/dist/sqlite.js +0 -3
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
import { h as escapeHtml } from "./core-TlrWmT4B.js";
|
|
2
|
+
import { forwardedIp, requestAuthority, requestOrigin } from "@plitzi/sdk-kernel/http";
|
|
3
|
+
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
4
|
+
// src/core/oauth/consentPage.ts
|
|
5
|
+
var STYLES = `
|
|
6
|
+
:root { color-scheme: light dark; --bg: #f6f7f9; --panel: #ffffff; --ink: #16181d; --muted: #6b7280;
|
|
7
|
+
--line: #e2e5ea; --accent: #2563eb; --danger: #b91c1c; }
|
|
8
|
+
@media (prefers-color-scheme: dark) {
|
|
9
|
+
:root { --bg: #0f1115; --panel: #171a21; --ink: #e8eaee; --muted: #9aa1ad; --line: #262b35;
|
|
10
|
+
--accent: #60a5fa; --danger: #f87171; }
|
|
11
|
+
}
|
|
12
|
+
* { box-sizing: border-box; }
|
|
13
|
+
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
|
|
14
|
+
background: var(--bg); color: var(--ink);
|
|
15
|
+
font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
|
|
16
|
+
main { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
|
|
17
|
+
border-radius: 14px; padding: 32px; }
|
|
18
|
+
img.logo { display: block; height: 32px; margin-bottom: 20px; }
|
|
19
|
+
h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
|
|
20
|
+
p.lede { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
|
|
21
|
+
p.client { margin: -12px 0 24px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
|
|
22
|
+
font-size: 14px; }
|
|
23
|
+
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
24
|
+
ul.targets { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
|
|
25
|
+
ul.targets label { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px;
|
|
26
|
+
border: 1px solid var(--line); border-radius: 8px; font-weight: 400; cursor: pointer; }
|
|
27
|
+
ul.targets strong { display: block; font-weight: 500; }
|
|
28
|
+
ul.targets span { color: var(--muted); font-size: 13px; }
|
|
29
|
+
button { width: 100%; padding: 11px 16px; border: 0; border-radius: 8px; background: var(--accent);
|
|
30
|
+
color: #fff; font: inherit; font-weight: 500; cursor: pointer; }
|
|
31
|
+
button.guest { margin-top: 10px; background: transparent; color: var(--accent);
|
|
32
|
+
border: 1px solid var(--line); }
|
|
33
|
+
p.error { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; color: var(--danger);
|
|
34
|
+
border: 1px solid currentColor; font-size: 14px; }
|
|
35
|
+
p.note { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
|
|
36
|
+
p.note a { color: var(--accent); }
|
|
37
|
+
`;
|
|
38
|
+
var hiddenFields = (hidden) => Object.entries(hidden).map(([name, value]) => `<input type="hidden" name="${escapeHtml(name)}" value="${escapeHtml(value)}">`).join("\n ");
|
|
39
|
+
var guestButton = (guest) => {
|
|
40
|
+
const note = guest.description ? `\n <p class="note">${escapeHtml(guest.description)}</p>` : "";
|
|
41
|
+
return `\n <button class="guest" type="submit" name="guest" value="1" formnovalidate>${escapeHtml(guest.label)}</button>${note}`;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The way out for somebody signed in as the wrong account.
|
|
45
|
+
*
|
|
46
|
+
* Under the grant button rather than beside the account name, because it is the escape hatch and not the action:
|
|
47
|
+
* almost everybody who reaches this screen is who they meant to be, and the ones who are not have no other route
|
|
48
|
+
* back — they arrived from another application, and the deployment's sign-out page is somewhere they cannot get to
|
|
49
|
+
* from here without abandoning the connection.
|
|
50
|
+
*
|
|
51
|
+
* `formnovalidate` for the same reason the guest button carries it: this submit is not the form's own answer.
|
|
52
|
+
*/
|
|
53
|
+
var switchUserButton = () => "\n <button class=\"guest\" type=\"submit\" name=\"switch\" value=\"1\" formnovalidate>Use another account</button>";
|
|
54
|
+
var targetFields = (view) => {
|
|
55
|
+
return `<ul class="targets">
|
|
56
|
+
${view.targets.map((target, index) => {
|
|
57
|
+
const description = target.description ? `<span>${escapeHtml(target.description)}</span>` : "";
|
|
58
|
+
return `<li><label>
|
|
59
|
+
<input type="radio" name="target" value="${escapeHtml(target.value)}"${index === 0 ? " checked" : ""}>
|
|
60
|
+
<span><strong>${escapeHtml(target.label)}</strong>${description}</span>
|
|
61
|
+
</label></li>`;
|
|
62
|
+
}).join("\n ")}
|
|
63
|
+
</ul>
|
|
64
|
+
<button type="submit">Allow access</button>${view.canSwitchUser ? switchUserButton() : ""}`;
|
|
65
|
+
};
|
|
66
|
+
/** What a visitor who has not signed in is offered: the guest connection, and a way to go and sign in. */
|
|
67
|
+
var anonymousFields = (view) => {
|
|
68
|
+
const signIn = view.signInUrl ? `\n <p class="note"><a href="${escapeHtml(view.signInUrl)}">Sign in to connect a space instead</a></p>` : "";
|
|
69
|
+
return `${view.guest ? guestButton(view.guest) : ""}${signIn}`;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Who is asking and where the grant goes. The name is whatever the client registered as, so it is never shown alone:
|
|
73
|
+
* the destination host is what a person can check against the app they just opened.
|
|
74
|
+
*/
|
|
75
|
+
var clientNotice = (client) => {
|
|
76
|
+
const destination = client.loopback ? "an app on this computer" : `<strong>${escapeHtml(client.redirectHost)}</strong>`;
|
|
77
|
+
return `<p class="client"><strong>${escapeHtml(client.name)}</strong> is asking for access. If you continue, it is sent to ${destination}.</p>`;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The grant screen — the ONE page this server renders, and it never asks who anybody is.
|
|
81
|
+
*
|
|
82
|
+
* It used to be two steps, the first of which took a username and a password. That is gone: signing in happens on
|
|
83
|
+
* the deployment's own sign-in screen (`OAuthConfig.signInUrl`), and this page is reached either already signed in
|
|
84
|
+
* — pick what to connect — or as a visitor who may only take the guest connection.
|
|
85
|
+
*/
|
|
86
|
+
var renderConsentPage = (view) => {
|
|
87
|
+
const productName = view.branding.productName ?? "Plitzi";
|
|
88
|
+
const logo = view.branding.logoUrl ? `<img class="logo" src="${escapeHtml(view.branding.logoUrl)}" alt="${escapeHtml(productName)}">` : "";
|
|
89
|
+
const error = view.error ? `<p class="error">${escapeHtml(view.error)}</p>` : "";
|
|
90
|
+
const lede = view.user ? `Signed in as ${escapeHtml(view.user.label)}. Choose what to grant access to.` : `Connect ${escapeHtml(productName)} without an account, or sign in first.`;
|
|
91
|
+
return `<!doctype html>
|
|
92
|
+
<html lang="en">
|
|
93
|
+
<head>
|
|
94
|
+
<meta charset="utf-8">
|
|
95
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
96
|
+
<meta name="robots" content="noindex">
|
|
97
|
+
<link rel="icon" href="data:,">
|
|
98
|
+
<title>${escapeHtml(productName)}</title>
|
|
99
|
+
<style>${STYLES}${view.branding.css ?? ""}</style>
|
|
100
|
+
</head>
|
|
101
|
+
<body>
|
|
102
|
+
<main>
|
|
103
|
+
${logo}
|
|
104
|
+
<h1>${escapeHtml(productName)}</h1>
|
|
105
|
+
<p class="lede">${lede}</p>
|
|
106
|
+
${clientNotice(view.client)}
|
|
107
|
+
${error}
|
|
108
|
+
<form method="post" action="${escapeHtml(view.action)}">
|
|
109
|
+
${hiddenFields(view.hidden)}
|
|
110
|
+
${view.user ? targetFields(view) : anonymousFields(view)}
|
|
111
|
+
</form>
|
|
112
|
+
</main>
|
|
113
|
+
</body>
|
|
114
|
+
</html>`;
|
|
115
|
+
};
|
|
116
|
+
/** The dead end for a request that cannot be redirected back — a bad `redirect_uri` or an unknown client. Bouncing
|
|
117
|
+
* those to the client would make this server an open redirector, so the user is told here instead. */
|
|
118
|
+
var renderErrorPage = (title, detail) => `<!doctype html>
|
|
119
|
+
<html lang="en">
|
|
120
|
+
<head>
|
|
121
|
+
<meta charset="utf-8">
|
|
122
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
123
|
+
<meta name="robots" content="noindex">
|
|
124
|
+
<link rel="icon" href="data:,">
|
|
125
|
+
<title>${escapeHtml(title)}</title>
|
|
126
|
+
<style>${STYLES}</style>
|
|
127
|
+
</head>
|
|
128
|
+
<body>
|
|
129
|
+
<main>
|
|
130
|
+
<h1>${escapeHtml(title)}</h1>
|
|
131
|
+
<p class="lede">${escapeHtml(detail)}</p>
|
|
132
|
+
</main>
|
|
133
|
+
</body>
|
|
134
|
+
</html>`;
|
|
135
|
+
// src/core/oauth/records.ts
|
|
136
|
+
var CLIENT_TTL_SECONDS = 7776e3;
|
|
137
|
+
var PENDING_TTL_SECONDS = 600;
|
|
138
|
+
var keyOf = (kind, id) => `oauth:${kind}:${id}`;
|
|
139
|
+
var readJson = async (store, kind, id) => {
|
|
140
|
+
const raw = await store.get(keyOf(kind, id));
|
|
141
|
+
if (!raw) return;
|
|
142
|
+
try {
|
|
143
|
+
return JSON.parse(raw);
|
|
144
|
+
} catch {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var writeJson = async (store, kind, id, value, ttlSeconds) => {
|
|
149
|
+
await store.put(keyOf(kind, id), JSON.stringify(value), ttlSeconds);
|
|
150
|
+
};
|
|
151
|
+
var putClient = (store, client) => writeJson(store, "client", client.clientId, client, CLIENT_TTL_SECONDS);
|
|
152
|
+
var getClient = (store, clientId) => readJson(store, "client", clientId);
|
|
153
|
+
/** The id already handed out for an identical registration. Keyed by what the client asked to be registered AS,
|
|
154
|
+
* so the same request always resolves to the same client — see handleRegister for why that matters. */
|
|
155
|
+
var getClientByFingerprint = async (store, fingerprint) => {
|
|
156
|
+
const clientId = await store.get(keyOf("clientfp", fingerprint));
|
|
157
|
+
return clientId ? getClient(store, clientId) : void 0;
|
|
158
|
+
};
|
|
159
|
+
var putClientFingerprint = async (store, fingerprint, clientId) => {
|
|
160
|
+
await store.put(keyOf("clientfp", fingerprint), clientId, CLIENT_TTL_SECONDS);
|
|
161
|
+
};
|
|
162
|
+
var putPending = (store, id, pending) => writeJson(store, "pending", id, pending, PENDING_TTL_SECONDS);
|
|
163
|
+
var getPending = (store, id) => readJson(store, "pending", id);
|
|
164
|
+
var dropPending = async (store, id) => {
|
|
165
|
+
await store.drop(keyOf("pending", id));
|
|
166
|
+
};
|
|
167
|
+
var putCode = (store, code, record, ttlSeconds) => writeJson(store, "code", code, record, ttlSeconds);
|
|
168
|
+
var getCode = (store, code) => readJson(store, "code", code);
|
|
169
|
+
var dropCode = async (store, code) => {
|
|
170
|
+
await store.drop(keyOf("code", code));
|
|
171
|
+
};
|
|
172
|
+
var putRefresh = (store, token, record, ttlSeconds) => writeJson(store, "refresh", token, record, ttlSeconds);
|
|
173
|
+
var getRefresh = (store, token) => readJson(store, "refresh", token);
|
|
174
|
+
var dropRefresh = async (store, token) => {
|
|
175
|
+
await store.drop(keyOf("refresh", token));
|
|
176
|
+
};
|
|
177
|
+
var dropAccess = async (store, token) => {
|
|
178
|
+
await store.drop(keyOf("access", token));
|
|
179
|
+
};
|
|
180
|
+
var putAccess = (store, token, record, ttlSeconds) => writeJson(store, "access", token, record, ttlSeconds);
|
|
181
|
+
var getAccess = (store, token) => readJson(store, "access", token);
|
|
182
|
+
// src/core/oauth/issueContext.ts
|
|
183
|
+
/**
|
|
184
|
+
* What `issueToken` is told about who it issues to, beyond the person: the application, as it registered, and the
|
|
185
|
+
* request the credential is issued on.
|
|
186
|
+
*
|
|
187
|
+
* The application is read from its registration rather than trusted from the request — a client names itself once,
|
|
188
|
+
* when it registers, and every credential its grants mint carries that name. A registration that has aged out of the
|
|
189
|
+
* store (a grant renewed for longer than the client record lives) is still an application, just an unnamed one.
|
|
190
|
+
*/
|
|
191
|
+
var issueContextFor = async (config, clientId, extra = {}) => {
|
|
192
|
+
const client = await getClient(config.adapters.store, clientId);
|
|
193
|
+
const userAgent = extra.req?.headers["user-agent"];
|
|
194
|
+
const ip = extra.req ? extra.req.ip ?? forwardedIp(extra.req.headers) : "";
|
|
195
|
+
const request = {
|
|
196
|
+
...typeof userAgent === "string" && userAgent ? { userAgent } : {},
|
|
197
|
+
...ip ? { ip } : {}
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
client: {
|
|
201
|
+
clientId,
|
|
202
|
+
name: client?.clientName ?? "Unnamed application",
|
|
203
|
+
...client?.softwareId ? { softwareId: client.softwareId } : {}
|
|
204
|
+
},
|
|
205
|
+
...request.userAgent || request.ip ? { request } : {},
|
|
206
|
+
...extra.replaces ? { replaces: extra.replaces } : {},
|
|
207
|
+
...extra.redirectUri ? { redirectUri: extra.redirectUri } : {}
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
// src/core/oauth/metadata.ts
|
|
211
|
+
var AUTHORIZE_PATH = "/authorize";
|
|
212
|
+
var TOKEN_PATH = "/token";
|
|
213
|
+
var REVOKE_PATH = "/revoke";
|
|
214
|
+
var REGISTER_PATH = "/register";
|
|
215
|
+
var PROTECTED_RESOURCE_PATH = "/.well-known/oauth-protected-resource";
|
|
216
|
+
var AUTHORIZATION_SERVER_PATH = "/.well-known/oauth-authorization-server";
|
|
217
|
+
var DEFAULT_SCOPES = ["plitzi"];
|
|
218
|
+
/** The identifier the two documents agree on. This server is both the protected resource and its own
|
|
219
|
+
* authorization server, so one origin names both. Derived from the request unless pinned, which keeps a
|
|
220
|
+
* deployment correct across its dev, staging and production hosts without per-environment config. */
|
|
221
|
+
var issuerOf = (config, req) => config.issuer ?? requestOrigin(req);
|
|
222
|
+
var scopesOf = (config) => config.scopes ?? DEFAULT_SCOPES;
|
|
223
|
+
var canonicalPath = (path) => path.replace(/\/+$/, "");
|
|
224
|
+
/** Where the challenge points a host, for an MCP endpoint served at `req.path`. RFC 9728 §3.1 appends the
|
|
225
|
+
* resource's own path to the well-known path, and a host that reads the document back expects its `resource` to
|
|
226
|
+
* name the URL it was configured with — so a server mounted at /mcp must be pointed at the suffixed document,
|
|
227
|
+
* not the bare one. */
|
|
228
|
+
var resourceMetadataUrl = (config, req) => `${issuerOf(config, req)}${PROTECTED_RESOURCE_PATH}${canonicalPath(req.path)}`;
|
|
229
|
+
/** RFC 9728. The document Claude Desktop asks for FIRST, and the one whose absence ends the flow before anything
|
|
230
|
+
* else is tried — a 404 here is what a host reports as `mcp_auth_start_failed`.
|
|
231
|
+
*
|
|
232
|
+
* `resource` echoes the path the document was asked for: Claude requires it to match the server URL the user
|
|
233
|
+
* typed, path included, and a dedicated MCP server answers JSON-RPC on every path — so `/.well-known/…/mcp`
|
|
234
|
+
* describes `https://host/mcp` while the bare path describes the origin.
|
|
235
|
+
*
|
|
236
|
+
* A server mounted at the ORIGIN is `https://host/`, WITH the trailing slash: a host parses the URL the user
|
|
237
|
+
* typed before it does anything with it, and an empty path renders as `/` — Claude's connector was observed
|
|
238
|
+
* asking for exactly `resource=https%3A%2F%2Fhost%2F`, so that is the form the document must claim.
|
|
239
|
+
*
|
|
240
|
+
* It does NOT make a bare-origin connector work, and nothing here can. Claude's remote-connector service will
|
|
241
|
+
* not open a session against an MCP endpoint whose URL has no path: the whole grant succeeds — discovery,
|
|
242
|
+
* registration, consent, a 200 from /token with the scope it asked for — and then it reports
|
|
243
|
+
* `McpAuthorizationError` ("the integration rejected the credentials it just issued") without ever presenting
|
|
244
|
+
* the bearer. Verified against the same deployment, minutes apart: at /mcp the token is followed by
|
|
245
|
+
* `initialize`, at / nothing follows it, in the ingress log as well as this server's. Claiming `https://host/mcp`
|
|
246
|
+
* from the bare document would only fail sooner — a client checks that the resource it is handed is no MORE
|
|
247
|
+
* specific than the URL it holds. Publish the connector URL WITH its path. */
|
|
248
|
+
var protectedResourceMetadata = (config, req) => {
|
|
249
|
+
const issuer = issuerOf(config, req);
|
|
250
|
+
return {
|
|
251
|
+
resource: `${issuer}${canonicalPath(req.path.slice(37)) || "/"}`,
|
|
252
|
+
authorization_servers: [issuer],
|
|
253
|
+
scopes_supported: scopesOf(config),
|
|
254
|
+
bearer_methods_supported: ["header"]
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
/** RFC 8414. Public clients with PKCE only: a desktop host stores no secret, so `none` is the sole endpoint auth
|
|
258
|
+
* method and S256 the sole challenge method. `offline_access` is advertised whenever refresh grants are issued,
|
|
259
|
+
* which is the signal a host looks for before asking for one. */
|
|
260
|
+
var authorizationServerMetadata = (config, req) => {
|
|
261
|
+
const issuer = issuerOf(config, req);
|
|
262
|
+
const refreshes = config.refreshTtlSeconds !== 0;
|
|
263
|
+
const grantTypes = refreshes ? ["authorization_code", "refresh_token"] : ["authorization_code"];
|
|
264
|
+
const scopes = refreshes ? [...scopesOf(config), "offline_access"] : scopesOf(config);
|
|
265
|
+
return {
|
|
266
|
+
issuer,
|
|
267
|
+
authorization_endpoint: `${issuer}${AUTHORIZE_PATH}`,
|
|
268
|
+
token_endpoint: `${issuer}${TOKEN_PATH}`,
|
|
269
|
+
registration_endpoint: `${issuer}${REGISTER_PATH}`,
|
|
270
|
+
revocation_endpoint: `${issuer}${REVOKE_PATH}`,
|
|
271
|
+
response_types_supported: ["code"],
|
|
272
|
+
grant_types_supported: grantTypes,
|
|
273
|
+
code_challenge_methods_supported: ["S256"],
|
|
274
|
+
token_endpoint_auth_methods_supported: ["none"],
|
|
275
|
+
scopes_supported: scopes
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
// src/core/oauth/params.ts
|
|
279
|
+
var field = (params, name) => params[name] ?? "";
|
|
280
|
+
var optionalField = (params, name) => params[name] || void 0;
|
|
281
|
+
// src/core/oauth/pkce.ts
|
|
282
|
+
/** An unguessable, URL-safe identifier for the values this layer hands out (codes, refresh tokens, client ids).
|
|
283
|
+
* 256 bits from the CSPRNG, so they are also unguessable by anyone who collects a few of them. */
|
|
284
|
+
var randomId = () => randomBytes(32).toString("base64url");
|
|
285
|
+
/** RFC 7636 S256, the only method this server accepts — `plain` puts the verifier on the wire, and a public
|
|
286
|
+
* client on a desktop host has no other proof it is the one that started the flow. */
|
|
287
|
+
var verifyChallenge = (verifier, challenge) => {
|
|
288
|
+
if (!verifier || !challenge) return false;
|
|
289
|
+
const computed = Buffer.from(createHash("sha256").update(verifier).digest("base64url"));
|
|
290
|
+
const expected = Buffer.from(challenge);
|
|
291
|
+
return computed.length === expected.length && timingSafeEqual(computed, expected);
|
|
292
|
+
};
|
|
293
|
+
// src/core/oauth/respond.ts
|
|
294
|
+
var sendJson = (res, status, body) => {
|
|
295
|
+
res.setStatus(status);
|
|
296
|
+
res.setHeader("Content-Type", "application/json");
|
|
297
|
+
res.setHeader("Cache-Control", "no-store, no-transform");
|
|
298
|
+
res.send(JSON.stringify(body));
|
|
299
|
+
};
|
|
300
|
+
var sendHtml = (res, status, html) => {
|
|
301
|
+
res.setStatus(status);
|
|
302
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
303
|
+
res.setHeader("Cache-Control", "no-store, no-transform");
|
|
304
|
+
res.send(html);
|
|
305
|
+
};
|
|
306
|
+
var sendErrorJson = (res, status, error, description) => sendJson(res, status, {
|
|
307
|
+
error,
|
|
308
|
+
error_description: description
|
|
309
|
+
});
|
|
310
|
+
/** Shown when the authorization request itself is unusable — an unknown client, a `redirect_uri` that is not
|
|
311
|
+
* registered. Redirecting those back would turn the endpoint into an open redirector. */
|
|
312
|
+
var sendErrorPage = (res, title, detail) => sendHtml(res, 400, renderErrorPage(title, detail));
|
|
313
|
+
/** The other half of RFC 6749 error handling: once the redirect target is known to be legitimate, failures go
|
|
314
|
+
* back to the client so the host can report them, carrying `state` so it can match the response to its request. */
|
|
315
|
+
var redirectWithError = (res, redirectUri, error, description, state) => {
|
|
316
|
+
const url = new URL(redirectUri);
|
|
317
|
+
url.searchParams.set("error", error);
|
|
318
|
+
url.searchParams.set("error_description", description);
|
|
319
|
+
if (state !== void 0) url.searchParams.set("state", state);
|
|
320
|
+
res.setStatus(302);
|
|
321
|
+
res.setHeader("Location", url.toString());
|
|
322
|
+
res.setHeader("Cache-Control", "no-store, no-transform");
|
|
323
|
+
res.end();
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Send the browser somewhere else entirely, carrying where to come back to.
|
|
327
|
+
*
|
|
328
|
+
* Used for the hand-off to the sign-in screen. The destination is passed as `redirect` — the same param the auth
|
|
329
|
+
* space reads — and it is the WHOLE authorization request, so resuming is an ordinary navigation and this server
|
|
330
|
+
* keeps no session of its own for a flow that is one page long.
|
|
331
|
+
*/
|
|
332
|
+
var redirectToSignIn = (res, signInUrl, returnTo) => {
|
|
333
|
+
const url = new URL(signInUrl);
|
|
334
|
+
url.searchParams.set("redirect", returnTo);
|
|
335
|
+
res.setStatus(302);
|
|
336
|
+
res.setHeader("Location", url.toString());
|
|
337
|
+
res.setHeader("Cache-Control", "no-store, no-transform");
|
|
338
|
+
res.end();
|
|
339
|
+
};
|
|
340
|
+
var redirectWithCode = (res, redirectUri, code, state) => {
|
|
341
|
+
const url = new URL(redirectUri);
|
|
342
|
+
url.searchParams.set("code", code);
|
|
343
|
+
if (state !== void 0) url.searchParams.set("state", state);
|
|
344
|
+
res.setStatus(302);
|
|
345
|
+
res.setHeader("Location", url.toString());
|
|
346
|
+
res.setHeader("Cache-Control", "no-store, no-transform");
|
|
347
|
+
res.end();
|
|
348
|
+
};
|
|
349
|
+
// src/core/oauth/register.ts
|
|
350
|
+
var parseUri = (value) => {
|
|
351
|
+
try {
|
|
352
|
+
return new URL(value);
|
|
353
|
+
} catch {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
/** Plain http on the loopback interface — the exception RFC 8252 carves out for a native app listening on a port. */
|
|
358
|
+
var isLoopbackRedirectUri = (value) => {
|
|
359
|
+
const url = parseUri(value);
|
|
360
|
+
return url?.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* A redirect target must be one the user's browser can be sent to safely: https anywhere, or loopback. A deployment
|
|
364
|
+
* whose clients are all native apps narrows that to loopback alone (see `OAuthConfig.loopbackRedirectsOnly`).
|
|
365
|
+
*/
|
|
366
|
+
var isUsableRedirectUri = (value, loopbackOnly) => isLoopbackRedirectUri(value) || !loopbackOnly && parseUri(value)?.protocol === "https:";
|
|
367
|
+
var stringList = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
368
|
+
var nowSeconds = () => Math.floor(Date.now() / 1e3);
|
|
369
|
+
var fingerprintOf = (clientName, redirectUris) => createHash("sha256").update(JSON.stringify([clientName, [...redirectUris].sort()])).digest("base64url");
|
|
370
|
+
/**
|
|
371
|
+
* What a client calls itself is shown to the person it acts for — on the grant screen and in their list of devices — so
|
|
372
|
+
* it is bounded: a name is a line of text, not a document a client can fill the screen with.
|
|
373
|
+
*/
|
|
374
|
+
var CLIENT_NAME_MAX = 120;
|
|
375
|
+
var SOFTWARE_ID_MAX = 64;
|
|
376
|
+
var textField = (value, max) => {
|
|
377
|
+
if (typeof value !== "string") return;
|
|
378
|
+
return value.trim().slice(0, max) || void 0;
|
|
379
|
+
};
|
|
380
|
+
/** RFC 7591 dynamic client registration. A remote host has no way to be configured into this server ahead of
|
|
381
|
+
* time, so it registers itself on first connect; the record it gets back is only ever used to pin the redirect
|
|
382
|
+
* target, since a public client authenticates with PKCE rather than with credentials. */
|
|
383
|
+
var handleRegister = async (config, res, body) => {
|
|
384
|
+
if (typeof body !== "object" || body === null) {
|
|
385
|
+
sendErrorJson(res, 400, "invalid_request", "Expected a JSON client metadata object.");
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const metadata = body;
|
|
389
|
+
const loopbackOnly = config.loopbackRedirectsOnly === true;
|
|
390
|
+
const redirectUris = stringList(metadata["redirect_uris"]).filter((uri) => isUsableRedirectUri(uri, loopbackOnly));
|
|
391
|
+
if (redirectUris.length === 0) {
|
|
392
|
+
sendErrorJson(res, 400, "invalid_request", loopbackOnly ? "redirect_uris must list at least one loopback URI (http://127.0.0.1:<port>/…)." : "redirect_uris must list at least one https (or loopback) URI.");
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const clientName = textField(metadata["client_name"], CLIENT_NAME_MAX) ?? "MCP client";
|
|
396
|
+
const softwareId = textField(metadata["software_id"], SOFTWARE_ID_MAX);
|
|
397
|
+
const { store } = config.adapters;
|
|
398
|
+
const fingerprint = fingerprintOf(clientName, redirectUris);
|
|
399
|
+
const client = await getClientByFingerprint(store, fingerprint) ?? {
|
|
400
|
+
clientId: randomId(),
|
|
401
|
+
clientName,
|
|
402
|
+
...softwareId ? { softwareId } : {},
|
|
403
|
+
redirectUris,
|
|
404
|
+
issuedAt: nowSeconds()
|
|
405
|
+
};
|
|
406
|
+
await putClient(store, client);
|
|
407
|
+
await putClientFingerprint(store, fingerprint, client.clientId);
|
|
408
|
+
sendJson(res, 201, {
|
|
409
|
+
client_id: client.clientId,
|
|
410
|
+
client_id_issued_at: client.issuedAt,
|
|
411
|
+
client_name: clientName,
|
|
412
|
+
...client.softwareId ? { software_id: client.softwareId } : {},
|
|
413
|
+
redirect_uris: redirectUris,
|
|
414
|
+
grant_types: config.refreshTtlSeconds === 0 ? ["authorization_code"] : ["authorization_code", "refresh_token"],
|
|
415
|
+
response_types: ["code"],
|
|
416
|
+
token_endpoint_auth_method: "none"
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
// src/core/oauth/authorize.ts
|
|
420
|
+
var DEFAULT_CODE_TTL_SECONDS = 60;
|
|
421
|
+
var DEFAULT_GUEST_LABEL = "Continue without an account";
|
|
422
|
+
var DEFAULT_GUEST_USER = {
|
|
423
|
+
id: "guest",
|
|
424
|
+
label: "Guest"
|
|
425
|
+
};
|
|
426
|
+
var guestView = (guest) => ({
|
|
427
|
+
label: guest.label ?? DEFAULT_GUEST_LABEL,
|
|
428
|
+
description: guest.target.description
|
|
429
|
+
});
|
|
430
|
+
var hiddenFieldsFor = (request, pendingId) => {
|
|
431
|
+
const hidden = {
|
|
432
|
+
client_id: request.clientId,
|
|
433
|
+
redirect_uri: request.redirectUri,
|
|
434
|
+
code_challenge: request.challenge,
|
|
435
|
+
code_challenge_method: "S256"
|
|
436
|
+
};
|
|
437
|
+
if (request.state !== void 0) hidden["state"] = request.state;
|
|
438
|
+
if (request.scope !== void 0) hidden["scope"] = request.scope;
|
|
439
|
+
if (pendingId !== void 0) hidden["pending"] = pendingId;
|
|
440
|
+
return hidden;
|
|
441
|
+
};
|
|
442
|
+
/** Who is asking and where the answer goes, as the grant screen shows it (see `OAuthConsentView.client`). */
|
|
443
|
+
var consentClient = (request) => ({
|
|
444
|
+
name: request.clientName,
|
|
445
|
+
redirectHost: new URL(request.redirectUri).host,
|
|
446
|
+
loopback: isLoopbackRedirectUri(request.redirectUri)
|
|
447
|
+
});
|
|
448
|
+
var renderConsent = (res, view) => {
|
|
449
|
+
sendHtml(res, 200, renderConsentPage(view));
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* This request, as the address to come back to after signing in.
|
|
453
|
+
*
|
|
454
|
+
* Rebuilt from the params rather than read off `req.url` because the two can differ — a proxy may rewrite the
|
|
455
|
+
* path — and what has to survive the round trip is the QUERY, which is the authorization request itself.
|
|
456
|
+
*/
|
|
457
|
+
/**
|
|
458
|
+
* Where `/authorize` is, for this server: its issuer and the path, joined — the issuer may carry a path of its own when
|
|
459
|
+
* the server is mounted under a prefix, which resolving `/authorize` against it would drop. The same joining the
|
|
460
|
+
* discovery document publishes the endpoint by.
|
|
461
|
+
*/
|
|
462
|
+
var authorizeEndpoint = (config, req) => new URL(`${(config.issuer ?? `https://${requestAuthority(req)}`).replace(/\/+$/u, "")}${AUTHORIZE_PATH}`);
|
|
463
|
+
/** The same endpoint, as the path the grant screen's form posts to — this server's own origin, whatever it is. */
|
|
464
|
+
var authorizeAction = (config) => config.issuer ? `${new URL(config.issuer).pathname.replace(/\/+$/u, "")}${AUTHORIZE_PATH}` : AUTHORIZE_PATH;
|
|
465
|
+
var authorizeUrl = (config, req, params) => {
|
|
466
|
+
const url = authorizeEndpoint(config, req);
|
|
467
|
+
for (const [key, value] of Object.entries(params)) if (typeof value === "string") url.searchParams.set(key, value);
|
|
468
|
+
return url.toString();
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* The sign-in screen's own address, carrying `guest=1` when this server would take somebody without an account.
|
|
472
|
+
*
|
|
473
|
+
* The hint is the only thing that tells that screen so. It is shared by every client now, most of which require an
|
|
474
|
+
* account, so it cannot offer a way past itself by default — and without the hint, leaving this screen for it is a
|
|
475
|
+
* ONE-WAY door: whoever went to see what signing in involves has no way back to the guest button except the
|
|
476
|
+
* browser's own history, on a page they arrived at from another application entirely.
|
|
477
|
+
*
|
|
478
|
+
* Every hand-off to that screen goes through here, which is the point: the door is one-way from the grant screen's
|
|
479
|
+
* "sign in" link and from "use another account" alike, and the second one is where it was missed.
|
|
480
|
+
*/
|
|
481
|
+
var signInBase = (config) => {
|
|
482
|
+
if (!config.guest) return config.signInUrl;
|
|
483
|
+
const url = new URL(config.signInUrl);
|
|
484
|
+
url.searchParams.set("guest", "1");
|
|
485
|
+
return url.toString();
|
|
486
|
+
};
|
|
487
|
+
/** The sign-in address with this request as the destination — what the grant screen's "sign in" link points at. */
|
|
488
|
+
var signInWithReturn = (config, req, params) => {
|
|
489
|
+
const url = new URL(signInBase(config));
|
|
490
|
+
url.searchParams.set("redirect", authorizeUrl(config, req, params));
|
|
491
|
+
return url.toString();
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* The same address again, rebuilt from the request rather than from the query it arrived as.
|
|
495
|
+
*
|
|
496
|
+
* The grant screen is reached by a GET with the parameters in the URL and by a POST with them in hidden fields, and
|
|
497
|
+
* the "use another account" link has to work on both — so it is built from the parts the request is MADE of, which
|
|
498
|
+
* both paths already carry, instead of from whichever shape they came in.
|
|
499
|
+
*/
|
|
500
|
+
var authorizeUrlFor = (config, req, request) => {
|
|
501
|
+
const url = authorizeEndpoint(config, req);
|
|
502
|
+
url.searchParams.set("response_type", "code");
|
|
503
|
+
url.searchParams.set("client_id", request.clientId);
|
|
504
|
+
url.searchParams.set("redirect_uri", request.redirectUri);
|
|
505
|
+
url.searchParams.set("code_challenge", request.challenge);
|
|
506
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
507
|
+
if (request.state !== void 0) url.searchParams.set("state", request.state);
|
|
508
|
+
if (request.scope !== void 0) url.searchParams.set("scope", request.scope);
|
|
509
|
+
return url.toString();
|
|
510
|
+
};
|
|
511
|
+
/** Validates the parts of an authorization request that decide WHERE a failure may be reported. Until the client
|
|
512
|
+
* and its redirect target check out, nothing may be sent back to the client. */
|
|
513
|
+
var resolveRequest = async (config, res, params) => {
|
|
514
|
+
const clientId = field(params, "client_id");
|
|
515
|
+
const redirectUri = field(params, "redirect_uri");
|
|
516
|
+
const client = clientId ? await getClient(config.adapters.store, clientId) : void 0;
|
|
517
|
+
if (!client) {
|
|
518
|
+
sendErrorPage(res, "Unknown client", "This application is not registered with the server, or its registration expired.");
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
if (!redirectUri || !client.redirectUris.includes(redirectUri)) {
|
|
522
|
+
sendErrorPage(res, "Invalid redirect", "The application asked to be sent back to an address it did not register.");
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
if (config.loopbackRedirectsOnly && !isLoopbackRedirectUri(redirectUri)) {
|
|
526
|
+
sendErrorPage(res, "Invalid redirect", "Only an application running on this computer can sign in here.");
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const state = optionalField(params, "state");
|
|
530
|
+
const responseType = field(params, "response_type");
|
|
531
|
+
if (responseType && responseType !== "code") {
|
|
532
|
+
redirectWithError(res, redirectUri, "unsupported_response_type", "Only the authorization code flow is supported.", state);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const challenge = field(params, "code_challenge");
|
|
536
|
+
const method = field(params, "code_challenge_method");
|
|
537
|
+
if (!challenge || method !== "S256") {
|
|
538
|
+
redirectWithError(res, redirectUri, "invalid_request", "PKCE with code_challenge_method=S256 is required.", state);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
clientId,
|
|
543
|
+
clientName: client.clientName,
|
|
544
|
+
redirectUri,
|
|
545
|
+
challenge,
|
|
546
|
+
state,
|
|
547
|
+
scope: optionalField(params, "scope")
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
/** Consent granted: mint the bearer now, park it behind a one-shot code and send the browser back. Minting here
|
|
551
|
+
* rather than at redemption keeps a failure the user can act on — no space, revoked access — on this screen. */
|
|
552
|
+
var completeGrant = async (config, res, req, request, user, target) => {
|
|
553
|
+
const issued = await config.adapters.issueToken(user, target, await issueContextFor(config, request.clientId, {
|
|
554
|
+
req,
|
|
555
|
+
redirectUri: request.redirectUri
|
|
556
|
+
}));
|
|
557
|
+
if (!issued) {
|
|
558
|
+
redirectWithError(res, request.redirectUri, "access_denied", "The account may not grant access to this resource.", request.state);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const code = randomId();
|
|
562
|
+
await putCode(config.adapters.store, code, {
|
|
563
|
+
clientId: request.clientId,
|
|
564
|
+
redirectUri: request.redirectUri,
|
|
565
|
+
challenge: request.challenge,
|
|
566
|
+
token: issued.token,
|
|
567
|
+
expiresInSeconds: issued.expiresInSeconds,
|
|
568
|
+
scope: request.scope,
|
|
569
|
+
user,
|
|
570
|
+
target
|
|
571
|
+
}, config.codeTtlSeconds ?? DEFAULT_CODE_TTL_SECONDS);
|
|
572
|
+
redirectWithCode(res, request.redirectUri, code, request.state);
|
|
573
|
+
};
|
|
574
|
+
/**
|
|
575
|
+
* Show a signed-in account what it may grant, and end the flow if there is nothing.
|
|
576
|
+
*
|
|
577
|
+
* `pendingId` is minted here because the screen it renders is the one that POSTs back, and the record is what
|
|
578
|
+
* proves — on that POST — that identity was established before anything was granted.
|
|
579
|
+
*/
|
|
580
|
+
var askForTarget = async (config, res, request, user, error) => {
|
|
581
|
+
const targets = await config.adapters.grantTargets(user, { scope: request.scope });
|
|
582
|
+
if (targets.length === 0) {
|
|
583
|
+
redirectWithError(res, request.redirectUri, "access_denied", "This account has nothing to grant access to.", request.state);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const pendingId = randomId();
|
|
587
|
+
await putPending(config.adapters.store, pendingId, {
|
|
588
|
+
clientId: request.clientId,
|
|
589
|
+
redirectUri: request.redirectUri,
|
|
590
|
+
challenge: request.challenge,
|
|
591
|
+
state: request.state,
|
|
592
|
+
scope: request.scope,
|
|
593
|
+
user
|
|
594
|
+
});
|
|
595
|
+
renderConsent(res, {
|
|
596
|
+
action: authorizeAction(config),
|
|
597
|
+
hidden: hiddenFieldsFor(request, pendingId),
|
|
598
|
+
targets,
|
|
599
|
+
user,
|
|
600
|
+
canSwitchUser: config.adapters.signOut !== void 0,
|
|
601
|
+
error,
|
|
602
|
+
client: consentClient(request),
|
|
603
|
+
branding: config.branding ?? {}
|
|
604
|
+
});
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* GET /authorize — the entry point a host opens in the user's browser.
|
|
608
|
+
*
|
|
609
|
+
* This server does not ask for a password. It reads whoever the browser already is and, from there:
|
|
610
|
+
*
|
|
611
|
+
* - **signed in** — straight to the grant screen, which is the only page this module still renders. Choosing what
|
|
612
|
+
* to connect is authorization, and authorization is this server's job; who somebody is is not.
|
|
613
|
+
* - **not signed in, guest allowed** — the grant screen with nothing to grant and the guest button on it. It is
|
|
614
|
+
* deliberately NOT a redirect: a guest has no session and never will, so bouncing them to sign in would take
|
|
615
|
+
* the option away from the only people it exists for.
|
|
616
|
+
* - **not signed in, no guest** — off to `signInUrl`, carrying this whole request as where to come back to.
|
|
617
|
+
*/
|
|
618
|
+
var handleAuthorizeStart = async (config, res, params, req) => {
|
|
619
|
+
const request = await resolveRequest(config, res, params);
|
|
620
|
+
if (!request) return;
|
|
621
|
+
const user = await config.adapters.identify(req);
|
|
622
|
+
if (user) {
|
|
623
|
+
await askForTarget(config, res, request, user);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (config.guest) {
|
|
627
|
+
renderConsent(res, {
|
|
628
|
+
action: authorizeAction(config),
|
|
629
|
+
hidden: hiddenFieldsFor(request),
|
|
630
|
+
targets: [],
|
|
631
|
+
guest: guestView(config.guest),
|
|
632
|
+
signInUrl: signInWithReturn(config, req, params),
|
|
633
|
+
client: consentClient(request),
|
|
634
|
+
branding: config.branding ?? {}
|
|
635
|
+
});
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
redirectToSignIn(res, signInBase(config), authorizeUrl(config, req, params));
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* POST /authorize — the grant screen coming back, either with a chosen target or with the guest button.
|
|
642
|
+
*
|
|
643
|
+
* There is no credentials branch any more: nothing here reads a username or a password, and the only way to reach
|
|
644
|
+
* this with an identity is to carry a `pending` id that was minted after {@link OAuthAdapters.identify} succeeded.
|
|
645
|
+
*/
|
|
646
|
+
var handleAuthorizeSubmit = async (config, res, params, req) => {
|
|
647
|
+
const request = await resolveRequest(config, res, params);
|
|
648
|
+
if (!request) return;
|
|
649
|
+
/**
|
|
650
|
+
* "Use another account": end the session and start this same request over.
|
|
651
|
+
*
|
|
652
|
+
* Before the pending record is read, because there is nothing to grant — the point is that whoever is signed in
|
|
653
|
+
* is not who should be. The request goes back out through `signInUrl` exactly as an unidentified visitor's would,
|
|
654
|
+
* so the sign-in screen brings them here again with the new session in place.
|
|
655
|
+
*/
|
|
656
|
+
if (config.adapters.signOut && optionalField(params, "switch")) {
|
|
657
|
+
const pendingId = optionalField(params, "pending");
|
|
658
|
+
if (pendingId) await dropPending(config.adapters.store, pendingId);
|
|
659
|
+
await config.adapters.signOut(req, res);
|
|
660
|
+
redirectToSignIn(res, signInBase(config), authorizeUrlFor(config, req, request));
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
const { guest } = config;
|
|
664
|
+
if (guest && optionalField(params, "guest")) {
|
|
665
|
+
await completeGrant(config, res, req, request, guest.user ?? DEFAULT_GUEST_USER, guest.target);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const pendingId = optionalField(params, "pending");
|
|
669
|
+
if (!pendingId) {
|
|
670
|
+
redirectWithError(res, request.redirectUri, "invalid_request", "The grant was submitted without a session.", request.state);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const pending = await getPending(config.adapters.store, pendingId);
|
|
674
|
+
if (!pending || pending.clientId !== request.clientId) {
|
|
675
|
+
redirectWithError(res, request.redirectUri, "access_denied", "The sign-in expired. Try connecting again.", request.state);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const chosen = (await config.adapters.grantTargets(pending.user, { scope: request.scope })).find((target) => target.value === field(params, "target"));
|
|
679
|
+
if (!chosen) {
|
|
680
|
+
await dropPending(config.adapters.store, pendingId);
|
|
681
|
+
await askForTarget(config, res, request, pending.user, "Choose what to grant access to.");
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
await dropPending(config.adapters.store, pendingId);
|
|
685
|
+
await completeGrant(config, res, req, request, pending.user, chosen);
|
|
686
|
+
};
|
|
687
|
+
// src/core/oauth/token.ts
|
|
688
|
+
var DEFAULT_REFRESH_TTL_SECONDS = 2592e3;
|
|
689
|
+
var DEFAULT_ACCESS_TTL_SECONDS = 2592e3;
|
|
690
|
+
var refreshTtlOf = (config) => config.refreshTtlSeconds ?? DEFAULT_REFRESH_TTL_SECONDS;
|
|
691
|
+
var scopeOf = (config, requested) => requested ?? scopesOf(config).join(" ");
|
|
692
|
+
/** The token response, plus a rotated refresh grant when refresh is enabled. Rotation is unconditional: a refresh
|
|
693
|
+
* token is a long-lived credential, so the one just used never stays valid. */
|
|
694
|
+
var sendTokens = async (config, res, credential, expiresInSeconds, grant) => {
|
|
695
|
+
const ttl = refreshTtlOf(config);
|
|
696
|
+
/**
|
|
697
|
+
* What the client actually receives, and the two answers are a real policy choice.
|
|
698
|
+
*
|
|
699
|
+
* By default it is a HANDLE to the grant, not the credential behind it: what `issueToken` minted is usually good
|
|
700
|
+
* against more of the platform than this endpoint, so it stays on this side of the boundary and the resource
|
|
701
|
+
* side swaps it back. That is right for a connector holding a space token.
|
|
702
|
+
*
|
|
703
|
+
* `directTokens` gives the client the credential itself, for the case where the credential is exactly what the
|
|
704
|
+
* client should hold — a native app granted the person's own SESSION. There the handle buys nothing and costs:
|
|
705
|
+
* a second thing to revoke, and a store read on every request to an API that already knows how to read a
|
|
706
|
+
* session. Either way an access record is written, because it is also what lets the resource side recognise a
|
|
707
|
+
* bearer this server issued.
|
|
708
|
+
*/
|
|
709
|
+
const bearer = config.directTokens ? credential : randomId();
|
|
710
|
+
await putAccess(config.adapters.store, bearer, {
|
|
711
|
+
credential,
|
|
712
|
+
clientId: grant.clientId,
|
|
713
|
+
user: grant.user,
|
|
714
|
+
target: grant.target
|
|
715
|
+
}, Math.max(expiresInSeconds ?? DEFAULT_ACCESS_TTL_SECONDS, 1));
|
|
716
|
+
const body = {
|
|
717
|
+
access_token: bearer,
|
|
718
|
+
token_type: "Bearer",
|
|
719
|
+
scope: scopeOf(config, grant.scope),
|
|
720
|
+
/**
|
|
721
|
+
* What the person chose on the grant screen — a space, the account. RFC 6749 §5.1 lets a token response carry
|
|
722
|
+
* parameters of its own, and this one is what a client that asked to CHOOSE needs back: without it, a native
|
|
723
|
+
* client granted "work in this space" would hold a credential and not know which space it was for.
|
|
724
|
+
*/
|
|
725
|
+
target: grant.target.value
|
|
726
|
+
};
|
|
727
|
+
if (expiresInSeconds !== void 0) body["expires_in"] = expiresInSeconds;
|
|
728
|
+
if (ttl > 0) {
|
|
729
|
+
const refreshToken = randomId();
|
|
730
|
+
await putRefresh(config.adapters.store, refreshToken, {
|
|
731
|
+
...grant,
|
|
732
|
+
credential
|
|
733
|
+
}, ttl);
|
|
734
|
+
body["refresh_token"] = refreshToken;
|
|
735
|
+
}
|
|
736
|
+
sendJson(res, 200, body);
|
|
737
|
+
};
|
|
738
|
+
var exchangeCode = async (config, res, params) => {
|
|
739
|
+
const code = field(params, "code");
|
|
740
|
+
const record = code ? await getCode(config.adapters.store, code) : void 0;
|
|
741
|
+
if (!record) {
|
|
742
|
+
sendErrorJson(res, 400, "invalid_grant", "The authorization code is unknown or has expired.");
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
await dropCode(config.adapters.store, code);
|
|
746
|
+
if (record.clientId !== field(params, "client_id")) {
|
|
747
|
+
sendErrorJson(res, 400, "invalid_grant", "The authorization code was issued to another client.");
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const redirectUri = optionalField(params, "redirect_uri");
|
|
751
|
+
if (redirectUri !== void 0 && redirectUri !== record.redirectUri) {
|
|
752
|
+
sendErrorJson(res, 400, "invalid_grant", "redirect_uri does not match the authorization request.");
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (!verifyChallenge(field(params, "code_verifier"), record.challenge)) {
|
|
756
|
+
sendErrorJson(res, 400, "invalid_grant", "The PKCE code verifier does not match the challenge.");
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
await sendTokens(config, res, record.token, record.expiresInSeconds, {
|
|
760
|
+
clientId: record.clientId,
|
|
761
|
+
scope: record.scope,
|
|
762
|
+
user: record.user,
|
|
763
|
+
target: record.target
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
var exchangeRefresh = async (config, res, params) => {
|
|
767
|
+
if (refreshTtlOf(config) === 0) {
|
|
768
|
+
sendErrorJson(res, 400, "unsupported_grant_type", "This server issues no refresh tokens.");
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
const refreshToken = field(params, "refresh_token");
|
|
772
|
+
const record = refreshToken ? await getRefresh(config.adapters.store, refreshToken) : void 0;
|
|
773
|
+
if (!record) {
|
|
774
|
+
sendErrorJson(res, 400, "invalid_grant", "The refresh token is unknown or has expired.");
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
await dropRefresh(config.adapters.store, refreshToken);
|
|
778
|
+
if (record.clientId !== field(params, "client_id")) {
|
|
779
|
+
sendErrorJson(res, 400, "invalid_grant", "The refresh token was issued to another client.");
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
const issued = await config.adapters.issueToken(record.user, record.target, await issueContextFor(config, record.clientId, { replaces: record.credential }));
|
|
783
|
+
if (!issued) {
|
|
784
|
+
sendErrorJson(res, 400, "invalid_grant", "The account no longer has access to this resource.");
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
await sendTokens(config, res, issued.token, issued.expiresInSeconds, record);
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* POST /revoke — RFC 7009. Ends a grant, which is what signing out of a native client has to do.
|
|
791
|
+
*
|
|
792
|
+
* Without it, signing out ends the SESSION and leaves the refresh token that can mint another one: the app has
|
|
793
|
+
* deleted its copy, but a leaked one stays good until its TTL. The endpoint answers 200 whatever happens, as the
|
|
794
|
+
* RFC requires — a client cannot be told whether a token it presented was real, and a sign-out that reports a
|
|
795
|
+
* failure is one people ignore.
|
|
796
|
+
*/
|
|
797
|
+
var handleRevoke = async (config, res, params) => {
|
|
798
|
+
const token = optionalField(params, "token");
|
|
799
|
+
if (token) {
|
|
800
|
+
const { store, revokeToken } = config.adapters;
|
|
801
|
+
const refresh = await getRefresh(store, token);
|
|
802
|
+
const access = await getAccess(store, token);
|
|
803
|
+
await dropRefresh(store, token);
|
|
804
|
+
await dropAccess(store, token);
|
|
805
|
+
const credential = refresh?.credential ?? (access ? access.credential ?? token : void 0);
|
|
806
|
+
if (credential && revokeToken) await revokeToken(credential);
|
|
807
|
+
}
|
|
808
|
+
res.setStatus(200);
|
|
809
|
+
res.end();
|
|
810
|
+
};
|
|
811
|
+
/** POST /token. Public clients only, so there is no client authentication to check — PKCE is what proves the
|
|
812
|
+
* caller is the one that started the flow. */
|
|
813
|
+
var handleToken = async (config, res, params) => {
|
|
814
|
+
switch (field(params, "grant_type")) {
|
|
815
|
+
case "authorization_code":
|
|
816
|
+
await exchangeCode(config, res, params);
|
|
817
|
+
return;
|
|
818
|
+
case "refresh_token":
|
|
819
|
+
await exchangeRefresh(config, res, params);
|
|
820
|
+
return;
|
|
821
|
+
default: sendErrorJson(res, 400, "unsupported_grant_type", "Supported grants: authorization_code, refresh_token.");
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
export { dropPending as C, putCode as D, getPending as E, putPending as O, scopesOf as S, getClient as T, REVOKE_PATH as _, handleRegister as a, protectedResourceMetadata as b, redirectWithError as c, randomId as d, verifyChallenge as f, REGISTER_PATH as g, PROTECTED_RESOURCE_PATH as h, handleAuthorizeSubmit as i, sendErrorJson as l, AUTHORIZE_PATH as m, handleToken as n, redirectToSignIn as o, AUTHORIZATION_SERVER_PATH as p, handleAuthorizeStart as r, redirectWithCode as s, handleRevoke as t, sendJson as u, TOKEN_PATH as v, getAccess as w, resourceMetadataUrl as x, authorizationServerMetadata as y };
|