@backstage/plugin-auth-backend 0.14.0 → 0.14.1-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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.14.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - f6aae90e4e: Added configurable algorithm field for TokenFactory
8
+ - Updated dependencies
9
+ - @backstage/backend-common@0.13.6-next.0
10
+ - @backstage/plugin-auth-node@0.2.2-next.0
11
+
3
12
  ## 0.14.0
4
13
 
5
14
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -26,9 +26,9 @@ var passportOneloginOauth = require('passport-onelogin-oauth');
26
26
  var passportSaml = require('passport-saml');
27
27
  var googleAuthLibrary = require('google-auth-library');
28
28
  var catalogClient = require('@backstage/catalog-client');
29
- var uuid = require('uuid');
30
- var luxon = require('luxon');
31
29
  var catalogModel = require('@backstage/catalog-model');
30
+ var luxon = require('luxon');
31
+ var uuid = require('uuid');
32
32
  var backendCommon = require('@backstage/backend-common');
33
33
  var firestore = require('@google-cloud/firestore');
34
34
  var lodash = require('lodash');
@@ -2300,10 +2300,12 @@ function createOidcRouter(options) {
2300
2300
  const MS_IN_S = 1e3;
2301
2301
  class TokenFactory {
2302
2302
  constructor(options) {
2303
+ var _a;
2303
2304
  this.issuer = options.issuer;
2304
2305
  this.logger = options.logger;
2305
2306
  this.keyStore = options.keyStore;
2306
2307
  this.keyDurationSeconds = options.keyDurationSeconds;
2308
+ this.algorithm = (_a = options.algorithm) != null ? _a : "ES256";
2307
2309
  }
2308
2310
  async issueToken(params) {
2309
2311
  const key = await this.getKey();
@@ -2359,11 +2361,11 @@ class TokenFactory {
2359
2361
  seconds: this.keyDurationSeconds
2360
2362
  }).toJSDate();
2361
2363
  const promise = (async () => {
2362
- const key = await jose.generateKeyPair("ES256");
2364
+ const key = await jose.generateKeyPair(this.algorithm);
2363
2365
  const publicKey = await jose.exportJWK(key.publicKey);
2364
2366
  const privateKey = await jose.exportJWK(key.privateKey);
2365
2367
  publicKey.kid = privateKey.kid = uuid.v4();
2366
- publicKey.alg = privateKey.alg = "ES256";
2368
+ publicKey.alg = privateKey.alg = this.algorithm;
2367
2369
  this.logger.info(`Created new signing key ${publicKey.kid}`);
2368
2370
  await this.keyStore.addKey(publicKey);
2369
2371
  return privateKey;