@digipair/skill-keycloak 0.107.6 → 0.108.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.
Files changed (3) hide show
  1. package/index.cjs.js +18 -3
  2. package/index.esm.js +18891 -1083
  3. package/package.json +1 -1
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) || [];