@backstage/plugin-scaffolder-backend 1.4.0-next.0 → 1.4.0-next.1
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 +13 -0
- package/dist/index.cjs.js +20 -8
- package/dist/index.cjs.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.4.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 801d606909: Improve error messaging when passing in malformed auth
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/catalog-model@1.1.0-next.1
|
|
10
|
+
- @backstage/backend-common@0.14.1-next.1
|
|
11
|
+
- @backstage/errors@1.1.0-next.0
|
|
12
|
+
- @backstage/plugin-catalog-backend@1.2.1-next.1
|
|
13
|
+
- @backstage/catalog-client@1.0.4-next.1
|
|
14
|
+
- @backstage/integration@1.2.2-next.1
|
|
15
|
+
|
|
3
16
|
## 1.4.0-next.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -3898,15 +3898,27 @@ data: ${JSON.stringify(event)}
|
|
|
3898
3898
|
}
|
|
3899
3899
|
function parseBearerToken(header) {
|
|
3900
3900
|
var _a;
|
|
3901
|
-
|
|
3902
|
-
if (!token)
|
|
3901
|
+
if (!header) {
|
|
3903
3902
|
return {};
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3903
|
+
}
|
|
3904
|
+
try {
|
|
3905
|
+
const token = (_a = header.match(/^Bearer\s(\S+\.\S+\.\S+)$/i)) == null ? void 0 : _a[1];
|
|
3906
|
+
if (!token) {
|
|
3907
|
+
throw new TypeError("Expected Bearer with JWT");
|
|
3908
|
+
}
|
|
3909
|
+
const [_header, rawPayload, _signature] = token.split(".");
|
|
3910
|
+
const payload = JSON.parse(Buffer.from(rawPayload, "base64").toString());
|
|
3911
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
3912
|
+
throw new TypeError("Malformed JWT payload");
|
|
3913
|
+
}
|
|
3914
|
+
const sub = payload.sub;
|
|
3915
|
+
if (typeof sub !== "string") {
|
|
3916
|
+
throw new TypeError("Expected string sub claim");
|
|
3917
|
+
}
|
|
3918
|
+
return { entityRef: sub, token };
|
|
3919
|
+
} catch (e) {
|
|
3920
|
+
throw new errors.InputError(`Invalid authorization header: ${errors.stringifyError(e)}`);
|
|
3921
|
+
}
|
|
3910
3922
|
}
|
|
3911
3923
|
|
|
3912
3924
|
class ScaffolderEntitiesProcessor {
|