@asgardeo/auth-spa 0.4.10 → 1.0.1

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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/asgardeo-spa.production.esm.js +104 -117
  3. package/dist/asgardeo-spa.production.esm.js.map +1 -1
  4. package/dist/asgardeo-spa.production.js +98 -111
  5. package/dist/asgardeo-spa.production.js.map +1 -1
  6. package/dist/asgardeo-spa.production.min.js +1 -1
  7. package/dist/asgardeo-spa.production.min.js.map +1 -1
  8. package/dist/polyfilled/asgardeo-spa.production.esm.js +128 -141
  9. package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
  10. package/dist/polyfilled/asgardeo-spa.production.js +128 -141
  11. package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
  12. package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
  13. package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
  14. package/dist/src/client.d.ts +16 -4
  15. package/dist/src/client.d.ts.map +1 -1
  16. package/dist/src/client.js +28 -8
  17. package/dist/src/client.js.map +1 -1
  18. package/dist/src/clients/main-thread-client.d.ts +1 -1
  19. package/dist/src/clients/main-thread-client.d.ts.map +1 -1
  20. package/dist/src/clients/main-thread-client.js +13 -4
  21. package/dist/src/clients/main-thread-client.js.map +1 -1
  22. package/dist/src/clients/web-worker-client.d.ts +1 -1
  23. package/dist/src/clients/web-worker-client.d.ts.map +1 -1
  24. package/dist/src/clients/web-worker-client.js +6 -6
  25. package/dist/src/clients/web-worker-client.js.map +1 -1
  26. package/dist/src/helpers/authentication-helper.d.ts +1 -0
  27. package/dist/src/helpers/authentication-helper.d.ts.map +1 -1
  28. package/dist/src/helpers/authentication-helper.js +2 -1
  29. package/dist/src/helpers/authentication-helper.js.map +1 -1
  30. package/dist/src/models/client.d.ts +1 -0
  31. package/dist/src/models/client.d.ts.map +1 -1
  32. package/dist/src/utils/spa-utils.d.ts +2 -2
  33. package/dist/src/utils/spa-utils.d.ts.map +1 -1
  34. package/dist/src/utils/spa-utils.js +4 -4
  35. package/dist/src/utils/spa-utils.js.map +1 -1
  36. package/dist/src/worker/worker-core.d.ts.map +1 -1
  37. package/dist/src/worker/worker-core.js +2 -2
  38. package/dist/src/worker/worker-core.js.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +2 -2
  41. package/src/client.ts +40 -12
  42. package/src/clients/main-thread-client.ts +19 -5
  43. package/src/clients/web-worker-client.ts +6 -5
  44. package/src/helpers/authentication-helper.ts +4 -1
  45. package/src/models/client.ts +1 -0
  46. package/src/utils/spa-utils.ts +4 -4
  47. package/src/worker/worker-core.ts +4 -3
@@ -61,6 +61,7 @@ export class AuthenticationHelper<
61
61
  protected _authenticationClient: AsgardeoAuthClient<T>;
62
62
  protected _dataLayer: DataLayer<T>;
63
63
  protected _spaHelper: SPAHelper<T>;
64
+ protected _instanceID: number;
64
65
 
65
66
  public constructor(
66
67
  authClient: AsgardeoAuthClient<T>,
@@ -69,6 +70,7 @@ export class AuthenticationHelper<
69
70
  this._authenticationClient = authClient;
70
71
  this._dataLayer = this._authenticationClient.getDataLayer();
71
72
  this._spaHelper = spaHelper;
73
+ this._instanceID = this._authenticationClient.getInstanceID();
72
74
  }
73
75
 
74
76
  public enableHttpHandler(httpClient: HttpClientInstance): void {
@@ -440,7 +442,8 @@ export class AuthenticationHelper<
440
442
  SPAUtils.setSignOutURL(await _authenticationClient.getSignOutURL());
441
443
  } */
442
444
  if (config.storage !== Storage.WebWorker) {
443
- SPAUtils.setSignOutURL(await this._authenticationClient.getSignOutURL());
445
+ SPAUtils.setSignOutURL(
446
+ await this._authenticationClient.getSignOutURL(), config.clientID, this._instanceID);
444
447
 
445
448
  if (this._spaHelper) {
446
449
  this._spaHelper.clearRefreshTokenTimeout();
@@ -66,6 +66,7 @@ export interface MainThreadClientInterface {
66
66
  isAuthenticated(): Promise<boolean>;
67
67
  updateConfig(config: Partial<AuthClientConfig<MainThreadClientConfig>>): Promise<void>;
68
68
  trySignInSilently(): Promise<BasicUserInfo | boolean>;
69
+ isSessionActive(): Promise<boolean>;
69
70
  }
70
71
 
71
72
  export interface WebWorkerClientInterface {
@@ -45,12 +45,12 @@ export class SPAUtils {
45
45
  sessionStorage.setItem(pkceKey, pkce);
46
46
  }
47
47
 
48
- public static setSignOutURL(url: string): void {
49
- sessionStorage.setItem(SIGN_OUT_URL, url);
48
+ public static setSignOutURL(url: string, clientID: string, instanceID: number): void {
49
+ sessionStorage.setItem(`${SIGN_OUT_URL}-instance_${ instanceID }-${ clientID }`, url);
50
50
  }
51
51
 
52
- public static getSignOutURL(): string {
53
- return sessionStorage.getItem(SIGN_OUT_URL) ?? "";
52
+ public static getSignOutURL(clientID: string, instanceID: number): string {
53
+ return sessionStorage.getItem(`${SIGN_OUT_URL}-instance_${ instanceID }-${ clientID }`) ?? "";
54
54
  }
55
55
 
56
56
  public static removePKCE(pkceKey: string): void {
@@ -28,6 +28,7 @@ import {
28
28
  OIDCEndpoints,
29
29
  SESSION_STATE,
30
30
  STATE,
31
+ SessionData,
31
32
  Store
32
33
  } from "@asgardeo/auth-js";
33
34
  import { AuthenticationHelper, SPAHelper } from "../helpers";
@@ -51,8 +52,8 @@ export const WebWorkerCore = async (
51
52
  ): Promise<WebWorkerCoreInterface> => {
52
53
  const _store: Store = new MemoryStore();
53
54
  const _cryptoUtils: SPACryptoUtils = new SPACryptoUtils();
54
- const _authenticationClient = new AsgardeoAuthClient<WebWorkerClientConfig>(_store, _cryptoUtils);
55
- await _authenticationClient.initialize(config);
55
+ const _authenticationClient = new AsgardeoAuthClient<WebWorkerClientConfig>();
56
+ await _authenticationClient.initialize(config, _store, _cryptoUtils);
56
57
 
57
58
  const _spaHelper = new SPAHelper<WebWorkerClientConfig>(_authenticationClient);
58
59
 
@@ -207,7 +208,7 @@ export const WebWorkerCore = async (
207
208
  };
208
209
 
209
210
  const setSessionState = async (sessionState: string): Promise<void> => {
210
- await _dataLayer.setSessionDataParameter(SESSION_STATE, sessionState);
211
+ await _dataLayer.setSessionDataParameter(SESSION_STATE as keyof SessionData, sessionState);
211
212
 
212
213
  return;
213
214
  };