@backstage/plugin-auth-backend 0.12.3 → 0.13.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs.js +6 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.13.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 15d3a3c39a: **BREAKING**: All sign-in resolvers must now return a `token` in their sign-in result. Returning an `id` is no longer supported.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 2cc1d1b235: Applied the fix from version 0.12.3 of this package, which is part of the v1.0.1 release of Backstage.
|
|
12
|
+
- 6ee04078e1: **DEPRECATION**: The `tokenIssuer` option for `OAuthAdapter` is no longer needed and has been deprecated.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/catalog-model@1.0.1-next.0
|
|
15
|
+
- @backstage/plugin-auth-node@0.2.0-next.0
|
|
16
|
+
- @backstage/backend-common@0.13.2-next.0
|
|
17
|
+
- @backstage/catalog-client@1.0.1-next.0
|
|
18
|
+
|
|
3
19
|
## 0.12.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -10,8 +10,8 @@ var errors = require('@backstage/errors');
|
|
|
10
10
|
var pickBy = require('lodash/pickBy');
|
|
11
11
|
var crypto = require('crypto');
|
|
12
12
|
var url = require('url');
|
|
13
|
-
var catalogModel = require('@backstage/catalog-model');
|
|
14
13
|
var jwtDecoder = require('jwt-decode');
|
|
14
|
+
var catalogModel = require('@backstage/catalog-model');
|
|
15
15
|
var fetch = require('node-fetch');
|
|
16
16
|
var NodeCache = require('node-cache');
|
|
17
17
|
var jose = require('jose');
|
|
@@ -255,18 +255,11 @@ function parseJwtPayload(token) {
|
|
|
255
255
|
}
|
|
256
256
|
function prepareBackstageIdentityResponse(result) {
|
|
257
257
|
const { sub, ent } = parseJwtPayload(result.token);
|
|
258
|
-
const userEntityRef = catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(sub, {
|
|
259
|
-
defaultKind: "user",
|
|
260
|
-
defaultNamespace: catalogModel.DEFAULT_NAMESPACE
|
|
261
|
-
}));
|
|
262
258
|
return {
|
|
263
|
-
...
|
|
264
|
-
idToken: result.token,
|
|
265
|
-
...result
|
|
266
|
-
},
|
|
259
|
+
...result,
|
|
267
260
|
identity: {
|
|
268
261
|
type: "user",
|
|
269
|
-
userEntityRef,
|
|
262
|
+
userEntityRef: sub,
|
|
270
263
|
ownershipEntityRefs: ent != null ? ent : []
|
|
271
264
|
}
|
|
272
265
|
};
|
|
@@ -429,17 +422,10 @@ class OAuthAdapter {
|
|
|
429
422
|
if (!identity) {
|
|
430
423
|
return void 0;
|
|
431
424
|
}
|
|
432
|
-
if (identity.token) {
|
|
433
|
-
return
|
|
425
|
+
if (!identity.token) {
|
|
426
|
+
throw new errors.InputError(`Identity response must return a token`);
|
|
434
427
|
}
|
|
435
|
-
|
|
436
|
-
defaultKind: "user",
|
|
437
|
-
defaultNamespace: catalogModel.DEFAULT_NAMESPACE
|
|
438
|
-
}));
|
|
439
|
-
const token = await this.options.tokenIssuer.issueToken({
|
|
440
|
-
claims: { sub: userEntityRef }
|
|
441
|
-
});
|
|
442
|
-
return prepareBackstageIdentityResponse({ ...identity, token });
|
|
428
|
+
return prepareBackstageIdentityResponse(identity);
|
|
443
429
|
}
|
|
444
430
|
}
|
|
445
431
|
|