@backstage/plugin-auth-backend 0.15.1-next.1 → 0.16.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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.16.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fc41ebf07: Removed the previously deprecated class `AtlassianAuthProvider`. Please use `providers.atlassian.create(...)` instead.
8
+ - a291688bc5: Renamed the `RedirectInfo` type to `OAuthStartResponse`
9
+
10
+ ### Patch Changes
11
+
12
+ - d669d89206: Minor API signatures cleanup
13
+ - e1ebaeb332: Cloudflare Access Provider: Add JWT to CloudflareAccessResult
14
+ - Updated dependencies
15
+ - @backstage/plugin-auth-node@0.2.5-next.1
16
+ - @backstage/backend-common@0.15.1-next.1
17
+
18
+ ## 0.15.2-next.0
19
+
20
+ ### Patch Changes
21
+
22
+ - bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
23
+ - Updated dependencies
24
+ - @backstage/backend-common@0.15.1-next.0
25
+ - @backstage/catalog-client@1.0.5-next.0
26
+ - @backstage/plugin-auth-node@0.2.5-next.0
27
+
28
+ ## 0.15.1
29
+
30
+ ### Patch Changes
31
+
32
+ - c676a9e07b: Fixed a bug in auth plugin on the backend where it ignores the skip migration database options when using the database provider.
33
+ - 2d7d6028e1: Updated dependency `@google-cloud/firestore` to `^6.0.0`.
34
+ - Updated dependencies
35
+ - @backstage/backend-common@0.15.0
36
+ - @backstage/plugin-auth-node@0.2.4
37
+
3
38
  ## 0.15.1-next.1
4
39
 
5
40
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -1187,7 +1187,11 @@ class CloudflareAccessAuthProvider {
1187
1187
  const sub = verifyResult.payload.sub;
1188
1188
  const cfAccessResultStr = await ((_a = this.cache) == null ? void 0 : _a.get(`${CACHE_PREFIX}/${sub}`));
1189
1189
  if (typeof cfAccessResultStr === "string") {
1190
- return JSON.parse(cfAccessResultStr);
1190
+ const result = JSON.parse(cfAccessResultStr);
1191
+ return {
1192
+ ...result,
1193
+ token: jwt
1194
+ };
1191
1195
  }
1192
1196
  const claims = verifyResult.payload;
1193
1197
  try {
@@ -1198,7 +1202,10 @@ class CloudflareAccessAuthProvider {
1198
1202
  expiresInSeconds: claims.exp - claims.iat
1199
1203
  };
1200
1204
  (_b = this.cache) == null ? void 0 : _b.set(`${CACHE_PREFIX}/${sub}`, JSON.stringify(cfAccessResult));
1201
- return cfAccessResult;
1205
+ return {
1206
+ ...cfAccessResult,
1207
+ token: jwt
1208
+ };
1202
1209
  } catch (err) {
1203
1210
  throw new errors.ForwardedError(
1204
1211
  "Failed to populate access identity information",
@@ -2790,23 +2797,27 @@ const parseDate = (date) => {
2790
2797
  };
2791
2798
  class DatabaseKeyStore {
2792
2799
  static async create(options) {
2800
+ var _a;
2793
2801
  const { database } = options;
2794
- await database.migrate.latest({
2795
- directory: migrationsDir
2796
- });
2797
- return new DatabaseKeyStore(options);
2802
+ const client = await database.getClient();
2803
+ if (!((_a = database.migrations) == null ? void 0 : _a.skip)) {
2804
+ await client.migrate.latest({
2805
+ directory: migrationsDir
2806
+ });
2807
+ }
2808
+ return new DatabaseKeyStore(client);
2798
2809
  }
2799
- constructor(options) {
2800
- this.database = options.database;
2810
+ constructor(client) {
2811
+ this.client = client;
2801
2812
  }
2802
2813
  async addKey(key) {
2803
- await this.database(TABLE).insert({
2814
+ await this.client(TABLE).insert({
2804
2815
  kid: key.kid,
2805
2816
  key: JSON.stringify(key)
2806
2817
  });
2807
2818
  }
2808
2819
  async listKeys() {
2809
- const rows = await this.database(TABLE).select();
2820
+ const rows = await this.client(TABLE).select();
2810
2821
  return {
2811
2822
  items: rows.map((row) => ({
2812
2823
  key: JSON.parse(row.key),
@@ -2815,7 +2826,7 @@ class DatabaseKeyStore {
2815
2826
  };
2816
2827
  }
2817
2828
  async removeKeys(kids) {
2818
- await this.database(TABLE).delete().whereIn("kid", kids);
2829
+ await this.client(TABLE).delete().whereIn("kid", kids);
2819
2830
  }
2820
2831
  }
2821
2832
 
@@ -2925,9 +2936,7 @@ class KeyStores {
2925
2936
  if (!database) {
2926
2937
  throw new Error("This KeyStore provider requires a database");
2927
2938
  }
2928
- return await DatabaseKeyStore.create({
2929
- database: await database.getClient()
2930
- });
2939
+ return await DatabaseKeyStore.create({ database });
2931
2940
  }
2932
2941
  if (provider === "memory") {
2933
2942
  return new MemoryKeyStore();
@@ -3236,7 +3245,6 @@ function createOriginFilter(config) {
3236
3245
  };
3237
3246
  }
3238
3247
 
3239
- exports.AtlassianAuthProvider = AtlassianAuthProvider;
3240
3248
  exports.CatalogIdentityClient = CatalogIdentityClient;
3241
3249
  exports.OAuthAdapter = OAuthAdapter;
3242
3250
  exports.OAuthEnvironmentHandler = OAuthEnvironmentHandler;