@backstage/plugin-auth-backend 0.0.0-nightly-20220317022557 → 0.0.0-nightly-20220321023210

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 CHANGED
@@ -1,18 +1,31 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
- ## 0.0.0-nightly-20220317022557
3
+ ## 0.0.0-nightly-20220321023210
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
+ - 6ee04078e1: **DEPRECATION**: The `tokenIssuer` option for `OAuthAdapter` is no longer needed and has been deprecated.
12
+ - Updated dependencies
13
+ - @backstage/plugin-auth-node@0.0.0-nightly-20220321023210
14
+ - @backstage/backend-common@0.0.0-nightly-20220321023210
15
+
16
+ ## 0.12.2
4
17
 
5
18
  ### Patch Changes
6
19
 
7
20
  - efc73db10c: Use `better-sqlite3` instead of `@vscode/sqlite3`
8
21
  - Updated dependencies
9
- - @backstage/backend-common@0.0.0-nightly-20220317022557
10
- - @backstage/catalog-model@0.0.0-nightly-20220317022557
11
- - @backstage/catalog-client@0.0.0-nightly-20220317022557
12
- - @backstage/config@0.0.0-nightly-20220317022557
13
- - @backstage/errors@0.0.0-nightly-20220317022557
14
- - @backstage/types@0.0.0-nightly-20220317022557
15
- - @backstage/plugin-auth-node@0.0.0-nightly-20220317022557
22
+ - @backstage/backend-common@0.13.1
23
+ - @backstage/catalog-model@1.0.0
24
+ - @backstage/catalog-client@1.0.0
25
+ - @backstage/config@1.0.0
26
+ - @backstage/errors@1.0.0
27
+ - @backstage/types@1.0.0
28
+ - @backstage/plugin-auth-node@0.1.6
16
29
 
17
30
  ## 0.12.1
18
31
 
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 prepareBackstageIdentityResponse(identity);
425
+ if (!identity.token) {
426
+ throw new errors.InputError(`Identity response must return a token`);
434
427
  }
435
- const userEntityRef = catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(identity.id, {
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