@asgardeo/javascript 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 +57 -0
- package/dist/AsgardeoJavaScriptClient.d.ts +81 -0
- package/dist/IsomorphicCrypto.d.ts +73 -0
- package/dist/__legacy__/client.d.ts +488 -0
- package/dist/__legacy__/core/authentication-core.d.ts +51 -0
- package/dist/__legacy__/core/index.d.ts +18 -0
- package/dist/__legacy__/data/data-layer.d.ts +64 -0
- package/dist/__legacy__/data/index.d.ts +18 -0
- package/dist/__legacy__/exception/exception.d.ts +23 -0
- package/dist/__legacy__/exception/index.d.ts +18 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts +37 -0
- package/dist/__legacy__/helpers/index.d.ts +18 -0
- package/dist/__legacy__/models/authorization-url.d.ts +23 -0
- package/dist/__legacy__/models/client-config.d.ts +60 -0
- package/dist/__legacy__/models/custom-grant.d.ts +26 -0
- package/dist/__legacy__/models/data.d.ts +27 -0
- package/dist/__legacy__/models/fetch.d.ts +55 -0
- package/dist/__legacy__/models/index.d.ts +23 -0
- package/dist/__legacy__/models/user.d.ts +85 -0
- package/dist/api/oidc/getUserInfo.d.ts +37 -0
- package/dist/cjs/index.js +2227 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/constants/OIDCDiscoveryConstants.d.ts +153 -0
- package/dist/constants/OIDCRequestConstants.d.ts +66 -0
- package/dist/constants/PKCEConstants.d.ts +58 -0
- package/dist/constants/ScopeConstants.d.ts +45 -0
- package/dist/constants/TokenConstants.d.ts +76 -0
- package/dist/constants/TokenExchangeConstants.d.ts +68 -0
- package/dist/errors/AsgardeoAPIError.d.ts +52 -0
- package/dist/errors/AsgardeoError.d.ts +49 -0
- package/dist/errors/AsgardeoRuntimeError.d.ts +50 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +2186 -0
- package/dist/index.js.map +7 -0
- package/dist/models/client.d.ts +84 -0
- package/dist/models/config.d.ts +81 -0
- package/dist/models/crypto.d.ts +100 -0
- package/dist/models/id-token.d.ts +55 -0
- package/dist/models/oauth-response.d.ts +34 -0
- package/dist/models/oidc-discovery.d.ts +369 -0
- package/dist/models/oidc-endpoints.d.ts +70 -0
- package/dist/models/scim2-schema.d.ts +62 -0
- package/dist/models/store.d.ts +81 -0
- package/dist/models/token.d.ts +121 -0
- package/dist/models/user.d.ts +106 -0
- package/dist/models/utility-types.d.ts +20 -0
- package/dist/theme/createTheme.d.ts +21 -0
- package/dist/theme/types.d.ts +59 -0
- package/dist/utils/cryptoUtils.d.ts +0 -0
- package/dist/utils/extractPkceStorageKeyFromState.d.ts +32 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +31 -0
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +44 -0
- package/dist/utils/generatePkceStorageKey.d.ts +34 -0
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts +34 -0
- package/dist/utils/removeTrailingSlash.d.ts +31 -0
- package/package.json +61 -0
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import { OIDCEndpoints } from './oidc-endpoints';
|
|
19
|
+
/**
|
|
20
|
+
* Interface representing a key-value storage mechanism.
|
|
21
|
+
* Implementations can include various storage backends like browser storage,
|
|
22
|
+
* memory cache, or distributed caches like Redis or Memcached.
|
|
23
|
+
*/
|
|
24
|
+
export interface Store {
|
|
25
|
+
/**
|
|
26
|
+
* Stores a value with the specified key.
|
|
27
|
+
*
|
|
28
|
+
* @param key - The unique identifier for the stored value
|
|
29
|
+
* @param value - The string value to store
|
|
30
|
+
* @returns A promise that resolves when the value is successfully stored
|
|
31
|
+
* @throws Error if storage operation fails
|
|
32
|
+
*/
|
|
33
|
+
setData(key: string, value: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves a value by its key.
|
|
36
|
+
*
|
|
37
|
+
* @param key - The key of the value to retrieve
|
|
38
|
+
* @returns A promise that resolves with the stored value
|
|
39
|
+
* @throws Error if the key doesn't exist or retrieval fails
|
|
40
|
+
*/
|
|
41
|
+
getData(key: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Removes a value from the store.
|
|
44
|
+
*
|
|
45
|
+
* @param key - The key of the value to remove
|
|
46
|
+
* @returns A promise that resolves when the value is successfully removed
|
|
47
|
+
* @throws Error if removal fails or the key doesn't exist
|
|
48
|
+
*/
|
|
49
|
+
removeData(key: string): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents the possible value types that can be stored in the temporary data storage.
|
|
53
|
+
*/
|
|
54
|
+
export type TemporaryStoreValue = string | string[] | boolean | number | OIDCEndpoints;
|
|
55
|
+
/**
|
|
56
|
+
* Represents a key-value store for temporary data storage.
|
|
57
|
+
*/
|
|
58
|
+
export type TemporaryStore = {
|
|
59
|
+
[key: string]: TemporaryStoreValue;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Enum representing different types of data stores used in the application.
|
|
63
|
+
*/
|
|
64
|
+
export declare enum Stores {
|
|
65
|
+
/**
|
|
66
|
+
* Store for configuration data that defines the application's behavior and settings.
|
|
67
|
+
*/
|
|
68
|
+
ConfigData = "config_data",
|
|
69
|
+
/**
|
|
70
|
+
* Store for OpenID Connect provider metadata, including endpoints and configuration.
|
|
71
|
+
*/
|
|
72
|
+
OIDCProviderMetaData = "oidc_provider_meta_data",
|
|
73
|
+
/**
|
|
74
|
+
* Store for user session-related data like tokens and authentication state.
|
|
75
|
+
*/
|
|
76
|
+
SessionData = "session_data",
|
|
77
|
+
/**
|
|
78
|
+
* Store for temporary data that needs to persist only for a short duration.
|
|
79
|
+
*/
|
|
80
|
+
TemporaryData = "temporary_data"
|
|
81
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
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
|
+
* Represents a processed token response with standardized camelCase properties.
|
|
20
|
+
* This interface provides a clean, normalized structure for token data after
|
|
21
|
+
* processing the raw response from the authentication server.
|
|
22
|
+
*
|
|
23
|
+
* The properties in this interface follow JavaScript/TypeScript naming conventions
|
|
24
|
+
* and provide a more ergonomic API for client applications.
|
|
25
|
+
*/
|
|
26
|
+
export interface TokenResponse {
|
|
27
|
+
/**
|
|
28
|
+
* The bearer token used for authenticating API requests.
|
|
29
|
+
* This token should be included in the Authorization header
|
|
30
|
+
* of subsequent API requests.
|
|
31
|
+
*/
|
|
32
|
+
accessToken: string;
|
|
33
|
+
/**
|
|
34
|
+
* JSON Web Token (JWT) containing user identity information.
|
|
35
|
+
* This token can be decoded to access user claims and metadata
|
|
36
|
+
* without additional server requests.
|
|
37
|
+
*/
|
|
38
|
+
idToken: string;
|
|
39
|
+
/**
|
|
40
|
+
* Duration in seconds until the access token expires.
|
|
41
|
+
* Applications should refresh the token before this time
|
|
42
|
+
* to maintain uninterrupted access.
|
|
43
|
+
*/
|
|
44
|
+
expiresIn: string;
|
|
45
|
+
/**
|
|
46
|
+
* Space-separated list of OAuth scopes granted to the application.
|
|
47
|
+
* These scopes determine what resources and actions the application
|
|
48
|
+
* has permission to access.
|
|
49
|
+
*/
|
|
50
|
+
scope: string;
|
|
51
|
+
/**
|
|
52
|
+
* Token used to obtain new access tokens without re-authentication.
|
|
53
|
+
* Store this securely as it enables long-term access to the user's
|
|
54
|
+
* account through the refresh flow.
|
|
55
|
+
*/
|
|
56
|
+
refreshToken: string;
|
|
57
|
+
/**
|
|
58
|
+
* The type of token issued, typically "Bearer".
|
|
59
|
+
* This indicates how the token should be used in
|
|
60
|
+
* API request Authorization headers.
|
|
61
|
+
*/
|
|
62
|
+
tokenType: string;
|
|
63
|
+
/**
|
|
64
|
+
* Unix timestamp (in seconds) when the token was created.
|
|
65
|
+
* Used in combination with expiresIn to determine when
|
|
66
|
+
* the token needs to be refreshed.
|
|
67
|
+
*/
|
|
68
|
+
createdAt: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Represents the raw token response received directly from the authentication server.
|
|
72
|
+
* This interface maintains the original snake_case property names as received in
|
|
73
|
+
* the server response before processing into the standardized TokenResponse format.
|
|
74
|
+
*
|
|
75
|
+
* The properties in this interface exactly match the OAuth2/OIDC server response
|
|
76
|
+
* format before any transformation or normalization is applied.
|
|
77
|
+
*/
|
|
78
|
+
export interface AccessTokenApiResponse {
|
|
79
|
+
/**
|
|
80
|
+
* Raw access token string from the server.
|
|
81
|
+
* This is the bearer token in its original format
|
|
82
|
+
* before any processing or validation.
|
|
83
|
+
*/
|
|
84
|
+
access_token: string;
|
|
85
|
+
/**
|
|
86
|
+
* Raw expiration time in seconds.
|
|
87
|
+
* Indicates how long the access token will be valid
|
|
88
|
+
* from the time it was issued.
|
|
89
|
+
*/
|
|
90
|
+
expires_in: string;
|
|
91
|
+
/**
|
|
92
|
+
* Server-provided creation timestamp in Unix seconds.
|
|
93
|
+
* Used to track when the token was originally issued
|
|
94
|
+
* and calculate absolute expiration time.
|
|
95
|
+
*/
|
|
96
|
+
created_at: number;
|
|
97
|
+
/**
|
|
98
|
+
* Raw ID token string containing encoded user information.
|
|
99
|
+
* This JWT can be decoded to access standardized claims
|
|
100
|
+
* about the authenticated user.
|
|
101
|
+
*/
|
|
102
|
+
id_token: string;
|
|
103
|
+
/**
|
|
104
|
+
* Raw refresh token string from the server.
|
|
105
|
+
* Used in its original format to request new access tokens
|
|
106
|
+
* when they expire.
|
|
107
|
+
*/
|
|
108
|
+
refresh_token: string;
|
|
109
|
+
/**
|
|
110
|
+
* Raw space-separated scope string defining access permissions.
|
|
111
|
+
* Lists the OAuth scopes that were granted during the
|
|
112
|
+
* authorization process.
|
|
113
|
+
*/
|
|
114
|
+
scope: string;
|
|
115
|
+
/**
|
|
116
|
+
* Raw token type identifier from the server.
|
|
117
|
+
* Typically "Bearer", indicating how the token should
|
|
118
|
+
* be used in API requests.
|
|
119
|
+
*/
|
|
120
|
+
token_type: string;
|
|
121
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
import { Schema } from './scim2-schema';
|
|
19
|
+
/**
|
|
20
|
+
* Type for the Meta object in SCIM2 responses
|
|
21
|
+
*/
|
|
22
|
+
export interface UserMeta {
|
|
23
|
+
created: string;
|
|
24
|
+
location: string;
|
|
25
|
+
lastModified: string;
|
|
26
|
+
resourceType: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type for the Role object in SCIM2 responses
|
|
30
|
+
*/
|
|
31
|
+
export interface UserRole {
|
|
32
|
+
audienceValue: string;
|
|
33
|
+
display: string;
|
|
34
|
+
audienceType: string;
|
|
35
|
+
value: string;
|
|
36
|
+
$ref: string;
|
|
37
|
+
audienceDisplay: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Type for the Name object in SCIM2 responses
|
|
41
|
+
*/
|
|
42
|
+
export interface UserName {
|
|
43
|
+
formatted: string;
|
|
44
|
+
givenName: string;
|
|
45
|
+
familyName: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents a user in the Asgardeo system.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This interface defines the user properties based on the SCIM2 schema.
|
|
52
|
+
* WSO2 specific properties are flattened to the root level for easier access.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const user: User = {
|
|
57
|
+
* emails: ["user@example.com"],
|
|
58
|
+
* profileUrl: "https://gravatar.com/avatar/123",
|
|
59
|
+
* meta: {
|
|
60
|
+
* created: "2021-06-21T11:28:21.800618Z",
|
|
61
|
+
* location: "https://api.asgardeo.io/scim2/Users/123",
|
|
62
|
+
* lastModified: "2025-04-30T06:46:48.520896Z",
|
|
63
|
+
* resourceType: "User"
|
|
64
|
+
* },
|
|
65
|
+
* name: {
|
|
66
|
+
* formatted: "John Smith",
|
|
67
|
+
* givenName: "John",
|
|
68
|
+
* familyName: "Smith"
|
|
69
|
+
* },
|
|
70
|
+
* userName: "john@example.com",
|
|
71
|
+
* id: "123",
|
|
72
|
+
* // Flattened WSO2 schema properties
|
|
73
|
+
* accountState: "UNLOCKED",
|
|
74
|
+
* accountLocked: "false",
|
|
75
|
+
* photoUrl: "https://gravatar.com/avatar/123",
|
|
76
|
+
* emailVerified: "true",
|
|
77
|
+
* lastLogonTime: "1749098996152"
|
|
78
|
+
* };
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export interface User {
|
|
82
|
+
emails: string[];
|
|
83
|
+
profileUrl?: string;
|
|
84
|
+
meta: UserMeta;
|
|
85
|
+
schemas: Schema[];
|
|
86
|
+
roles?: UserRole[];
|
|
87
|
+
name: UserName;
|
|
88
|
+
id: string;
|
|
89
|
+
userName: string;
|
|
90
|
+
accountState?: string;
|
|
91
|
+
accountLocked?: string;
|
|
92
|
+
failedLoginLockoutCount?: string;
|
|
93
|
+
failedTOTPAttempts?: string;
|
|
94
|
+
failedLoginAttempts?: string;
|
|
95
|
+
totpEnabled?: string;
|
|
96
|
+
photoUrl?: string;
|
|
97
|
+
emailVerified?: string;
|
|
98
|
+
backupCodeEnabled?: string;
|
|
99
|
+
lastLogonTime?: string;
|
|
100
|
+
signedUpRegion?: string;
|
|
101
|
+
unlockTime?: string;
|
|
102
|
+
isReadOnlyUser?: string;
|
|
103
|
+
failedLoginAttemptsBeforeSuccess?: string;
|
|
104
|
+
[key: string]: any;
|
|
105
|
+
}
|
|
106
|
+
export default User;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export type RecursivePartial<T> = {
|
|
19
|
+
[P in keyof T]?: RecursivePartial<T[P]>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { RecursivePartial } from '../models/utility-types';
|
|
19
|
+
import { Theme, ThemeConfig } from './types';
|
|
20
|
+
declare const createTheme: (config?: RecursivePartial<ThemeConfig>, isDark?: boolean) => Theme;
|
|
21
|
+
export default createTheme;
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
export interface ThemeColors {
|
|
19
|
+
primary: {
|
|
20
|
+
main: string;
|
|
21
|
+
contrastText: string;
|
|
22
|
+
};
|
|
23
|
+
secondary: {
|
|
24
|
+
main: string;
|
|
25
|
+
contrastText: string;
|
|
26
|
+
};
|
|
27
|
+
background: {
|
|
28
|
+
surface: string;
|
|
29
|
+
disabled: string;
|
|
30
|
+
body: {
|
|
31
|
+
main: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
surface: string;
|
|
35
|
+
text: {
|
|
36
|
+
primary: string;
|
|
37
|
+
secondary: string;
|
|
38
|
+
};
|
|
39
|
+
border: string;
|
|
40
|
+
error: {
|
|
41
|
+
main: string;
|
|
42
|
+
contrastText: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ThemeConfig {
|
|
46
|
+
colors: ThemeColors;
|
|
47
|
+
spacing: {
|
|
48
|
+
unit: number;
|
|
49
|
+
};
|
|
50
|
+
borderRadius: {
|
|
51
|
+
small: string;
|
|
52
|
+
medium: string;
|
|
53
|
+
large: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface Theme extends ThemeConfig {
|
|
57
|
+
cssVariables: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
export type ThemeMode = 'light' | 'dark' | 'system';
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
* Extracts the PKCE key from a state parameter string.
|
|
20
|
+
*
|
|
21
|
+
* @param state - The state parameter string containing the request index.
|
|
22
|
+
* @returns The PKCE key string in the format `pkce_code_verifier_${index}`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const state = "request_1";
|
|
27
|
+
* const pkceKey = extractPkceStorageKeyFromState(state);
|
|
28
|
+
* // Returns: "pkce_code_verifier_1"
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const extractPkceStorageKeyFromState: (state: string) => string;
|
|
32
|
+
export default extractPkceStorageKeyFromState;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { IdTokenPayload } from '../models/id-token';
|
|
19
|
+
/**
|
|
20
|
+
* Extracts the tenant domain from the ID token payload.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated since v1.0.6 — This utility assumes a legacy tenant extraction pattern from the `sub` claim,
|
|
23
|
+
* which may not be reliable. Will be removed in a future version.
|
|
24
|
+
*
|
|
25
|
+
* @param payload - The ID token payload containing the `sub` claim.
|
|
26
|
+
* @param subjectSeparator - The separator used in the `sub` claim to split the user identifier and tenant domain.
|
|
27
|
+
*
|
|
28
|
+
* Consider extracting the tenant domain using a dedicated claim (e.g., `tenant_domain`) when available.
|
|
29
|
+
*/
|
|
30
|
+
declare const extractTenantDomainFromIdTokenPayload: (payload: IdTokenPayload, subjectSeparator?: string) => string;
|
|
31
|
+
export default extractTenantDomainFromIdTokenPayload;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
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
|
+
import { IdTokenPayload } from '../models/id-token';
|
|
19
|
+
/**
|
|
20
|
+
* Removes standard protocol-specific claims from the ID token payload
|
|
21
|
+
* and returns a camelCased object of user-specific claims.
|
|
22
|
+
*
|
|
23
|
+
* @param payload The raw ID token payload.
|
|
24
|
+
* @returns A cleaned-up, camelCased object containing only user-specific claims.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ````typescript
|
|
28
|
+
* const idTokenPayload = {
|
|
29
|
+
* iss: 'https://example.com',
|
|
30
|
+
* aud: 'client_id',
|
|
31
|
+
* exp: 1712345678,
|
|
32
|
+
* iat: 1712345670,
|
|
33
|
+
* email: 'user@example.com'
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* const userClaims = extractUserClaimsFromIdToken(idTokenPayload);
|
|
37
|
+
* // // userClaims will be:
|
|
38
|
+
* // {
|
|
39
|
+
* // email: 'user@example.com'
|
|
40
|
+
* // }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const extractUserClaimsFromIdToken: (payload: IdTokenPayload) => Record<string, unknown>;
|
|
44
|
+
export default extractUserClaimsFromIdToken;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
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
|
+
import { TemporaryStore } from '../models/store';
|
|
19
|
+
/**
|
|
20
|
+
* Generates the next available PKCE storage key based on the current temporary data.
|
|
21
|
+
*
|
|
22
|
+
* The generated key will follow the format: `pkce_code_verifier_<index>`, where `<index>` is incremented
|
|
23
|
+
* based on the highest existing index in the provided storage object.
|
|
24
|
+
*
|
|
25
|
+
* @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).
|
|
26
|
+
*
|
|
27
|
+
* @returns A new unique PKCE storage key to store the next `code_verifier`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const key = generatePkceStorageKey(sessionStorage);
|
|
31
|
+
* // Returns: "pkce_code_verifier_3" (if existing keys are pkce_code_verifier_0 to _2)
|
|
32
|
+
*/
|
|
33
|
+
declare const generatePkceStorageKey: (tempStore: TemporaryStore) => string;
|
|
34
|
+
export default generatePkceStorageKey;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* Generates a state parameter for request correlation by combining an optional state string with a request index.
|
|
20
|
+
*
|
|
21
|
+
* @param pkceKey - The PKCE key containing the index (format: 'pkce_code_verifier_[index]').
|
|
22
|
+
* @param state - Optional state string to prepend to the request correlation.
|
|
23
|
+
* @returns A state parameter string in the format '[state_]request_[index]'.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const pkceKey = "pkce_code_verifier_1";
|
|
27
|
+
* const result = generateStateParamForRequestCorrelation(pkceKey, "myState");
|
|
28
|
+
* // Returns: "myState_request_1"
|
|
29
|
+
*
|
|
30
|
+
* const resultNoState = generateStateParamForRequestCorrelation(pkceKey);
|
|
31
|
+
* // Returns: "request_1"
|
|
32
|
+
*/
|
|
33
|
+
declare const generateStateParamForRequestCorrelation: (pkceKey: string, state?: string) => string;
|
|
34
|
+
export default generateStateParamForRequestCorrelation;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
* Removes a trailing slash from a path string if it exists.
|
|
20
|
+
*
|
|
21
|
+
* @param path - The string path to process
|
|
22
|
+
* @returns The path without a trailing slash
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* removeTrailingSlash('/path/to/something/') // returns '/path/to/something'
|
|
27
|
+
* removeTrailingSlash('/path/to/something') // returns '/path/to/something'
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const removeTrailingSlash: (path: string) => string;
|
|
31
|
+
export default removeTrailingSlash;
|