@asgardeo/auth-spa 3.1.4 → 3.2.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.
- package/README.md +23 -0
- package/dist/asgardeo-spa.production.esm.js +33 -13
- package/dist/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/asgardeo-spa.production.js +29 -9
- package/dist/asgardeo-spa.production.js.map +1 -1
- package/dist/asgardeo-spa.production.min.js +1 -1
- package/dist/asgardeo-spa.production.min.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.esm.js +31 -11
- package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.js +47 -27
- package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
- package/dist/src/client.d.ts +24 -2
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +42 -4
- package/dist/src/client.js.map +1 -1
- package/dist/src/clients/main-thread-client.d.ts.map +1 -1
- package/dist/src/clients/main-thread-client.js +6 -1
- package/dist/src/clients/main-thread-client.js.map +1 -1
- package/dist/src/clients/web-worker-client.d.ts.map +1 -1
- package/dist/src/clients/web-worker-client.js +3 -1
- package/dist/src/clients/web-worker-client.js.map +1 -1
- package/dist/src/constants/storage.d.ts +0 -18
- package/dist/src/constants/storage.d.ts.map +1 -1
- package/dist/src/constants/storage.js +0 -19
- package/dist/src/constants/storage.js.map +1 -1
- package/dist/src/helpers/authentication-helper.d.ts.map +1 -1
- package/dist/src/helpers/authentication-helper.js +2 -1
- package/dist/src/helpers/authentication-helper.js.map +1 -1
- package/dist/src/helpers/session-management-helper.d.ts +1 -1
- package/dist/src/helpers/session-management-helper.d.ts.map +1 -1
- package/dist/src/helpers/session-management-helper.js +2 -1
- package/dist/src/helpers/session-management-helper.js.map +1 -1
- package/dist/src/models/client-config.d.ts +12 -3
- package/dist/src/models/client-config.d.ts.map +1 -1
- package/dist/src/models/client.d.ts +2 -0
- package/dist/src/models/client.d.ts.map +1 -1
- package/dist/src/models/storage.d.ts +39 -0
- package/dist/src/models/storage.d.ts.map +1 -0
- package/dist/src/models/storage.js +40 -0
- package/dist/src/models/storage.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/client.ts +45 -4
- package/src/clients/main-thread-client.ts +9 -7
- package/src/clients/web-worker-client.ts +4 -3
- package/src/constants/storage.ts +0 -19
- package/src/helpers/authentication-helper.ts +2 -2
- package/src/helpers/session-management-helper.ts +2 -2
- package/src/models/client-config.ts +18 -3
- package/src/models/client.ts +2 -0
- package/src/models/storage.ts +39 -0
package/src/constants/storage.ts
CHANGED
|
@@ -16,23 +16,4 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Specifies where the session information should be stored.
|
|
21
|
-
*/
|
|
22
|
-
export enum Storage {
|
|
23
|
-
/**
|
|
24
|
-
* Stores the session information in the local storage
|
|
25
|
-
*/
|
|
26
|
-
LocalStorage = "localStorage",
|
|
27
|
-
/**
|
|
28
|
-
* Store the session information in the session storage.
|
|
29
|
-
*/
|
|
30
|
-
SessionStorage = "sessionStorage",
|
|
31
|
-
/**
|
|
32
|
-
* Store the session information in the web worker.
|
|
33
|
-
*/
|
|
34
|
-
WebWorker = "webWorker",
|
|
35
|
-
BrowserMemory = "browserMemory"
|
|
36
|
-
}
|
|
37
|
-
|
|
38
19
|
export const TOKEN_REQUEST_CONFIG_KEY = "token_request_config";
|
|
@@ -41,8 +41,7 @@ import {
|
|
|
41
41
|
ERROR_DESCRIPTION,
|
|
42
42
|
PROMPT_NONE_IFRAME,
|
|
43
43
|
REFRESH_ACCESS_TOKEN_ERR0R,
|
|
44
|
-
RP_IFRAME
|
|
45
|
-
Storage
|
|
44
|
+
RP_IFRAME
|
|
46
45
|
} from "../constants";
|
|
47
46
|
import {
|
|
48
47
|
AuthorizationInfo,
|
|
@@ -57,6 +56,7 @@ import {
|
|
|
57
56
|
WebWorkerClientConfig
|
|
58
57
|
} from "../models";
|
|
59
58
|
import { SPACustomGrantConfig } from "../models/request-custom-grant";
|
|
59
|
+
import { Storage } from "../models/storage";
|
|
60
60
|
import { SPAUtils } from "../utils";
|
|
61
61
|
|
|
62
62
|
export class AuthenticationHelper<
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
SET_SESSION_STATE_FROM_IFRAME,
|
|
28
28
|
SILENT_SIGN_IN_STATE,
|
|
29
29
|
STATE,
|
|
30
|
-
STATE_QUERY
|
|
31
|
-
Storage
|
|
30
|
+
STATE_QUERY
|
|
32
31
|
} from "../constants";
|
|
33
32
|
import { AuthorizationInfo, Message, SessionManagementHelperInterface } from "../models";
|
|
33
|
+
import { Storage } from "../models/storage";
|
|
34
34
|
import { SPAUtils } from "../utils";
|
|
35
35
|
|
|
36
36
|
export const SessionManagementHelper = (() => {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { AuthClientConfig } from "@asgardeo/auth-js";
|
|
20
|
-
import { Storage } from "../
|
|
20
|
+
import { Storage } from "../models/storage";
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
export interface SPAConfig {
|
|
@@ -39,11 +39,26 @@ export interface SPAConfig {
|
|
|
39
39
|
* SDK Client config parameters.
|
|
40
40
|
*/
|
|
41
41
|
export interface MainThreadClientConfig extends SPAConfig {
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The storage type to be used for storing the session information.
|
|
44
|
+
*/
|
|
45
|
+
storage?:
|
|
46
|
+
| Storage.SessionStorage
|
|
47
|
+
| Storage.LocalStorage
|
|
48
|
+
| Storage.BrowserMemory
|
|
49
|
+
| "sessionStorage"
|
|
50
|
+
| "localStorage"
|
|
51
|
+
| "browserMemory";
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
export interface WebWorkerClientConfig extends SPAConfig {
|
|
46
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The storage type to be used for storing the session information.
|
|
57
|
+
*/
|
|
58
|
+
storage: Storage.WebWorker | "webWorker";
|
|
59
|
+
/**
|
|
60
|
+
* Specifies in seconds how long a request to the web worker should wait before being timed.
|
|
61
|
+
*/
|
|
47
62
|
requestTimeout?: number;
|
|
48
63
|
}
|
|
49
64
|
|
package/src/models/client.ts
CHANGED
|
@@ -62,6 +62,7 @@ export interface MainThreadClientInterface {
|
|
|
62
62
|
getBasicUserInfo(): Promise<BasicUserInfo>;
|
|
63
63
|
getDecodedIDToken(): Promise<DecodedIDTokenPayload>;
|
|
64
64
|
getCryptoHelper(): Promise<CryptoHelper>;
|
|
65
|
+
getConfigData(): Promise<AuthClientConfig<MainThreadClientConfig>>;
|
|
65
66
|
getIDToken(): Promise<string>;
|
|
66
67
|
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
67
68
|
getAccessToken(): Promise<string>;
|
|
@@ -94,6 +95,7 @@ export interface WebWorkerClientInterface {
|
|
|
94
95
|
revokeAccessToken(): Promise<boolean>;
|
|
95
96
|
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
96
97
|
getBasicUserInfo(): Promise<BasicUserInfo>;
|
|
98
|
+
getConfigData(): Promise<AuthClientConfig<WebWorkerClientConfig>>;
|
|
97
99
|
getDecodedIDToken(): Promise<DecodedIDTokenPayload>;
|
|
98
100
|
getDecodedIDPIDToken(): Promise<DecodedIDTokenPayload>;
|
|
99
101
|
getCryptoHelper(): Promise<CryptoHelper>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Enum for the different storage types.
|
|
21
|
+
*/
|
|
22
|
+
export enum Storage {
|
|
23
|
+
/**
|
|
24
|
+
* Stores the session information in the local storage
|
|
25
|
+
*/
|
|
26
|
+
LocalStorage = "localStorage",
|
|
27
|
+
/**
|
|
28
|
+
* Store the session information in the session storage.
|
|
29
|
+
*/
|
|
30
|
+
SessionStorage = "sessionStorage",
|
|
31
|
+
/**
|
|
32
|
+
* Store the session information in the web worker.
|
|
33
|
+
*/
|
|
34
|
+
WebWorker = "webWorker",
|
|
35
|
+
/**
|
|
36
|
+
* Store the session information in the browser memory.
|
|
37
|
+
*/
|
|
38
|
+
BrowserMemory = "browserMemory"
|
|
39
|
+
}
|