@backstage/plugin-auth-backend 0.7.0-next.0 → 0.7.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6e92ee6267: Add new authentication provider to support the oauth2-proxy.
8
+
9
+ **BREAKING** The `AuthHandler` requires now an `AuthResolverContext` parameter. This aligns with the
10
+ behavior of the `SignInResolver`.
11
+
12
+ - f8496730ab: Switched the handling of the `BackstageIdentityResponse` so that the returned `identity.userEntityRef` is always a full entity reference. If `userEntityRef` was previously set to `jane`, it will now be `user:default/jane`. The `userEntityRef` in the response is parsed from the `sub` claim in the payload of the Backstage token.
13
+ - a53d7d8143: Update provider subs to return full entity ref.
14
+
15
+ ### Patch Changes
16
+
17
+ - f815b7e4a4: build(deps): bump `@google-cloud/firestore` from 4.15.1 to 5.0.2
18
+ - Updated dependencies
19
+ - @backstage/backend-common@0.10.4
20
+ - @backstage/config@0.1.13
21
+ - @backstage/catalog-model@0.9.10
22
+ - @backstage/catalog-client@0.5.5
23
+
3
24
  ## 0.7.0-next.0
4
25
 
5
26
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -245,6 +245,10 @@ function parseJwtPayload(token) {
245
245
  }
246
246
  function prepareBackstageIdentityResponse(result) {
247
247
  const { sub, ent } = parseJwtPayload(result.token);
248
+ const userEntityRef = catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(sub, {
249
+ defaultKind: "user",
250
+ defaultNamespace: catalogModel.ENTITY_DEFAULT_NAMESPACE
251
+ }));
248
252
  return {
249
253
  ...{
250
254
  idToken: result.token,
@@ -252,7 +256,7 @@ function prepareBackstageIdentityResponse(result) {
252
256
  },
253
257
  identity: {
254
258
  type: "user",
255
- userEntityRef: sub,
259
+ userEntityRef,
256
260
  ownershipEntityRefs: ent != null ? ent : []
257
261
  }
258
262
  };
@@ -1211,7 +1215,10 @@ const githubDefaultSignInResolver = async (info, ctx) => {
1211
1215
  const { fullProfile } = info.result;
1212
1216
  const userId = fullProfile.username || fullProfile.id;
1213
1217
  const token = await ctx.tokenIssuer.issueToken({
1214
- claims: { sub: userId, ent: [`user:default/${userId}`] }
1218
+ claims: {
1219
+ sub: `user:default/${userId}`,
1220
+ ent: [`user:default/${userId}`]
1221
+ }
1215
1222
  });
1216
1223
  return { id: userId, token };
1217
1224
  };
@@ -1278,7 +1285,7 @@ const gitlabDefaultSignInResolver = async (info, ctx) => {
1278
1285
  id = profile.email.split("@")[0];
1279
1286
  }
1280
1287
  const token = await ctx.tokenIssuer.issueToken({
1281
- claims: { sub: id, ent: [`user:default/${id}`] }
1288
+ claims: { sub: `user:default/${id}`, ent: [`user:default/${id}`] }
1282
1289
  });
1283
1290
  return { id, token };
1284
1291
  };
@@ -1662,7 +1669,10 @@ const microsoftDefaultSignInResolver = async (info, ctx) => {
1662
1669
  }
1663
1670
  const userId = profile.email.split("@")[0];
1664
1671
  const token = await ctx.tokenIssuer.issueToken({
1665
- claims: { sub: userId, ent: [`user:default/${userId}`] }
1672
+ claims: {
1673
+ sub: `user:default/${userId}`,
1674
+ ent: [`user:default/${userId}`]
1675
+ }
1666
1676
  });
1667
1677
  return { id: userId, token };
1668
1678
  };
@@ -1807,7 +1817,7 @@ const oAuth2DefaultSignInResolver$1 = async (info, ctx) => {
1807
1817
  }
1808
1818
  const userId = profile.email.split("@")[0];
1809
1819
  const token = await ctx.tokenIssuer.issueToken({
1810
- claims: { sub: userId, ent: [`user:default/${userId}`] }
1820
+ claims: { sub: `user:default/${userId}`, ent: [`user:default/${userId}`] }
1811
1821
  });
1812
1822
  return { id: userId, token };
1813
1823
  };
@@ -2545,7 +2555,7 @@ const oktaDefaultSignInResolver = async (info, ctx) => {
2545
2555
  }
2546
2556
  const userId = profile.email.split("@")[0];
2547
2557
  const token = await ctx.tokenIssuer.issueToken({
2548
- claims: { sub: userId, ent: [`user:default/${userId}`] }
2558
+ claims: { sub: `user:default/${userId}`, ent: [`user:default/${userId}`] }
2549
2559
  });
2550
2560
  return { id: userId, token };
2551
2561
  };