@digipair/skill-keycloak 0.107.6 → 0.107.7

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/index.cjs.js CHANGED
@@ -16614,7 +16614,12 @@ let KeycloakService = class KeycloakService {
16614
16614
  };
16615
16615
  }
16616
16616
  if ((typeof ((_pinsSettings_properties1 = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties1['secured']) === 'undefined' || ((_pinsSettings_properties2 = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties2['secured'])) && !context.keycloak.decodedToken) {
16617
- throw new Error('Unauthorized');
16617
+ context.protected.res.status(401);
16618
+ context.protected.res.setHeader('Content-Type', 'application/json');
16619
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
16620
+ return {
16621
+ error: 'Unauthorized'
16622
+ };
16618
16623
  }
16619
16624
  return JSON.stringify(await engine.executePinsList(pinsSettingsList, this.mergeConttext(context.request.body.context, context), `${context.request.body.params.path}.execute`));
16620
16625
  }
@@ -16749,7 +16754,12 @@ let KeycloakService = class KeycloakService {
16749
16754
  };
16750
16755
  }
16751
16756
  if (secured && !context.keycloak.decodedToken) {
16752
- throw new Error('Unauthorized');
16757
+ context.protected.res.status(401);
16758
+ context.protected.res.setHeader('Content-Type', 'application/json');
16759
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
16760
+ return {
16761
+ error: 'Unauthorized'
16762
+ };
16753
16763
  }
16754
16764
  return await engine.executePinsList(execute, context, `${context.__PATH__}.execute`);
16755
16765
  }
@@ -16774,7 +16784,12 @@ let KeycloakService = class KeycloakService {
16774
16784
  };
16775
16785
  }
16776
16786
  if (secured && !context.keycloak.decodedToken) {
16777
- throw new Error('Unauthorized');
16787
+ context.protected.res.status(401);
16788
+ context.protected.res.setHeader('Content-Type', 'application/json');
16789
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
16790
+ return {
16791
+ error: 'Unauthorized'
16792
+ };
16778
16793
  }
16779
16794
  const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
16780
16795
  const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
package/index.esm.js CHANGED
@@ -23907,14 +23907,14 @@ function indent(str, spaces) {
23907
23907
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23908
23908
  // match is required
23909
23909
  if (!match) {
23910
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23910
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23911
23911
  v: nextMatch1
23912
23912
  };
23913
23913
  }
23914
23914
  var token = match.token, offset = match.offset;
23915
23915
  i1 += offset;
23916
23916
  if (token === " ") {
23917
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23917
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23918
23918
  }
23919
23919
  tokens1 = _to_consumable_array$3(tokens1).concat([
23920
23920
  token
@@ -23933,7 +23933,7 @@ function indent(str, spaces) {
23933
23933
  if (contextKeys.some(function(el) {
23934
23934
  return el.startsWith(name);
23935
23935
  })) {
23936
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23936
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23937
23937
  }
23938
23938
  if (dateTimeIdentifiers.some(function(el) {
23939
23939
  return el === name;
@@ -23952,9 +23952,9 @@ function indent(str, spaces) {
23952
23952
  if (dateTimeIdentifiers.some(function(el) {
23953
23953
  return el.startsWith(name);
23954
23954
  })) {
23955
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23955
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23956
23956
  }
23957
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23957
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23958
23958
  v: nextMatch1
23959
23959
  };
23960
23960
  };
@@ -44704,7 +44704,12 @@ let KeycloakService = class KeycloakService {
44704
44704
  };
44705
44705
  }
44706
44706
  if ((typeof ((_pinsSettings_properties1 = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties1['secured']) === 'undefined' || ((_pinsSettings_properties2 = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties2['secured'])) && !context.keycloak.decodedToken) {
44707
- throw new Error('Unauthorized');
44707
+ context.protected.res.status(401);
44708
+ context.protected.res.setHeader('Content-Type', 'application/json');
44709
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
44710
+ return {
44711
+ error: 'Unauthorized'
44712
+ };
44708
44713
  }
44709
44714
  return JSON.stringify(await executePinsList(pinsSettingsList, this.mergeConttext(context.request.body.context, context), `${context.request.body.params.path}.execute`));
44710
44715
  }
@@ -44839,7 +44844,12 @@ let KeycloakService = class KeycloakService {
44839
44844
  };
44840
44845
  }
44841
44846
  if (secured && !context.keycloak.decodedToken) {
44842
- throw new Error('Unauthorized');
44847
+ context.protected.res.status(401);
44848
+ context.protected.res.setHeader('Content-Type', 'application/json');
44849
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
44850
+ return {
44851
+ error: 'Unauthorized'
44852
+ };
44843
44853
  }
44844
44854
  return await executePinsList(execute, context, `${context.__PATH__}.execute`);
44845
44855
  }
@@ -44864,7 +44874,12 @@ let KeycloakService = class KeycloakService {
44864
44874
  };
44865
44875
  }
44866
44876
  if (secured && !context.keycloak.decodedToken) {
44867
- throw new Error('Unauthorized');
44877
+ context.protected.res.status(401);
44878
+ context.protected.res.setHeader('Content-Type', 'application/json');
44879
+ context.protected.res.setHeader('WWW-Authenticate', `Bearer realm="${realm}"`);
44880
+ return {
44881
+ error: 'Unauthorized'
44882
+ };
44868
44883
  }
44869
44884
  const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
44870
44885
  const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.107.6",
3
+ "version": "0.107.7",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",