@adobe/helix-config 4.3.3 → 4.4.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,3 +1,10 @@
1
+ # [4.4.0](https://github.com/adobe/helix-config/compare/v4.3.3...v4.4.0) (2024-09-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * provide transient site token ([#180](https://github.com/adobe/helix-config/issues/180)) ([ca8161b](https://github.com/adobe/helix-config/commit/ca8161be26f1476af5f2b7c3c3894ae80546dbf7))
7
+
1
8
  ## [4.3.3](https://github.com/adobe/helix-config/compare/v4.3.2...v4.3.3) (2024-09-03)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "4.3.3",
3
+ "version": "4.4.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -302,6 +302,12 @@ export async function loadOrgConfig(ctx, org) {
302
302
  return res.body ? res.json() : null;
303
303
  }
304
304
 
305
+ export async function loadTransientSiteToken(ctx, org, site) {
306
+ const key = `orgs/${org}/sites/${site}/transient-site-tokens.json`;
307
+ const res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
308
+ return res.body ? res.json() : null;
309
+ }
310
+
305
311
  /**
306
312
  * Computes the access.admin.role arrays for the org users.
307
313
  * @param adminConfig
@@ -431,6 +437,13 @@ export async function getConfigResponse(ctx, opts) {
431
437
  if (opts.scope === SCOPE_ADMIN || opts.scope === SCOPE_RAW) {
432
438
  // eslint-disable-next-line max-len
433
439
  config.access.admin = computeSiteAdminRoles(admin, config.groups, orgConfig?.groups, orgConfig?.users);
440
+ } else {
441
+ // for pipeline and delivery, also load the site tokens
442
+ const tst = await loadTransientSiteToken(ctx, rso.org, rso.site);
443
+ if (tst) {
444
+ config.access.preview.transientSiteToken = tst.tokens.preview;
445
+ config.access.live.transientSiteToken = tst.tokens.live;
446
+ }
434
447
  }
435
448
  }
436
449
 
@@ -454,9 +467,11 @@ export async function getConfigResponse(ctx, opts) {
454
467
  'x-hlx-owner': config.code.owner,
455
468
  'x-hlx-repo': config.code.repo,
456
469
  'x-hlx-auth-clientdn-preview': canonicalArrayString(config.access, 'preview', 'clientCertDN'),
457
- 'x-hlx-auth-hash-preview': canonicalArrayString(config.access, 'preview', 'tokenHash'),
458
470
  'x-hlx-auth-clientdn-live': canonicalArrayString(config.access, 'live', 'clientCertDN'),
471
+ 'x-hlx-auth-hash-preview': canonicalArrayString(config.access, 'preview', 'tokenHash'),
459
472
  'x-hlx-auth-hash-live': canonicalArrayString(config.access, 'live', 'tokenHash'),
473
+ 'x-hlx-auth-tst-preview': config.access?.preview?.transientSiteToken?.value || '',
474
+ 'x-hlx-auth-tst-live': config.access?.live?.transientSiteToken?.value || '',
460
475
  },
461
476
  });
462
477
  }