@asgardeo/browser 0.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.
- package/LICENSE +201 -0
- package/README.md +48 -0
- package/dist/AsgardeoBrowserClient.d.ts +28 -0
- package/dist/__legacy__/client.d.ts +651 -0
- package/dist/__legacy__/clients/index.d.ts +19 -0
- package/dist/__legacy__/clients/main-thread-client.d.ts +21 -0
- package/dist/__legacy__/clients/web-worker-client.d.ts +21 -0
- package/dist/__legacy__/constants/errors.d.ts +18 -0
- package/dist/__legacy__/constants/hooks.d.ts +29 -0
- package/dist/__legacy__/constants/index.d.ts +23 -0
- package/dist/__legacy__/constants/messages-types.d.ts +51 -0
- package/dist/__legacy__/constants/parameters.d.ts +21 -0
- package/dist/__legacy__/constants/session-management.d.ts +25 -0
- package/dist/__legacy__/constants/storage.d.ts +18 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts +58 -0
- package/dist/__legacy__/helpers/index.d.ts +20 -0
- package/dist/__legacy__/helpers/session-management-helper.d.ts +20 -0
- package/dist/__legacy__/helpers/spa-helper.d.ts +28 -0
- package/dist/__legacy__/http-client/clients/axios-http-client.d.ts +117 -0
- package/dist/__legacy__/http-client/clients/index.d.ts +19 -0
- package/dist/__legacy__/http-client/helpers/decorators.d.ts +24 -0
- package/dist/__legacy__/http-client/helpers/index.d.ts +19 -0
- package/dist/__legacy__/http-client/index.d.ts +20 -0
- package/dist/__legacy__/http-client/models/axios-http-client.d.ts +34 -0
- package/dist/__legacy__/http-client/models/http-client.d.ts +41 -0
- package/dist/__legacy__/http-client/models/index.d.ts +20 -0
- package/dist/__legacy__/models/client-config.d.ts +54 -0
- package/dist/__legacy__/models/client.d.ts +82 -0
- package/dist/__legacy__/models/http-client.d.ts +42 -0
- package/dist/__legacy__/models/index.d.ts +26 -0
- package/dist/__legacy__/models/message.d.ts +45 -0
- package/dist/__legacy__/models/request-custom-grant.d.ts +24 -0
- package/dist/__legacy__/models/session-management-helper.d.ts +23 -0
- package/dist/__legacy__/models/sign-in.d.ts +21 -0
- package/dist/__legacy__/models/sign-out-error.d.ts +21 -0
- package/dist/__legacy__/models/storage.d.ts +38 -0
- package/dist/__legacy__/models/web-worker.d.ts +55 -0
- package/dist/__legacy__/stores/index.d.ts +20 -0
- package/dist/__legacy__/stores/local-store.d.ts +23 -0
- package/dist/__legacy__/stores/memory-store.d.ts +25 -0
- package/dist/__legacy__/stores/session-store.d.ts +23 -0
- package/dist/__legacy__/utils/crypto-utils.d.ts +31 -0
- package/dist/__legacy__/utils/index.d.ts +19 -0
- package/dist/__legacy__/utils/message-utils.d.ts +37 -0
- package/dist/__legacy__/utils/spa-utils.d.ts +107 -0
- package/dist/__legacy__/worker/index.d.ts +19 -0
- package/dist/__legacy__/worker/worker-core.d.ts +21 -0
- package/dist/__legacy__/worker/worker-receiver.d.ts +21 -0
- package/dist/cjs/index.js +5437 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/constants/StyleConstants.d.ts +28 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +5459 -0
- package/dist/index.js.map +7 -0
- package/dist/models/config.d.ts +19 -0
- package/dist/utils/hasAuthParamsInUrl.d.ts +25 -0
- package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
- package/dist/worker.d.ts +21 -0
- package/package.json +76 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { AuthClientConfig } from '@asgardeo/javascript';
|
|
19
|
+
import { Storage } from './storage';
|
|
20
|
+
export interface SPAConfig {
|
|
21
|
+
/**
|
|
22
|
+
* Enable OIDC Session Management with PR Iframe.
|
|
23
|
+
* @remarks If the consumer app the OP is hosted in different domains,
|
|
24
|
+
* third party cookies has to be enabled for this to work properly.
|
|
25
|
+
*/
|
|
26
|
+
enableOIDCSessionManagement?: boolean;
|
|
27
|
+
checkSessionInterval?: number;
|
|
28
|
+
sessionRefreshInterval?: number;
|
|
29
|
+
resourceServerURLs?: string[];
|
|
30
|
+
authParams?: Record<string, string>;
|
|
31
|
+
periodicTokenRefresh?: boolean;
|
|
32
|
+
autoLogoutOnTokenRefreshError?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* SDK Client config parameters.
|
|
36
|
+
*/
|
|
37
|
+
export interface MainThreadClientConfig extends SPAConfig {
|
|
38
|
+
/**
|
|
39
|
+
* The storage type to be used for storing the session information.
|
|
40
|
+
*/
|
|
41
|
+
storage?: Storage.SessionStorage | Storage.LocalStorage | Storage.BrowserMemory | 'sessionStorage' | 'localStorage' | 'browserMemory';
|
|
42
|
+
}
|
|
43
|
+
export interface WebWorkerClientConfig extends SPAConfig {
|
|
44
|
+
/**
|
|
45
|
+
* The storage type to be used for storing the session information.
|
|
46
|
+
*/
|
|
47
|
+
storage: Storage.WebWorker | 'webWorker';
|
|
48
|
+
/**
|
|
49
|
+
* Specifies in seconds how long a request to the web worker should wait before being timed.
|
|
50
|
+
*/
|
|
51
|
+
requestTimeout?: number;
|
|
52
|
+
}
|
|
53
|
+
export type Config = MainThreadClientConfig | WebWorkerClientConfig;
|
|
54
|
+
export type AuthSPAClientConfig = AuthClientConfig<Config>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { AuthClientConfig, BasicUserInfo, IsomorphicCrypto, CustomGrantConfig, DataLayer, IdTokenPayload, FetchResponse, OIDCEndpoints } from '@asgardeo/javascript';
|
|
19
|
+
import { HttpError, HttpRequestConfig, HttpResponse, MainThreadClientConfig, SignInConfig, WebWorkerClientConfig } from '.';
|
|
20
|
+
import { HttpClientInstance } from '../http-client';
|
|
21
|
+
export interface MainThreadClientInterface {
|
|
22
|
+
setHttpRequestStartCallback(callback: () => void): void;
|
|
23
|
+
setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;
|
|
24
|
+
setHttpRequestFinishCallback(callback: () => void): void;
|
|
25
|
+
setHttpRequestErrorCallback(callback: (error: HttpError) => void | Promise<void>): void;
|
|
26
|
+
httpRequest(config: HttpRequestConfig): Promise<HttpResponse>;
|
|
27
|
+
httpRequestAll(config: HttpRequestConfig[]): Promise<HttpResponse[] | undefined>;
|
|
28
|
+
getHttpClient(): HttpClientInstance;
|
|
29
|
+
enableHttpHandler(): boolean;
|
|
30
|
+
disableHttpHandler(): boolean;
|
|
31
|
+
signIn(config?: SignInConfig, authorizationCode?: string, sessionState?: string, signInRedirectURL?: string, tokenRequestConfig?: {
|
|
32
|
+
params: Record<string, unknown>;
|
|
33
|
+
}): Promise<BasicUserInfo>;
|
|
34
|
+
signOut(signOutRedirectURL?: string): Promise<boolean>;
|
|
35
|
+
requestCustomGrant(config: CustomGrantConfig): Promise<BasicUserInfo | FetchResponse>;
|
|
36
|
+
refreshAccessToken(): Promise<BasicUserInfo>;
|
|
37
|
+
revokeAccessToken(): Promise<boolean>;
|
|
38
|
+
getBasicUserInfo(): Promise<BasicUserInfo>;
|
|
39
|
+
getDecodedIDToken(): Promise<IdTokenPayload>;
|
|
40
|
+
getCryptoHelper(): Promise<IsomorphicCrypto>;
|
|
41
|
+
getConfigData(): Promise<AuthClientConfig<MainThreadClientConfig>>;
|
|
42
|
+
getIDToken(): Promise<string>;
|
|
43
|
+
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
44
|
+
getAccessToken(): Promise<string>;
|
|
45
|
+
getDataLayer(): Promise<DataLayer<MainThreadClientConfig>>;
|
|
46
|
+
isAuthenticated(): Promise<boolean>;
|
|
47
|
+
updateConfig(config: Partial<AuthClientConfig<MainThreadClientConfig>>): Promise<void>;
|
|
48
|
+
trySignInSilently(additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
|
|
49
|
+
params: Record<string, unknown>;
|
|
50
|
+
}): Promise<BasicUserInfo | boolean>;
|
|
51
|
+
isSessionActive(): Promise<boolean>;
|
|
52
|
+
}
|
|
53
|
+
export interface WebWorkerClientInterface {
|
|
54
|
+
requestCustomGrant(requestParams: CustomGrantConfig): Promise<FetchResponse | BasicUserInfo>;
|
|
55
|
+
httpRequest<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
56
|
+
httpRequestAll<T = any>(configs: HttpRequestConfig[]): Promise<HttpResponse<T>[]>;
|
|
57
|
+
enableHttpHandler(): Promise<boolean>;
|
|
58
|
+
disableHttpHandler(): Promise<boolean>;
|
|
59
|
+
initialize(): Promise<boolean>;
|
|
60
|
+
signIn(params?: SignInConfig, authorizationCode?: string, sessionState?: string, signInRedirectURL?: string, tokenRequestConfig?: {
|
|
61
|
+
params: Record<string, unknown>;
|
|
62
|
+
}): Promise<BasicUserInfo>;
|
|
63
|
+
signOut(signOutRedirectURL?: string): Promise<boolean>;
|
|
64
|
+
revokeAccessToken(): Promise<boolean>;
|
|
65
|
+
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
66
|
+
getBasicUserInfo(): Promise<BasicUserInfo>;
|
|
67
|
+
getConfigData(): Promise<AuthClientConfig<WebWorkerClientConfig>>;
|
|
68
|
+
getDecodedIDToken(): Promise<IdTokenPayload>;
|
|
69
|
+
getDecodedIDPIDToken(): Promise<IdTokenPayload>;
|
|
70
|
+
getCryptoHelper(): Promise<IsomorphicCrypto>;
|
|
71
|
+
getIDToken(): Promise<string>;
|
|
72
|
+
isAuthenticated(): Promise<boolean>;
|
|
73
|
+
setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;
|
|
74
|
+
setHttpRequestErrorCallback(callback: (response: HttpError) => void | Promise<void>): void;
|
|
75
|
+
setHttpRequestStartCallback(callback: () => void): void;
|
|
76
|
+
setHttpRequestFinishCallback(callback: () => void): void;
|
|
77
|
+
refreshAccessToken(): Promise<BasicUserInfo>;
|
|
78
|
+
updateConfig(config: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void>;
|
|
79
|
+
trySignInSilently(additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
|
|
80
|
+
params: Record<string, unknown>;
|
|
81
|
+
}): Promise<BasicUserInfo | boolean>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { AxiosRequestConfig } from 'axios';
|
|
19
|
+
import { HttpClientInstance, HttpError, HttpResponse } from '.';
|
|
20
|
+
import { SPACustomGrantConfig } from '../..';
|
|
21
|
+
export interface HttpClient {
|
|
22
|
+
requestStartCallback: () => void;
|
|
23
|
+
requestSuccessCallback: (response: HttpResponse) => void;
|
|
24
|
+
requestErrorCallback: (error: HttpError) => void | Promise<void>;
|
|
25
|
+
requestFinishCallback: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface HttpRequestInterface {
|
|
28
|
+
httpClient: HttpClientInstance;
|
|
29
|
+
requestConfig: HttpRequestConfig;
|
|
30
|
+
isHttpHandlerEnabled?: boolean;
|
|
31
|
+
httpErrorCallback?: (error: HttpError) => void | Promise<void>;
|
|
32
|
+
httpFinishCallback?: () => void;
|
|
33
|
+
enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface HttpRequestConfig extends AxiosRequestConfig {
|
|
36
|
+
attachToken?: boolean;
|
|
37
|
+
shouldEncodeToFormData?: boolean;
|
|
38
|
+
shouldAttachIDPAccessToken?: boolean;
|
|
39
|
+
startTimeInMs?: number;
|
|
40
|
+
}
|
|
41
|
+
export { AxiosResponse as HttpResponse, Method as HttpMethod, AxiosRequestTransformer as HttpRequestTransformer, AxiosResponseTransformer as HttpResponseTransformer, AxiosAdapter as HttpAdapter, AxiosBasicCredentials as HttpBasicCredentials, ResponseType, AxiosProxyConfig as HttpProxyConfig, CancelToken, AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosInstance as HttpInstance, } from 'axios';
|
|
42
|
+
export { HttpClientInstance } from '../http-client';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
export * from './client';
|
|
19
|
+
export * from './message';
|
|
20
|
+
export * from './http-client';
|
|
21
|
+
export * from './web-worker';
|
|
22
|
+
export * from './session-management-helper';
|
|
23
|
+
export * from './sign-in';
|
|
24
|
+
export * from './sign-out-error';
|
|
25
|
+
export { Config as LegacyConfig } from './client-config';
|
|
26
|
+
export { SPAConfig, MainThreadClientConfig, WebWorkerClientConfig, AuthSPAClientConfig } from './client-config';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { AUTH_CODE, CHECK_SESSION_SIGNED_IN, CHECK_SESSION_SIGNED_OUT, DISABLE_HTTP_HANDLER, ENABLE_HTTP_HANDLER, END_USER_SESSION, GET_AUTH_URL, GET_BASIC_USER_INFO, GET_CONFIG_DATA, GET_CRYPTO_HELPER, GET_DECODED_IDP_ID_TOKEN, GET_DECODED_ID_TOKEN, GET_ID_TOKEN, GET_OIDC_SERVICE_ENDPOINTS, GET_SIGN_OUT_URL, HTTP_REQUEST, HTTP_REQUEST_ALL, INIT, IS_AUTHENTICATED, REFRESH_ACCESS_TOKEN, REFRESH_ACCESS_TOKEN_ERR0R, REQUEST_ACCESS_TOKEN, REQUEST_CUSTOM_GRANT, REQUEST_ERROR, REQUEST_FINISH, REQUEST_START, REQUEST_SUCCESS, REVOKE_ACCESS_TOKEN, SET_SESSION_STATE, SET_SESSION_STATE_FROM_IFRAME, SIGN_IN, SIGN_OUT, START_AUTO_REFRESH_TOKEN, UPDATE_CONFIG } from "../constants";
|
|
19
|
+
export interface ResponseMessage<T> {
|
|
20
|
+
success: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
data?: T;
|
|
23
|
+
blob?: Blob;
|
|
24
|
+
}
|
|
25
|
+
export interface Message<T> {
|
|
26
|
+
type: MessageType;
|
|
27
|
+
data?: T;
|
|
28
|
+
}
|
|
29
|
+
export interface AuthorizationInfo {
|
|
30
|
+
code: string;
|
|
31
|
+
sessionState: string;
|
|
32
|
+
pkce?: string;
|
|
33
|
+
state: string;
|
|
34
|
+
tokenRequestConfig?: {
|
|
35
|
+
params: Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type MessageType = typeof INIT | typeof SIGN_IN | typeof AUTH_CODE | typeof SIGN_OUT | typeof HTTP_REQUEST | typeof HTTP_REQUEST_ALL | typeof REQUEST_CUSTOM_GRANT | typeof REVOKE_ACCESS_TOKEN | typeof END_USER_SESSION | typeof REQUEST_ERROR | typeof REQUEST_FINISH | typeof REQUEST_START | typeof REQUEST_SUCCESS | typeof GET_OIDC_SERVICE_ENDPOINTS | typeof GET_BASIC_USER_INFO | typeof GET_DECODED_ID_TOKEN | typeof GET_CRYPTO_HELPER | typeof GET_DECODED_IDP_ID_TOKEN | typeof ENABLE_HTTP_HANDLER | typeof DISABLE_HTTP_HANDLER | typeof GET_AUTH_URL | typeof REQUEST_ACCESS_TOKEN | typeof IS_AUTHENTICATED | typeof GET_SIGN_OUT_URL | typeof REFRESH_ACCESS_TOKEN | typeof REFRESH_ACCESS_TOKEN_ERR0R | typeof SET_SESSION_STATE | typeof START_AUTO_REFRESH_TOKEN | typeof UPDATE_CONFIG | typeof GET_ID_TOKEN | typeof CHECK_SESSION_SIGNED_IN | typeof CHECK_SESSION_SIGNED_OUT | typeof GET_CONFIG_DATA | typeof SET_SESSION_STATE_FROM_IFRAME;
|
|
39
|
+
export interface CommunicationHelperInterface {
|
|
40
|
+
communicate: <T, R>(message: Message<T>) => Promise<R>;
|
|
41
|
+
}
|
|
42
|
+
export interface AuthorizationResponse {
|
|
43
|
+
authorizationURL: string;
|
|
44
|
+
pkce?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { CustomGrantConfig } from '@asgardeo/javascript';
|
|
19
|
+
/**
|
|
20
|
+
* SPA Custom Request Grant config model
|
|
21
|
+
*/
|
|
22
|
+
export interface SPACustomGrantConfig extends CustomGrantConfig {
|
|
23
|
+
preventSignOutURLUpdate?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { GetAuthURLConfig } from '@asgardeo/javascript';
|
|
19
|
+
export interface SessionManagementHelperInterface {
|
|
20
|
+
initialize(clientID: string, checkSessionEndpoint: string, getSessionState: () => Promise<string>, interval: number, sessionRefreshInterval: number, redirectURL: string, getAuthorizationURL: (params?: GetAuthURLConfig) => Promise<string>): void;
|
|
21
|
+
receivePromptNoneResponse(setSessionState?: (sessionState: string | null) => Promise<void>): Promise<boolean>;
|
|
22
|
+
reset(): any;
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { GetAuthURLConfig } from '@asgardeo/javascript';
|
|
19
|
+
export type SignInConfig = GetAuthURLConfig & {
|
|
20
|
+
callOnlyOnRedirect?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
export interface SignOutError {
|
|
19
|
+
error: string;
|
|
20
|
+
description: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
* Enum for the different storage types.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum Storage {
|
|
22
|
+
/**
|
|
23
|
+
* Stores the session information in the local storage
|
|
24
|
+
*/
|
|
25
|
+
LocalStorage = "localStorage",
|
|
26
|
+
/**
|
|
27
|
+
* Store the session information in the session storage.
|
|
28
|
+
*/
|
|
29
|
+
SessionStorage = "sessionStorage",
|
|
30
|
+
/**
|
|
31
|
+
* Store the session information in the web worker.
|
|
32
|
+
*/
|
|
33
|
+
WebWorker = "webWorker",
|
|
34
|
+
/**
|
|
35
|
+
* Store the session information in the browser memory.
|
|
36
|
+
*/
|
|
37
|
+
BrowserMemory = "browserMemory"
|
|
38
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { AuthClientConfig, AuthorizationURLParams, BasicUserInfo, IsomorphicCrypto, CustomGrantConfig, IdTokenPayload, FetchResponse, OIDCEndpoints } from '@asgardeo/javascript';
|
|
19
|
+
import { HttpRequestConfig, HttpResponse, Message } from '.';
|
|
20
|
+
import { AuthorizationResponse, WebWorkerClientConfig } from '../..';
|
|
21
|
+
interface WebWorkerEvent<T> extends MessageEvent {
|
|
22
|
+
data: Message<T>;
|
|
23
|
+
}
|
|
24
|
+
export declare class WebWorkerClass<T> extends Worker {
|
|
25
|
+
onmessage: (this: Worker, event: WebWorkerEvent<T>) => any;
|
|
26
|
+
}
|
|
27
|
+
export interface WebWorkerCoreInterface {
|
|
28
|
+
setHttpRequestStartCallback(callback: () => void): void;
|
|
29
|
+
setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;
|
|
30
|
+
setHttpRequestFinishCallback(callback: () => void): void;
|
|
31
|
+
httpRequest(config: HttpRequestConfig): Promise<HttpResponse>;
|
|
32
|
+
httpRequestAll(configs: HttpRequestConfig[]): Promise<HttpResponse[] | undefined>;
|
|
33
|
+
enableHttpHandler(): void;
|
|
34
|
+
disableHttpHandler(): void;
|
|
35
|
+
getAuthorizationURL(params?: AuthorizationURLParams, signInRedirectURL?: string): Promise<AuthorizationResponse>;
|
|
36
|
+
requestAccessToken(authorizationCode?: string, sessionState?: string, pkce?: string, state?: string): Promise<BasicUserInfo>;
|
|
37
|
+
signOut(signOutRedirectURL?: string): Promise<string>;
|
|
38
|
+
getSignOutURL(signOutRedirectURL?: string): Promise<string>;
|
|
39
|
+
requestCustomGrant(config: CustomGrantConfig): Promise<BasicUserInfo | FetchResponse>;
|
|
40
|
+
refreshAccessToken(): Promise<BasicUserInfo>;
|
|
41
|
+
revokeAccessToken(): Promise<boolean>;
|
|
42
|
+
getBasicUserInfo(): Promise<BasicUserInfo>;
|
|
43
|
+
getDecodedIDToken(): Promise<IdTokenPayload>;
|
|
44
|
+
getDecodedIDPIDToken(): Promise<IdTokenPayload>;
|
|
45
|
+
getCryptoHelper(): Promise<IsomorphicCrypto>;
|
|
46
|
+
getIDToken(): Promise<string>;
|
|
47
|
+
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
48
|
+
getAccessToken(): Promise<string>;
|
|
49
|
+
isAuthenticated(): Promise<boolean>;
|
|
50
|
+
startAutoRefreshToken(): Promise<void>;
|
|
51
|
+
setSessionState(sessionState: string): Promise<void>;
|
|
52
|
+
updateConfig(config: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void>;
|
|
53
|
+
getConfigData(): Promise<AuthClientConfig<WebWorkerClientConfig>>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
export * from "./local-store";
|
|
19
|
+
export * from "./memory-store";
|
|
20
|
+
export * from "./session-store";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { Store } from '@asgardeo/javascript';
|
|
19
|
+
export declare class LocalStore implements Store {
|
|
20
|
+
setData(key: string, value: string): Promise<void>;
|
|
21
|
+
getData(key: string): Promise<string>;
|
|
22
|
+
removeData(key: string): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { Store } from '@asgardeo/javascript';
|
|
19
|
+
export declare class MemoryStore implements Store {
|
|
20
|
+
private _data;
|
|
21
|
+
constructor();
|
|
22
|
+
setData(key: string, value: string): Promise<void>;
|
|
23
|
+
getData(key: string): Promise<string>;
|
|
24
|
+
removeData(key: string): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { Store } from '@asgardeo/javascript';
|
|
19
|
+
export declare class SessionStore implements Store {
|
|
20
|
+
setData(key: string, value: string): Promise<void>;
|
|
21
|
+
getData(key: string): Promise<string>;
|
|
22
|
+
removeData(key: string): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { Buffer } from 'buffer';
|
|
19
|
+
import { Crypto, JWKInterface } from '@asgardeo/javascript';
|
|
20
|
+
export declare class SPACryptoUtils implements Crypto<Buffer | string> {
|
|
21
|
+
/**
|
|
22
|
+
* Get URL encoded string.
|
|
23
|
+
*
|
|
24
|
+
* @returns {string} base 64 url encoded value.
|
|
25
|
+
*/
|
|
26
|
+
base64URLEncode(value: Buffer | string): string;
|
|
27
|
+
base64URLDecode(value: string): string;
|
|
28
|
+
hashSha256(data: string): string | Buffer;
|
|
29
|
+
generateRandomBytes(length: number): string | Buffer;
|
|
30
|
+
verifyJwt(idToken: string, jwk: Partial<JWKInterface>, algorithms: string[], clientID: string, issuer: string, subject: string, clockTolerance?: number, validateJwtIssuer?: boolean): Promise<boolean>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
export * from "./message-utils";
|
|
19
|
+
export * from "./spa-utils";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. 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
|
+
import { ResponseMessage } from "../models";
|
|
19
|
+
export declare class MessageUtils {
|
|
20
|
+
private constructor();
|
|
21
|
+
/**
|
|
22
|
+
* JSON stringifies the passed object.
|
|
23
|
+
*
|
|
24
|
+
* @param {any} data The data object.
|
|
25
|
+
*
|
|
26
|
+
* @return {ResponseMessage<string>} JSON string.
|
|
27
|
+
*/
|
|
28
|
+
static generateSuccessMessage(data?: any): ResponseMessage<string>;
|
|
29
|
+
/**
|
|
30
|
+
* JSON stringifies the passed object.
|
|
31
|
+
*
|
|
32
|
+
* @param {any} error The error object.
|
|
33
|
+
*
|
|
34
|
+
* @return {ResponseMessage<string>} JSON string.
|
|
35
|
+
*/
|
|
36
|
+
static generateFailureMessage(error?: any): ResponseMessage<string>;
|
|
37
|
+
}
|