@nsshunt/stsoauth2plugin 1.0.61 → 1.0.63

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.
@@ -36,6 +36,7 @@ var __privateMethod = (obj, member, method) => {
36
36
  };
37
37
  var _crypto, _router, _cUtils, _qParams, _STORAGE_AUTHORIZE_OPTIONS_KEY, _STORAGE_SESSION_KEY, _aic, _options, _messages, _oauth2ManagerPort, _messageId, _messageHandlers, _messageTimeout, _worker, _transactionStore, _operationSemaphore, _maxSemaphoreRetries, _semaphoreRetrySleep, _ProcessMessageResponse, _PostMessage, _HandleLogEvent, _HandleUpdateInstrumentEvent, _GetStore, _HandleErrorEvent, _HandleAuthenticateEvent, _SetupRoute, _clientSessionStore, _cUtils2, _qParams2, _STORAGE_SESSION_KEY2, _oauthWorkerPort, _options2, _httpsAgent, _logger, _LogDebugMessage, LogDebugMessage_fn, _LogInfoMessage, LogInfoMessage_fn, _LogErrorMessage, LogErrorMessage_fn, _HandleAuthenticateEvent2, _HandleErrorEvent2, _LogMessage, _GetAccessToken, _GetCookies, _UpdateInstrument, _ProcessCommand, _RestoreSession, _Authorize, _HandleRedirect, _GetTokenFromBroker, _GetToken, _RefreshToken, _Logout;
38
38
  import { inject } from "vue";
39
+ import Debug from "debug";
39
40
  import * as wt from "node:worker_threads";
40
41
  import { OAuth2ParameterType, Sleep } from "@nsshunt/stsutils";
41
42
  import { ClientStorageFactory, ClientStorageType } from "@nsshunt/stsvueutils";
@@ -2535,9 +2536,12 @@ const STSOauth2Store = defineStore("__sts__STSOauth2Store", {
2535
2536
  }
2536
2537
  */
2537
2538
  });
2538
- const debug = (message) => {
2539
- console.log(message);
2540
- };
2539
+ let debug;
2540
+ if (isNode) {
2541
+ debug = Debug(`proc:${process.pid}:stsoauth2manager.ts`);
2542
+ } else {
2543
+ debug = Debug(`proc:0:stsoauth2manager.ts`);
2544
+ }
2541
2545
  class STSOAuth2Manager {
2542
2546
  // ms
2543
2547
  constructor(app, options) {
@@ -2634,7 +2638,7 @@ class STSOAuth2Manager {
2634
2638
  message: error
2635
2639
  });
2636
2640
  setTimeout(() => {
2637
- __privateGet(this, _router).replace("/error");
2641
+ __privateGet(this, _router).replace(`${__privateGet(this, _options).uriBase}error`);
2638
2642
  }, 0);
2639
2643
  }
2640
2644
  });
@@ -2655,29 +2659,29 @@ class STSOAuth2Manager {
2655
2659
  debug(chalk$1.gray(`beforeEach: from: [${from.path}], to: [${to.path}]`));
2656
2660
  if (__privateGet(this, _GetStore).call(this).LoggedIn === false) {
2657
2661
  console.log(`Not logged in`);
2658
- if (to.path.localeCompare("/authorize") === 0) {
2659
- console.log(`to = /authorize`);
2662
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}authorize`) === 0) {
2663
+ console.log(`to = ${__privateGet(this, _options).uriBase}authorize`);
2660
2664
  next();
2661
2665
  return;
2662
- } else if (to.path.localeCompare("/consent") === 0) {
2666
+ } else if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}consent`) === 0) {
2663
2667
  if (__privateGet(this, _GetStore).call(this).id_token) {
2664
2668
  next();
2665
2669
  return;
2666
2670
  }
2667
2671
  }
2668
- if (to.path.localeCompare("/logout") === 0) {
2672
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}logout`) === 0) {
2669
2673
  next();
2670
2674
  return;
2671
2675
  }
2672
- if (to.path.localeCompare("/error") === 0) {
2676
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}error`) === 0) {
2673
2677
  next();
2674
2678
  return;
2675
2679
  }
2676
- if (to.path.localeCompare("/config") === 0) {
2680
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}config`) === 0) {
2677
2681
  next();
2678
2682
  return;
2679
2683
  }
2680
- if (to.path.localeCompare("/redirected") === 0) {
2684
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}redirected`) === 0) {
2681
2685
  next();
2682
2686
  return;
2683
2687
  }
@@ -2688,13 +2692,13 @@ class STSOAuth2Manager {
2688
2692
  debug(chalk$1.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
2689
2693
  if (retVal) {
2690
2694
  next({
2691
- path: "/",
2695
+ path: `${__privateGet(this, _options).uriBase}`,
2692
2696
  replace: true
2693
2697
  });
2694
2698
  return;
2695
2699
  } else {
2696
2700
  next({
2697
- path: "/error",
2701
+ path: `${__privateGet(this, _options).uriBase}error`,
2698
2702
  replace: true
2699
2703
  });
2700
2704
  return;
@@ -2709,20 +2713,20 @@ class STSOAuth2Manager {
2709
2713
  next();
2710
2714
  return;
2711
2715
  } else {
2712
- next("/");
2716
+ next(`${__privateGet(this, _options).uriBase}`);
2713
2717
  return;
2714
2718
  }
2715
2719
  } else {
2716
- if (to.path.localeCompare("/consent") === 0) {
2717
- next("/");
2720
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}consent`) === 0) {
2721
+ next(`${__privateGet(this, _options).uriBase}`);
2718
2722
  return;
2719
2723
  }
2720
- if (to.path.localeCompare("/authorize") === 0) {
2721
- next("/");
2724
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}authorize`) === 0) {
2725
+ next(`${__privateGet(this, _options).uriBase}`);
2722
2726
  return;
2723
2727
  }
2724
- if (to.path.localeCompare("/logout") === 0) {
2725
- next("/");
2728
+ if (to.path.localeCompare(`${__privateGet(this, _options).uriBase}logout`) === 0) {
2729
+ next(`${__privateGet(this, _options).uriBase}`);
2726
2730
  return;
2727
2731
  }
2728
2732
  next();
@@ -2891,17 +2895,6 @@ class STSOAuth2Manager {
2891
2895
  __privateGet(this, _SetupRoute).call(this, app, __privateGet(this, _router));
2892
2896
  }
2893
2897
  }
2894
- /*
2895
- GetIDToken = async (): Promise<string> => {
2896
- try {
2897
- const response: IOauth2ListenerMessageResponse = await this.#PostMessage({ command: IOauth2ListenerCommand.ID_TOKEN });
2898
- return response.payload;
2899
- } catch (error) {
2900
- console.log(chalk.red(`Logout Error: ${error}`));
2901
- return null;
2902
- }
2903
- }
2904
- */
2905
2898
  }
2906
2899
  _router = new WeakMap();
2907
2900
  _cUtils = new WeakMap();