@backstage/backend-defaults 0.5.0-next.1 → 0.5.0-next.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 +27 -0
- package/auth/package.json +1 -1
- package/cache/package.json +1 -1
- package/database/package.json +1 -1
- package/discovery/package.json +1 -1
- package/dist/httpRouter.cjs.js +1 -2
- package/dist/httpRouter.cjs.js.map +1 -1
- package/dist/httpRouter.d.ts +1 -33
- package/dist/urlReader.cjs.js +3 -3
- package/httpAuth/package.json +1 -1
- package/httpRouter/package.json +1 -1
- package/lifecycle/package.json +1 -1
- package/logger/package.json +1 -1
- package/package.json +15 -15
- package/permissions/package.json +1 -1
- package/rootConfig/package.json +1 -1
- package/rootHealth/package.json +1 -1
- package/rootHttpRouter/package.json +1 -1
- package/rootLifecycle/package.json +1 -1
- package/rootLogger/package.json +1 -1
- package/scheduler/package.json +1 -1
- package/urlReader/package.json +1 -1
- package/userInfo/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/backend-defaults
|
|
2
2
|
|
|
3
|
+
## 0.5.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- baeef13: **BREAKING** Removed `createLifecycleMiddleware` and `LifecycleMiddlewareOptions` to clean up API surface. These exports have no external usage and do not provide value in its current form. If you were using these exports, please reach out to the maintainers to discuss your use case.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 6ed9264: chore(deps): bump `path-to-regexp` from 6.2.2 to 8.0.0
|
|
12
|
+
- c2b63ab: Updated dependency `supertest` to `^7.0.0`.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/backend-app-api@1.0.0-next.2
|
|
15
|
+
- @backstage/backend-common@0.25.0-next.2
|
|
16
|
+
- @backstage/plugin-auth-node@0.5.2-next.2
|
|
17
|
+
- @backstage/backend-plugin-api@1.0.0-next.2
|
|
18
|
+
- @backstage/cli-node@0.2.8-next.0
|
|
19
|
+
- @backstage/integration@1.15.0-next.0
|
|
20
|
+
- @backstage/config-loader@1.9.1-next.0
|
|
21
|
+
- @backstage/plugin-permission-node@0.8.3-next.2
|
|
22
|
+
- @backstage/backend-dev-utils@0.1.5
|
|
23
|
+
- @backstage/cli-common@0.1.14
|
|
24
|
+
- @backstage/config@1.2.0
|
|
25
|
+
- @backstage/errors@1.2.4
|
|
26
|
+
- @backstage/integration-aws-node@0.1.12
|
|
27
|
+
- @backstage/types@1.1.1
|
|
28
|
+
- @backstage/plugin-events-node@0.4.0-next.2
|
|
29
|
+
|
|
3
30
|
## 0.5.0-next.1
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/auth/package.json
CHANGED
package/cache/package.json
CHANGED
package/database/package.json
CHANGED
package/discovery/package.json
CHANGED
package/dist/httpRouter.cjs.js
CHANGED
|
@@ -58,7 +58,7 @@ function createPathPolicyPredicate(policyPath) {
|
|
|
58
58
|
if (policyPath === "/" || policyPath === "*") {
|
|
59
59
|
return () => true;
|
|
60
60
|
}
|
|
61
|
-
const pathRegex = pathToRegexp.pathToRegexp(policyPath,
|
|
61
|
+
const { regexp: pathRegex } = pathToRegexp.pathToRegexp(policyPath, {
|
|
62
62
|
end: false
|
|
63
63
|
});
|
|
64
64
|
return (path) => {
|
|
@@ -168,6 +168,5 @@ const httpRouterServiceFactory = backendPluginApi.createServiceFactory({
|
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
exports.createLifecycleMiddleware = createLifecycleMiddleware;
|
|
172
171
|
exports.httpRouterServiceFactory = httpRouterServiceFactory;
|
|
173
172
|
//# sourceMappingURL=httpRouter.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpRouter.cjs.js","sources":["../src/entrypoints/httpRouter/createLifecycleMiddleware.ts","../src/entrypoints/httpRouter/createCredentialsBarrier.ts","../src/entrypoints/httpRouter/createAuthIntegrationRouter.ts","../src/entrypoints/httpRouter/createCookieAuthRefreshMiddleware.ts","../src/entrypoints/httpRouter/httpRouterServiceFactory.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LifecycleService } from '@backstage/backend-plugin-api';\nimport { ServiceUnavailableError } from '@backstage/errors';\nimport { HumanDuration, durationToMilliseconds } from '@backstage/types';\nimport { RequestHandler } from 'express';\n\nexport const DEFAULT_TIMEOUT = { seconds: 5 };\n\n/**\n * Options for {@link createLifecycleMiddleware}.\n * @public\n */\nexport interface LifecycleMiddlewareOptions {\n lifecycle: LifecycleService;\n /**\n * The maximum time that paused requests will wait for the service to start, before returning an error.\n *\n * Defaults to 5 seconds.\n */\n startupRequestPauseTimeout?: HumanDuration;\n}\n\n/**\n * Creates a middleware that pauses requests until the service has started.\n *\n * @remarks\n *\n * Requests that arrive before the service has started will be paused until startup is complete.\n * If the service does not start within the provided timeout, the request will be rejected with a\n * {@link @backstage/errors#ServiceUnavailableError}.\n *\n * If the service is shutting down, all requests will be rejected with a\n * {@link @backstage/errors#ServiceUnavailableError}.\n *\n * @public\n */\nexport function createLifecycleMiddleware(\n options: LifecycleMiddlewareOptions,\n): RequestHandler {\n const { lifecycle, startupRequestPauseTimeout = DEFAULT_TIMEOUT } = options;\n\n let state: 'init' | 'up' | 'down' = 'init';\n const waiting = new Set<{\n next: (err?: Error) => void;\n timeout: NodeJS.Timeout;\n }>();\n\n lifecycle.addStartupHook(async () => {\n if (state === 'init') {\n state = 'up';\n for (const item of waiting) {\n clearTimeout(item.timeout);\n item.next();\n }\n waiting.clear();\n }\n });\n\n lifecycle.addShutdownHook(async () => {\n state = 'down';\n\n for (const item of waiting) {\n clearTimeout(item.timeout);\n item.next(new ServiceUnavailableError('Service is shutting down'));\n }\n waiting.clear();\n });\n\n const timeoutMs = durationToMilliseconds(startupRequestPauseTimeout);\n\n return (_req, _res, next) => {\n if (state === 'up') {\n next();\n return;\n } else if (state === 'down') {\n next(new ServiceUnavailableError('Service is shutting down'));\n return;\n }\n\n const item = {\n next,\n timeout: setTimeout(() => {\n if (waiting.delete(item)) {\n next(new ServiceUnavailableError('Service has not started up yet'));\n }\n }, timeoutMs),\n };\n\n waiting.add(item);\n };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n HttpAuthService,\n HttpRouterServiceAuthPolicy,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { RequestHandler } from 'express';\nimport { pathToRegexp } from 'path-to-regexp';\n\nexport function createPathPolicyPredicate(policyPath: string) {\n if (policyPath === '/' || policyPath === '*') {\n return () => true;\n }\n\n const pathRegex = pathToRegexp(policyPath, undefined, {\n end: false,\n });\n\n return (path: string): boolean => {\n return pathRegex.test(path);\n };\n}\n\nexport function createCredentialsBarrier(options: {\n httpAuth: HttpAuthService;\n config: RootConfigService;\n}): {\n middleware: RequestHandler;\n addAuthPolicy: (policy: HttpRouterServiceAuthPolicy) => void;\n} {\n const { httpAuth, config } = options;\n\n const disableDefaultAuthPolicy = config.getOptionalBoolean(\n 'backend.auth.dangerouslyDisableDefaultAuthPolicy',\n );\n\n if (disableDefaultAuthPolicy) {\n return {\n middleware: (_req, _res, next) => next(),\n addAuthPolicy: () => {},\n };\n }\n\n const unauthenticatedPredicates = new Array<(path: string) => boolean>();\n const cookiePredicates = new Array<(path: string) => boolean>();\n\n const middleware: RequestHandler = (req, _, next) => {\n const allowsUnauthenticated = unauthenticatedPredicates.some(predicate =>\n predicate(req.path),\n );\n\n if (allowsUnauthenticated) {\n next();\n return;\n }\n\n const allowsCookie = cookiePredicates.some(predicate =>\n predicate(req.path),\n );\n\n httpAuth\n .credentials(req, {\n allow: ['user', 'service'],\n allowLimitedAccess: allowsCookie,\n })\n .then(\n () => next(),\n err => next(err),\n );\n };\n\n const addAuthPolicy = (policy: HttpRouterServiceAuthPolicy) => {\n if (policy.allow === 'unauthenticated') {\n unauthenticatedPredicates.push(createPathPolicyPredicate(policy.path));\n } else if (policy.allow === 'user-cookie') {\n cookiePredicates.push(createPathPolicyPredicate(policy.path));\n } else {\n throw new Error('Invalid auth policy');\n }\n };\n\n return { middleware, addAuthPolicy };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport express from 'express';\nimport Router from 'express-promise-router';\n\nexport function createAuthIntegrationRouter(options: {\n auth: AuthService;\n}): express.Router {\n const router = Router();\n\n router.get('/.backstage/auth/v1/jwks.json', async (_req, res) => {\n const { keys } = await options.auth.listPublicServiceKeys();\n\n res.json({ keys });\n });\n\n return router;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthService, HttpAuthService } from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\n\nconst WELL_KNOWN_COOKIE_PATH_V1 = '/.backstage/auth/v1/cookie';\n\n/**\n * @public\n * Creates a middleware that can be used to refresh the cookie for the user.\n */\nexport function createCookieAuthRefreshMiddleware(options: {\n auth: AuthService;\n httpAuth: HttpAuthService;\n}) {\n const { auth, httpAuth } = options;\n const router = Router();\n\n // Endpoint that sets the cookie for the user\n router.get(WELL_KNOWN_COOKIE_PATH_V1, async (_, res) => {\n const { expiresAt } = await httpAuth.issueUserCookie(res);\n res.json({ expiresAt: expiresAt.toISOString() });\n });\n\n // Endpoint that removes the cookie for the user\n router.delete(WELL_KNOWN_COOKIE_PATH_V1, async (_, res) => {\n const credentials = await auth.getNoneCredentials();\n await httpAuth.issueUserCookie(res, { credentials });\n res.status(204).end();\n });\n\n return router;\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Handler } from 'express';\nimport PromiseRouter from 'express-promise-router';\nimport {\n coreServices,\n createServiceFactory,\n HttpRouterServiceAuthPolicy,\n} from '@backstage/backend-plugin-api';\nimport { createLifecycleMiddleware } from './createLifecycleMiddleware';\nimport { createCredentialsBarrier } from './createCredentialsBarrier';\nimport { createAuthIntegrationRouter } from './createAuthIntegrationRouter';\nimport { createCookieAuthRefreshMiddleware } from './createCookieAuthRefreshMiddleware';\n\n/**\n * HTTP route registration for plugins.\n *\n * See {@link @backstage/code-plugin-api#HttpRouterService}\n * and {@link https://backstage.io/docs/backend-system/core-services/http-router | the service docs}\n * for more information.\n *\n * @public\n */\nexport const httpRouterServiceFactory = createServiceFactory({\n service: coreServices.httpRouter,\n initialization: 'always',\n deps: {\n plugin: coreServices.pluginMetadata,\n config: coreServices.rootConfig,\n lifecycle: coreServices.lifecycle,\n rootHttpRouter: coreServices.rootHttpRouter,\n auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n },\n async factory({ auth, httpAuth, config, plugin, rootHttpRouter, lifecycle }) {\n const router = PromiseRouter();\n\n rootHttpRouter.use(`/api/${plugin.getId()}`, router);\n\n const credentialsBarrier = createCredentialsBarrier({\n httpAuth,\n config,\n });\n\n router.use(createAuthIntegrationRouter({ auth }));\n router.use(createLifecycleMiddleware({ lifecycle }));\n router.use(credentialsBarrier.middleware);\n router.use(createCookieAuthRefreshMiddleware({ auth, httpAuth }));\n\n return {\n use(handler: Handler): void {\n router.use(handler);\n },\n addAuthPolicy(policy: HttpRouterServiceAuthPolicy): void {\n credentialsBarrier.addAuthPolicy(policy);\n },\n };\n },\n});\n"],"names":["ServiceUnavailableError","durationToMilliseconds","pathToRegexp","Router","createServiceFactory","coreServices","PromiseRouter"],"mappings":";;;;;;;;;;;;AAqBa,MAAA,eAAA,GAAkB,EAAE,OAAA,EAAS,CAAE,EAAA,CAAA;AA8BrC,SAAS,0BACd,OACgB,EAAA;AAChB,EAAA,MAAM,EAAE,SAAA,EAAW,0BAA6B,GAAA,eAAA,EAAoB,GAAA,OAAA,CAAA;AAEpE,EAAA,IAAI,KAAgC,GAAA,MAAA,CAAA;AACpC,EAAM,MAAA,OAAA,uBAAc,GAGjB,EAAA,CAAA;AAEH,EAAA,SAAA,CAAU,eAAe,YAAY;AACnC,IAAA,IAAI,UAAU,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A,GACzB;AAAA,EACA,MAAM,QAAQ,EAAE,IAAA,EAAM,UAAU,MAAQ,EAAA,MAAA,EAAQ,cAAgB,EAAA,SAAA,EAAa,EAAA;AAC3E,IAAA,MAAM,SAASC,uBAAc,EAAA,CAAA;AAE7B,IAAA,cAAA,CAAe,IAAI,CAAQ,KAAA,EAAA,MAAA,CAAO,KAAM,EAAC,IAAI,MAAM,CAAA,CAAA;AAEnD,IAAA,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,MAClD,QAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAA,CAAO,GAAI,CAAA,2BAAA,CAA4B,EAAE,IAAA,EAAM,CAAC,CAAA,CAAA;AAChD,IAAA,MAAA,CAAO,GAAI,CAAA,yBAAA,CAA0B,EAAE,SAAA,EAAW,CAAC,CAAA,CAAA;AACnD,IAAO,MAAA,CAAA,GAAA,CAAI,mBAAmB,UAAU,CAAA,CAAA;AACxC,IAAA,MAAA,CAAO,IAAI,iCAAkC,CAAA,EAAE,IAAM,EAAA,QAAA,EAAU,CAAC,CAAA,CAAA;AAEhE,IAAO,OAAA;AAAA,MACL,IAAI,OAAwB,EAAA;AAC1B,QAAA,MAAA,CAAO,IAAI,OAAO,CAAA,CAAA;AAAA,OACpB;AAAA,MACA,cAAc,MAA2C,EAAA;AACvD,QAAA,kBAAA,CAAmB,cAAc,MAAM,CAAA,CAAA;AAAA,OACzC;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"httpRouter.cjs.js","sources":["../src/entrypoints/httpRouter/createLifecycleMiddleware.ts","../src/entrypoints/httpRouter/createCredentialsBarrier.ts","../src/entrypoints/httpRouter/createAuthIntegrationRouter.ts","../src/entrypoints/httpRouter/createCookieAuthRefreshMiddleware.ts","../src/entrypoints/httpRouter/httpRouterServiceFactory.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LifecycleService } from '@backstage/backend-plugin-api';\nimport { ServiceUnavailableError } from '@backstage/errors';\nimport { HumanDuration, durationToMilliseconds } from '@backstage/types';\nimport { RequestHandler } from 'express';\n\nexport const DEFAULT_TIMEOUT = { seconds: 5 };\n\n/**\n * Options for {@link createLifecycleMiddleware}.\n * @internal\n */\nexport interface LifecycleMiddlewareOptions {\n lifecycle: LifecycleService;\n /**\n * The maximum time that paused requests will wait for the service to start, before returning an error.\n *\n * Defaults to 5 seconds.\n */\n startupRequestPauseTimeout?: HumanDuration;\n}\n\n/**\n * Creates a middleware that pauses requests until the service has started.\n *\n * @remarks\n *\n * Requests that arrive before the service has started will be paused until startup is complete.\n * If the service does not start within the provided timeout, the request will be rejected with a\n * {@link @backstage/errors#ServiceUnavailableError}.\n *\n * If the service is shutting down, all requests will be rejected with a\n * {@link @backstage/errors#ServiceUnavailableError}.\n *\n * @internal\n */\nexport function createLifecycleMiddleware(\n options: LifecycleMiddlewareOptions,\n): RequestHandler {\n const { lifecycle, startupRequestPauseTimeout = DEFAULT_TIMEOUT } = options;\n\n let state: 'init' | 'up' | 'down' = 'init';\n const waiting = new Set<{\n next: (err?: Error) => void;\n timeout: NodeJS.Timeout;\n }>();\n\n lifecycle.addStartupHook(async () => {\n if (state === 'init') {\n state = 'up';\n for (const item of waiting) {\n clearTimeout(item.timeout);\n item.next();\n }\n waiting.clear();\n }\n });\n\n lifecycle.addShutdownHook(async () => {\n state = 'down';\n\n for (const item of waiting) {\n clearTimeout(item.timeout);\n item.next(new ServiceUnavailableError('Service is shutting down'));\n }\n waiting.clear();\n });\n\n const timeoutMs = durationToMilliseconds(startupRequestPauseTimeout);\n\n return (_req, _res, next) => {\n if (state === 'up') {\n next();\n return;\n } else if (state === 'down') {\n next(new ServiceUnavailableError('Service is shutting down'));\n return;\n }\n\n const item = {\n next,\n timeout: setTimeout(() => {\n if (waiting.delete(item)) {\n next(new ServiceUnavailableError('Service has not started up yet'));\n }\n }, timeoutMs),\n };\n\n waiting.add(item);\n };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n HttpAuthService,\n HttpRouterServiceAuthPolicy,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { RequestHandler } from 'express';\nimport { pathToRegexp } from 'path-to-regexp';\n\nexport function createPathPolicyPredicate(policyPath: string) {\n if (policyPath === '/' || policyPath === '*') {\n return () => true;\n }\n\n const { regexp: pathRegex } = pathToRegexp(policyPath, {\n end: false,\n });\n\n return (path: string): boolean => {\n return pathRegex.test(path);\n };\n}\n\nexport function createCredentialsBarrier(options: {\n httpAuth: HttpAuthService;\n config: RootConfigService;\n}): {\n middleware: RequestHandler;\n addAuthPolicy: (policy: HttpRouterServiceAuthPolicy) => void;\n} {\n const { httpAuth, config } = options;\n\n const disableDefaultAuthPolicy = config.getOptionalBoolean(\n 'backend.auth.dangerouslyDisableDefaultAuthPolicy',\n );\n\n if (disableDefaultAuthPolicy) {\n return {\n middleware: (_req, _res, next) => next(),\n addAuthPolicy: () => {},\n };\n }\n\n const unauthenticatedPredicates = new Array<(path: string) => boolean>();\n const cookiePredicates = new Array<(path: string) => boolean>();\n\n const middleware: RequestHandler = (req, _, next) => {\n const allowsUnauthenticated = unauthenticatedPredicates.some(predicate =>\n predicate(req.path),\n );\n\n if (allowsUnauthenticated) {\n next();\n return;\n }\n\n const allowsCookie = cookiePredicates.some(predicate =>\n predicate(req.path),\n );\n\n httpAuth\n .credentials(req, {\n allow: ['user', 'service'],\n allowLimitedAccess: allowsCookie,\n })\n .then(\n () => next(),\n err => next(err),\n );\n };\n\n const addAuthPolicy = (policy: HttpRouterServiceAuthPolicy) => {\n if (policy.allow === 'unauthenticated') {\n unauthenticatedPredicates.push(createPathPolicyPredicate(policy.path));\n } else if (policy.allow === 'user-cookie') {\n cookiePredicates.push(createPathPolicyPredicate(policy.path));\n } else {\n throw new Error('Invalid auth policy');\n }\n };\n\n return { middleware, addAuthPolicy };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport express from 'express';\nimport Router from 'express-promise-router';\n\nexport function createAuthIntegrationRouter(options: {\n auth: AuthService;\n}): express.Router {\n const router = Router();\n\n router.get('/.backstage/auth/v1/jwks.json', async (_req, res) => {\n const { keys } = await options.auth.listPublicServiceKeys();\n\n res.json({ keys });\n });\n\n return router;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AuthService, HttpAuthService } from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\n\nconst WELL_KNOWN_COOKIE_PATH_V1 = '/.backstage/auth/v1/cookie';\n\n/**\n * @public\n * Creates a middleware that can be used to refresh the cookie for the user.\n */\nexport function createCookieAuthRefreshMiddleware(options: {\n auth: AuthService;\n httpAuth: HttpAuthService;\n}) {\n const { auth, httpAuth } = options;\n const router = Router();\n\n // Endpoint that sets the cookie for the user\n router.get(WELL_KNOWN_COOKIE_PATH_V1, async (_, res) => {\n const { expiresAt } = await httpAuth.issueUserCookie(res);\n res.json({ expiresAt: expiresAt.toISOString() });\n });\n\n // Endpoint that removes the cookie for the user\n router.delete(WELL_KNOWN_COOKIE_PATH_V1, async (_, res) => {\n const credentials = await auth.getNoneCredentials();\n await httpAuth.issueUserCookie(res, { credentials });\n res.status(204).end();\n });\n\n return router;\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Handler } from 'express';\nimport PromiseRouter from 'express-promise-router';\nimport {\n coreServices,\n createServiceFactory,\n HttpRouterServiceAuthPolicy,\n} from '@backstage/backend-plugin-api';\nimport { createLifecycleMiddleware } from './createLifecycleMiddleware';\nimport { createCredentialsBarrier } from './createCredentialsBarrier';\nimport { createAuthIntegrationRouter } from './createAuthIntegrationRouter';\nimport { createCookieAuthRefreshMiddleware } from './createCookieAuthRefreshMiddleware';\n\n/**\n * HTTP route registration for plugins.\n *\n * See {@link @backstage/code-plugin-api#HttpRouterService}\n * and {@link https://backstage.io/docs/backend-system/core-services/http-router | the service docs}\n * for more information.\n *\n * @public\n */\nexport const httpRouterServiceFactory = createServiceFactory({\n service: coreServices.httpRouter,\n initialization: 'always',\n deps: {\n plugin: coreServices.pluginMetadata,\n config: coreServices.rootConfig,\n lifecycle: coreServices.lifecycle,\n rootHttpRouter: coreServices.rootHttpRouter,\n auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n },\n async factory({ auth, httpAuth, config, plugin, rootHttpRouter, lifecycle }) {\n const router = PromiseRouter();\n\n rootHttpRouter.use(`/api/${plugin.getId()}`, router);\n\n const credentialsBarrier = createCredentialsBarrier({\n httpAuth,\n config,\n });\n\n router.use(createAuthIntegrationRouter({ auth }));\n router.use(createLifecycleMiddleware({ lifecycle }));\n router.use(credentialsBarrier.middleware);\n router.use(createCookieAuthRefreshMiddleware({ auth, httpAuth }));\n\n return {\n use(handler: Handler): void {\n router.use(handler);\n },\n addAuthPolicy(policy: HttpRouterServiceAuthPolicy): void {\n credentialsBarrier.addAuthPolicy(policy);\n },\n };\n },\n});\n"],"names":["ServiceUnavailableError","durationToMilliseconds","pathToRegexp","Router","createServiceFactory","coreServices","PromiseRouter"],"mappings":";;;;;;;;;;;;AAqBa,MAAA,eAAA,GAAkB,EAAE,OAAA,EAAS,CAAE,EAAA,CAAA;AA8BrC,SAAS,0BACd,OACgB,EAAA;AAChB,EAAA,MAAM,EAAE,SAAA,EAAW,0BAA6B,GAAA,eAAA,EAAoB,GAAA,OAAA,CAAA;AAEpE,EAAA,IAAI,KAAgC,GAAA,MAAA,CAAA;AACpC,EAAM,MAAA,OAAA,uBAAc,GAGjB,EAAA,CAAA;AAEH,EAAA,SAAA,CAAU,eAAe,YAAY;AACnC,IAAA,IAAI,UAAU,MAAQ,EAAA;AACpB,MAAQ,KAAA,GAAA,IAAA,CAAA;AACR,MAAA,KAAA,MAAW,QAAQ,OAAS,EAAA;AAC1B,QAAA,YAAA,CAAa,KAAK,OAAO,CAAA,CAAA;AACzB,QAAA,IAAA,CAAK,IAAK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A,cAAA,CAAe,IAAI,CAAQ,KAAA,EAAA,MAAA,CAAO,KAAM,EAAC,IAAI,MAAM,CAAA,CAAA;AAEnD,IAAA,MAAM,qBAAqB,wBAAyB,CAAA;AAAA,MAClD,QAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAA,CAAO,GAAI,CAAA,2BAAA,CAA4B,EAAE,IAAA,EAAM,CAAC,CAAA,CAAA;AAChD,IAAA,MAAA,CAAO,GAAI,CAAA,yBAAA,CAA0B,EAAE,SAAA,EAAW,CAAC,CAAA,CAAA;AACnD,IAAO,MAAA,CAAA,GAAA,CAAI,mBAAmB,UAAU,CAAA,CAAA;AACxC,IAAA,MAAA,CAAO,IAAI,iCAAkC,CAAA,EAAE,IAAM,EAAA,QAAA,EAAU,CAAC,CAAA,CAAA;AAEhE,IAAO,OAAA;AAAA,MACL,IAAI,OAAwB,EAAA;AAC1B,QAAA,MAAA,CAAO,IAAI,OAAO,CAAA,CAAA;AAAA,OACpB;AAAA,MACA,cAAc,MAA2C,EAAA;AACvD,QAAA,kBAAA,CAAmB,cAAc,MAAM,CAAA,CAAA;AAAA,OACzC;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAC;;;;"}
|
package/dist/httpRouter.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
-
import { LifecycleService } from '@backstage/backend-plugin-api';
|
|
3
|
-
import { HumanDuration } from '@backstage/types';
|
|
4
|
-
import { RequestHandler } from 'express';
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
4
|
* HTTP route registration for plugins.
|
|
@@ -14,33 +11,4 @@ import { RequestHandler } from 'express';
|
|
|
14
11
|
*/
|
|
15
12
|
declare const httpRouterServiceFactory: _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.HttpRouterService, "plugin", "singleton">;
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
* Options for {@link createLifecycleMiddleware}.
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
interface LifecycleMiddlewareOptions {
|
|
22
|
-
lifecycle: LifecycleService;
|
|
23
|
-
/**
|
|
24
|
-
* The maximum time that paused requests will wait for the service to start, before returning an error.
|
|
25
|
-
*
|
|
26
|
-
* Defaults to 5 seconds.
|
|
27
|
-
*/
|
|
28
|
-
startupRequestPauseTimeout?: HumanDuration;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Creates a middleware that pauses requests until the service has started.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
*
|
|
35
|
-
* Requests that arrive before the service has started will be paused until startup is complete.
|
|
36
|
-
* If the service does not start within the provided timeout, the request will be rejected with a
|
|
37
|
-
* {@link @backstage/errors#ServiceUnavailableError}.
|
|
38
|
-
*
|
|
39
|
-
* If the service is shutting down, all requests will be rejected with a
|
|
40
|
-
* {@link @backstage/errors#ServiceUnavailableError}.
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
declare function createLifecycleMiddleware(options: LifecycleMiddlewareOptions): RequestHandler;
|
|
45
|
-
|
|
46
|
-
export { type LifecycleMiddlewareOptions, createLifecycleMiddleware, httpRouterServiceFactory };
|
|
14
|
+
export { httpRouterServiceFactory };
|
package/dist/urlReader.cjs.js
CHANGED
|
@@ -2296,7 +2296,7 @@ class DefaultReadTreeResponseFactory {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
|
|
2298
2298
|
var name = "@backstage/backend-defaults";
|
|
2299
|
-
var version = "0.5.0-next.
|
|
2299
|
+
var version = "0.5.0-next.2";
|
|
2300
2300
|
var description = "Backend defaults used by Backstage backend apps";
|
|
2301
2301
|
var backstage = {
|
|
2302
2302
|
role: "node-library"
|
|
@@ -2465,7 +2465,7 @@ var dependencies = {
|
|
|
2465
2465
|
"node-fetch": "^2.7.0",
|
|
2466
2466
|
"node-forge": "^1.3.1",
|
|
2467
2467
|
"p-limit": "^3.1.0",
|
|
2468
|
-
"path-to-regexp": "^
|
|
2468
|
+
"path-to-regexp": "^8.0.0",
|
|
2469
2469
|
pg: "^8.11.3",
|
|
2470
2470
|
"pg-connection-string": "^2.3.0",
|
|
2471
2471
|
"pg-format": "^1.0.4",
|
|
@@ -2494,7 +2494,7 @@ var devDependencies = {
|
|
|
2494
2494
|
"aws-sdk-client-mock": "^4.0.0",
|
|
2495
2495
|
"http-errors": "^2.0.0",
|
|
2496
2496
|
msw: "^1.0.0",
|
|
2497
|
-
supertest: "^
|
|
2497
|
+
supertest: "^7.0.0",
|
|
2498
2498
|
"wait-for-expect": "^3.0.2"
|
|
2499
2499
|
};
|
|
2500
2500
|
var configSchema = "config.d.ts";
|
package/httpAuth/package.json
CHANGED
package/httpRouter/package.json
CHANGED
package/lifecycle/package.json
CHANGED
package/logger/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-defaults",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.2",
|
|
4
4
|
"description": "Backend defaults used by Backstage backend apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -150,20 +150,20 @@
|
|
|
150
150
|
"@aws-sdk/client-s3": "^3.350.0",
|
|
151
151
|
"@aws-sdk/credential-providers": "^3.350.0",
|
|
152
152
|
"@aws-sdk/types": "^3.347.0",
|
|
153
|
-
"@backstage/backend-app-api": "^0.
|
|
154
|
-
"@backstage/backend-common": "^0.25.0-next.
|
|
153
|
+
"@backstage/backend-app-api": "^1.0.0-next.2",
|
|
154
|
+
"@backstage/backend-common": "^0.25.0-next.2",
|
|
155
155
|
"@backstage/backend-dev-utils": "^0.1.5",
|
|
156
|
-
"@backstage/backend-plugin-api": "^0.
|
|
156
|
+
"@backstage/backend-plugin-api": "^1.0.0-next.2",
|
|
157
157
|
"@backstage/cli-common": "^0.1.14",
|
|
158
|
-
"@backstage/cli-node": "^0.2.
|
|
158
|
+
"@backstage/cli-node": "^0.2.8-next.0",
|
|
159
159
|
"@backstage/config": "^1.2.0",
|
|
160
|
-
"@backstage/config-loader": "^1.9.0",
|
|
160
|
+
"@backstage/config-loader": "^1.9.1-next.0",
|
|
161
161
|
"@backstage/errors": "^1.2.4",
|
|
162
|
-
"@backstage/integration": "^1.
|
|
162
|
+
"@backstage/integration": "^1.15.0-next.0",
|
|
163
163
|
"@backstage/integration-aws-node": "^0.1.12",
|
|
164
|
-
"@backstage/plugin-auth-node": "^0.5.2-next.
|
|
165
|
-
"@backstage/plugin-events-node": "^0.4.0-next.
|
|
166
|
-
"@backstage/plugin-permission-node": "^0.8.3-next.
|
|
164
|
+
"@backstage/plugin-auth-node": "^0.5.2-next.2",
|
|
165
|
+
"@backstage/plugin-events-node": "^0.4.0-next.2",
|
|
166
|
+
"@backstage/plugin-permission-node": "^0.8.3-next.2",
|
|
167
167
|
"@backstage/types": "^1.1.1",
|
|
168
168
|
"@google-cloud/storage": "^7.0.0",
|
|
169
169
|
"@keyv/memcache": "^1.3.5",
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"node-fetch": "^2.7.0",
|
|
201
201
|
"node-forge": "^1.3.1",
|
|
202
202
|
"p-limit": "^3.1.0",
|
|
203
|
-
"path-to-regexp": "^
|
|
203
|
+
"path-to-regexp": "^8.0.0",
|
|
204
204
|
"pg": "^8.11.3",
|
|
205
205
|
"pg-connection-string": "^2.3.0",
|
|
206
206
|
"pg-format": "^1.0.4",
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
},
|
|
219
219
|
"devDependencies": {
|
|
220
220
|
"@aws-sdk/util-stream-node": "^3.350.0",
|
|
221
|
-
"@backstage/backend-plugin-api": "^0.
|
|
222
|
-
"@backstage/backend-test-utils": "^0.
|
|
223
|
-
"@backstage/cli": "^0.27.1-next.
|
|
221
|
+
"@backstage/backend-plugin-api": "^1.0.0-next.2",
|
|
222
|
+
"@backstage/backend-test-utils": "^1.0.0-next.2",
|
|
223
|
+
"@backstage/cli": "^0.27.1-next.2",
|
|
224
224
|
"@types/http-errors": "^2.0.0",
|
|
225
225
|
"@types/morgan": "^1.9.0",
|
|
226
226
|
"@types/node-forge": "^1.3.0",
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
"aws-sdk-client-mock": "^4.0.0",
|
|
230
230
|
"http-errors": "^2.0.0",
|
|
231
231
|
"msw": "^1.0.0",
|
|
232
|
-
"supertest": "^
|
|
232
|
+
"supertest": "^7.0.0",
|
|
233
233
|
"wait-for-expect": "^3.0.2"
|
|
234
234
|
},
|
|
235
235
|
"configSchema": "config.d.ts"
|
package/permissions/package.json
CHANGED
package/rootConfig/package.json
CHANGED
package/rootHealth/package.json
CHANGED
package/rootLogger/package.json
CHANGED
package/scheduler/package.json
CHANGED
package/urlReader/package.json
CHANGED