@asgardeo/auth-spa 0.4.3 → 0.4.6

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 (39) hide show
  1. package/README.md +26 -3
  2. package/dist/asgardeo-spa.production.esm.js +10 -10
  3. package/dist/asgardeo-spa.production.esm.js.map +1 -1
  4. package/dist/asgardeo-spa.production.js +4 -4
  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 +40 -40
  9. package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
  10. package/dist/polyfilled/asgardeo-spa.production.js +40 -40
  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.map +1 -1
  15. package/dist/src/client.js +2 -2
  16. package/dist/src/client.js.map +1 -1
  17. package/dist/src/clients/main-thread-client.d.ts.map +1 -1
  18. package/dist/src/clients/main-thread-client.js +9 -8
  19. package/dist/src/clients/main-thread-client.js.map +1 -1
  20. package/dist/src/helpers/authentication-helper.js +5 -5
  21. package/dist/src/helpers/authentication-helper.js.map +1 -1
  22. package/dist/src/helpers/session-management-helper.d.ts.map +1 -1
  23. package/dist/src/helpers/session-management-helper.js +6 -2
  24. package/dist/src/helpers/session-management-helper.js.map +1 -1
  25. package/dist/src/helpers/spa-helper.d.ts +4 -3
  26. package/dist/src/helpers/spa-helper.d.ts.map +1 -1
  27. package/dist/src/helpers/spa-helper.js +17 -5
  28. package/dist/src/helpers/spa-helper.js.map +1 -1
  29. package/dist/src/worker/worker-core.d.ts.map +1 -1
  30. package/dist/src/worker/worker-core.js +6 -5
  31. package/dist/src/worker/worker-core.js.map +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/src/client.ts +14 -2
  35. package/src/clients/main-thread-client.ts +19 -16
  36. package/src/helpers/authentication-helper.ts +5 -5
  37. package/src/helpers/session-management-helper.ts +6 -2
  38. package/src/helpers/spa-helper.ts +24 -6
  39. package/src/worker/worker-core.ts +8 -6
package/README.md CHANGED
@@ -15,6 +15,7 @@
15
15
  - [Getting Started](#getting-started)
16
16
  - [Using an Embedded Script](#using-an-embedded-script)
17
17
  - [Using a Module](#using-a-module)
18
+ - [Configuring Single Logout](#configuring-single-logout)
18
19
  - [Try Out the Sample Apps](#try-out-the-sample-apps)
19
20
  - [Browser Compatibility](#browser-compatibility)
20
21
  - [APIs](#apis)
@@ -141,6 +142,19 @@ auth.on("sign-in", (response) => {
141
142
 
142
143
  [Learn more](#apis).
143
144
 
145
+ ### Configuring Single Logout
146
+
147
+ Asgardeo allows the developers to add single logout capabilities to their applications. To configure single logout:
148
+
149
+ 1. Include following configs when initializing the `AsgardeoSPAClient` instance.
150
+ 1. Set `enableOIDCSessionManagement` flag to `true` in order to enable single logout.
151
+ 2. Adjust the `checkSessionInterval` value as needed to override the default interval. See [AuthClientConfig](#AuthClientConfigConfig) for more details.
152
+ 2. Ensure [signIn( )](#signin) method is called with `{callOnlyOnRedirect: true}` when `signInRedirectURL` is loaded.
153
+
154
+ ```typescript
155
+ auth.signIn({callOnlyOnRedirect: true});
156
+ ```
157
+
144
158
  ## Try Out the Sample Apps
145
159
 
146
160
  ### 1. Create an Application in Asgardeo
@@ -401,6 +415,17 @@ The `sign-out` hook is used to fire a callback function after signing out is suc
401
415
  auth.signOut();
402
416
  ```
403
417
 
418
+ **Clearing the locally stored user session happens when a sign-out hook is registered after the user gets redirected back to the `signOutRedirectURL`.**
419
+ Therefore, the developer should ensure that a sign-out hook is registered when `signOutRedirectURL` is loaded. Refer the [example](#sign-out-hook-example)
420
+ for further details.
421
+
422
+ #### Example
423
+ ```TypeScript
424
+ // Register a sign-out hook with any callback function when signOutRedirectURL is loaded
425
+ // to clear locally stored user session
426
+ auth.on("sign-out", () => {});
427
+ ```
428
+
404
429
  ---
405
430
 
406
431
  ### httpRequest
@@ -807,7 +832,6 @@ If you are using TypeScript, you may want to use the `Hooks` enum that consists
807
832
  **When the user signs out, the user is taken to the Asgardeo's logout page and then redirected back to the SPA on successful log out. Hence, developers should ensure that the `"sign-out"` hook is called when the page the user is redirected to loads.**
808
833
 
809
834
  #### Example
810
-
811
835
  ```TypeScript
812
836
  auth.on("sign-in", () => {
813
837
  // console.log(response);
@@ -979,7 +1003,6 @@ Of the four methods, storing the session information in the **web worker** is th
979
1003
  ```TypeScript
980
1004
  auth.initialize(config);
981
1005
  ```
982
-
983
1006
  ## Models
984
1007
 
985
1008
  ### AuthClientConfig\<Config>
@@ -990,7 +1013,7 @@ This table shows the extended attributes provided by the `Config` interface.
990
1013
  | Attribute | Required/Optional | Type | Default Value | Description |
991
1014
  |:------------------------------|:------------------------------------------------|:----------------------------------------------------|:-------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
992
1015
  | [`storage`](#storage) | Optional | `"sessionStorage"`, `"webWorker"`, `"localStorage"` | `"sessionStorage"` | The storage medium where the session information such as the access token should be stored. |
993
- | `resourceServerURLs` | Required if the `storage` is set to `webWorker` | `string[]` | `[]` | The URLs of the API endpoints. This is needed only if the storage method is set to `webWorker`. When API calls are made through the [`httpRequest`](#httprequest) or the [`httpRequestAll`](#httprequestall) method, only the calls to the endpoints specified in the `baseURL` attribute will be allowed. Everything else will be denied. |
1016
+ | `resourceServerURLs` | Required if the `storage` is set to `webWorker` | `string[]` | `[]` | The URLs of the API endpoints. This is required if the storage method is set to `webWorker`. Additionally, when API calls are made through the [`httpRequest`](#httprequest) or the [`httpRequestAll`](#httprequestall) method, only the calls to the endpoints specified either in `baseURL` or in `resourceServerURLs` attributes will be allowed. Everything else will be denied. |
994
1017
  | `requestTimeout` | Optional | `number` | 60000 (seconds) | Specifies in seconds how long a request to the web worker should wait before being timed out. |
995
1018
  | `sessionRefreshInterval` | Optional | `number` | 300 (seconds) | Specifies how often the session state should be checked. To check the authentication state, the authorization endpoint is queried with the `prompt` parameter set to `none`. |
996
1019
  | `checkSessionInterval` | Optional | `number` | 3 (seconds) | Specifies how often the check-session iFrame should be queried to check the session state. This is used to perform single logout. |