@thunderid/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/dist/DefaultCacheStore.d.ts +31 -0
- package/dist/DefaultCacheStore.d.ts.map +1 -0
- package/dist/DefaultCrypto.d.ts +30 -0
- package/dist/DefaultCrypto.d.ts.map +1 -0
- package/dist/HttpClient.d.ts +65 -0
- package/dist/HttpClient.d.ts.map +1 -0
- package/dist/IsomorphicCrypto.d.ts +64 -0
- package/dist/IsomorphicCrypto.d.ts.map +1 -0
- package/dist/StorageManager.d.ts +66 -0
- package/dist/StorageManager.d.ts.map +1 -0
- package/dist/ThunderIDJavaScriptClient.d.ts +66 -0
- package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -0
- package/dist/__legacy__/client.d.ts +485 -0
- package/dist/__legacy__/client.d.ts.map +1 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts +38 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts.map +1 -0
- package/dist/__legacy__/helpers/index.d.ts +19 -0
- package/dist/__legacy__/helpers/index.d.ts.map +1 -0
- package/dist/__legacy__/models/client-config.d.ts +106 -0
- package/dist/__legacy__/models/client-config.d.ts.map +1 -0
- package/dist/__legacy__/models/index.d.ts +19 -0
- package/dist/__legacy__/models/index.d.ts.map +1 -0
- package/dist/api/createOrganization.d.ts +130 -0
- package/dist/api/createOrganization.d.ts.map +1 -0
- package/dist/api/executeEmbeddedSignInFlow.d.ts +22 -0
- package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -0
- package/dist/api/executeEmbeddedSignUpFlow.d.ts +45 -0
- package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -0
- package/dist/api/getAllOrganizations.d.ts +104 -0
- package/dist/api/getAllOrganizations.d.ts.map +1 -0
- package/dist/api/getBrandingPreference.d.ts +104 -0
- package/dist/api/getBrandingPreference.d.ts.map +1 -0
- package/dist/api/getMeOrganizations.d.ts +120 -0
- package/dist/api/getMeOrganizations.d.ts.map +1 -0
- package/dist/api/getOrganization.d.ts +110 -0
- package/dist/api/getOrganization.d.ts.map +1 -0
- package/dist/api/getSchemas.d.ts +90 -0
- package/dist/api/getSchemas.d.ts.map +1 -0
- package/dist/api/getScim2Me.d.ts +90 -0
- package/dist/api/getScim2Me.d.ts.map +1 -0
- package/dist/api/getUserInfo.d.ts +38 -0
- package/dist/api/getUserInfo.d.ts.map +1 -0
- package/dist/api/initializeEmbeddedSignInFlow.d.ts +52 -0
- package/dist/api/initializeEmbeddedSignInFlow.d.ts.map +1 -0
- package/dist/api/updateMeProfile.d.ts +83 -0
- package/dist/api/updateMeProfile.d.ts.map +1 -0
- package/dist/api/updateOrganization.d.ts +119 -0
- package/dist/api/updateOrganization.d.ts.map +1 -0
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts +57 -0
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts.map +1 -0
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts +22 -0
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts.map +1 -0
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts +22 -0
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts.map +1 -0
- package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts +89 -0
- package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts.map +1 -0
- package/dist/api/v2/getFlowMetaV2.d.ts +56 -0
- package/dist/api/v2/getFlowMetaV2.d.ts.map +1 -0
- package/dist/api/v2/getOrganizationUnitChildren.d.ts +43 -0
- package/dist/api/v2/getOrganizationUnitChildren.d.ts.map +1 -0
- package/dist/cjs/index.cjs +7693 -0
- package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +40 -0
- package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts.map +1 -0
- package/dist/constants/OIDCDiscoveryConstants.d.ts +65 -0
- package/dist/constants/OIDCDiscoveryConstants.d.ts.map +1 -0
- package/dist/constants/OIDCRequestConstants.d.ts +43 -0
- package/dist/constants/OIDCRequestConstants.d.ts.map +1 -0
- package/dist/constants/PKCEConstants.d.ts +45 -0
- package/dist/constants/PKCEConstants.d.ts.map +1 -0
- package/dist/constants/ScopeConstants.d.ts +43 -0
- package/dist/constants/ScopeConstants.d.ts.map +1 -0
- package/dist/constants/TokenConstants.d.ts +48 -0
- package/dist/constants/TokenConstants.d.ts.map +1 -0
- package/dist/constants/TokenExchangeConstants.d.ts +44 -0
- package/dist/constants/TokenExchangeConstants.d.ts.map +1 -0
- package/dist/constants/VendorConstants.d.ts +32 -0
- package/dist/constants/VendorConstants.d.ts.map +1 -0
- package/dist/constants/v2/OIDCDiscoveryConstants.d.ts +40 -0
- package/dist/constants/v2/OIDCDiscoveryConstants.d.ts.map +1 -0
- package/dist/edge/index.js +7568 -0
- package/dist/errors/ThunderIDAPIError.d.ts +59 -0
- package/dist/errors/ThunderIDAPIError.d.ts.map +1 -0
- package/dist/errors/ThunderIDError.d.ts +50 -0
- package/dist/errors/ThunderIDError.d.ts.map +1 -0
- package/dist/errors/ThunderIDRuntimeError.d.ts +51 -0
- package/dist/errors/ThunderIDRuntimeError.d.ts.map +1 -0
- package/dist/errors/exception.d.ts +27 -0
- package/dist/errors/exception.d.ts.map +1 -0
- package/dist/i18n/constants/TranslationBundleConstants.d.ts +35 -0
- package/dist/i18n/constants/TranslationBundleConstants.d.ts.map +1 -0
- package/dist/i18n/models/i18n.d.ts +127 -0
- package/dist/i18n/models/i18n.d.ts.map +1 -0
- package/dist/i18n/translations/en-US.d.ts +21 -0
- package/dist/i18n/translations/en-US.d.ts.map +1 -0
- package/dist/i18n/translations/fr-FR.d.ts +21 -0
- package/dist/i18n/translations/fr-FR.d.ts.map +1 -0
- package/dist/i18n/translations/hi-IN.d.ts +21 -0
- package/dist/i18n/translations/hi-IN.d.ts.map +1 -0
- package/dist/i18n/translations/index.d.ts +26 -0
- package/dist/i18n/translations/index.d.ts.map +1 -0
- package/dist/i18n/translations/ja-JP.d.ts +21 -0
- package/dist/i18n/translations/ja-JP.d.ts.map +1 -0
- package/dist/i18n/translations/pt-BR.d.ts +21 -0
- package/dist/i18n/translations/pt-BR.d.ts.map +1 -0
- package/dist/i18n/translations/pt-PT.d.ts +21 -0
- package/dist/i18n/translations/pt-PT.d.ts.map +1 -0
- package/dist/i18n/translations/si-LK.d.ts +21 -0
- package/dist/i18n/translations/si-LK.d.ts.map +1 -0
- package/dist/i18n/translations/ta-IN.d.ts +21 -0
- package/dist/i18n/translations/ta-IN.d.ts.map +1 -0
- package/dist/i18n/translations/te-IN.d.ts +21 -0
- package/dist/i18n/translations/te-IN.d.ts.map +1 -0
- package/dist/i18n/utils/getDefaultI18nBundles.d.ts +28 -0
- package/dist/i18n/utils/getDefaultI18nBundles.d.ts.map +1 -0
- package/dist/i18n/utils/normalizeTranslations.d.ts +42 -0
- package/dist/i18n/utils/normalizeTranslations.d.ts.map +1 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7568 -0
- package/dist/models/agent.d.ts +45 -0
- package/dist/models/agent.d.ts.map +1 -0
- package/dist/models/auth-code-response.d.ts +35 -0
- package/dist/models/auth-code-response.d.ts.map +1 -0
- package/dist/models/branding-preference.d.ts +249 -0
- package/dist/models/branding-preference.d.ts.map +1 -0
- package/dist/models/client.d.ts +213 -0
- package/dist/models/client.d.ts.map +1 -0
- package/dist/models/config.d.ts +483 -0
- package/dist/models/config.d.ts.map +1 -0
- package/dist/models/crypto.d.ts +101 -0
- package/dist/models/crypto.d.ts.map +1 -0
- package/dist/models/embedded-flow.d.ts +167 -0
- package/dist/models/embedded-flow.d.ts.map +1 -0
- package/dist/models/embedded-signin-flow.d.ts +100 -0
- package/dist/models/embedded-signin-flow.d.ts.map +1 -0
- package/dist/models/field.d.ts +32 -0
- package/dist/models/field.d.ts.map +1 -0
- package/dist/models/flow.d.ts +31 -0
- package/dist/models/flow.d.ts.map +1 -0
- package/dist/models/http.d.ts +46 -0
- package/dist/models/http.d.ts.map +1 -0
- package/dist/models/oauth-request.d.ts +24 -0
- package/dist/models/oauth-request.d.ts.map +1 -0
- package/dist/models/oauth-response.d.ts +19 -0
- package/dist/models/oauth-response.d.ts.map +1 -0
- package/dist/models/oidc-discovery.d.ts +370 -0
- package/dist/models/oidc-discovery.d.ts.map +1 -0
- package/dist/models/oidc-endpoints.d.ts +72 -0
- package/dist/models/oidc-endpoints.d.ts.map +1 -0
- package/dist/models/organization.d.ts +34 -0
- package/dist/models/organization.d.ts.map +1 -0
- package/dist/models/platforms.d.ts +38 -0
- package/dist/models/platforms.d.ts.map +1 -0
- package/dist/models/scim2-schema.d.ts +66 -0
- package/dist/models/scim2-schema.d.ts.map +1 -0
- package/dist/models/session.d.ts +32 -0
- package/dist/models/session.d.ts.map +1 -0
- package/dist/models/store.d.ts +84 -0
- package/dist/models/store.d.ts.map +1 -0
- package/dist/models/token-endpoint-auth.d.ts +30 -0
- package/dist/models/token-endpoint-auth.d.ts.map +1 -0
- package/dist/models/token.d.ts +181 -0
- package/dist/models/token.d.ts.map +1 -0
- package/dist/models/user.d.ts +34 -0
- package/dist/models/user.d.ts.map +1 -0
- package/dist/models/utility-types.d.ts +21 -0
- package/dist/models/utility-types.d.ts.map +1 -0
- package/dist/models/v2/embedded-flow-v2.d.ts +494 -0
- package/dist/models/v2/embedded-flow-v2.d.ts.map +1 -0
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts +143 -0
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts.map +1 -0
- package/dist/models/v2/embedded-signin-flow-v2.d.ts +340 -0
- package/dist/models/v2/embedded-signin-flow-v2.d.ts.map +1 -0
- package/dist/models/v2/embedded-signup-flow-v2.d.ts +272 -0
- package/dist/models/v2/embedded-signup-flow-v2.d.ts.map +1 -0
- package/dist/models/v2/extensions/components.d.ts +89 -0
- package/dist/models/v2/extensions/components.d.ts.map +1 -0
- package/dist/models/v2/flow-meta-v2.d.ts +299 -0
- package/dist/models/v2/flow-meta-v2.d.ts.map +1 -0
- package/dist/models/v2/organization-unit.d.ts +103 -0
- package/dist/models/v2/organization-unit.d.ts.map +1 -0
- package/dist/models/v2/translation.d.ts +35 -0
- package/dist/models/v2/translation.d.ts.map +1 -0
- package/dist/models/v2/vars.d.ts +36 -0
- package/dist/models/v2/vars.d.ts.map +1 -0
- package/dist/theme/createTheme.d.ts +23 -0
- package/dist/theme/createTheme.d.ts.map +1 -0
- package/dist/theme/types.d.ts +381 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/utils/arrayBufferToBase64url.d.ts +49 -0
- package/dist/utils/arrayBufferToBase64url.d.ts.map +1 -0
- package/dist/utils/base64Encode.d.ts +36 -0
- package/dist/utils/base64Encode.d.ts.map +1 -0
- package/dist/utils/base64urlToArrayBuffer.d.ts +56 -0
- package/dist/utils/base64urlToArrayBuffer.d.ts.map +1 -0
- package/dist/utils/bem.d.ts +47 -0
- package/dist/utils/bem.d.ts.map +1 -0
- package/dist/utils/deepMerge.d.ts +45 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +48 -0
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts.map +1 -0
- package/dist/utils/extractPkceStorageKeyFromState.d.ts +33 -0
- package/dist/utils/extractPkceStorageKeyFromState.d.ts.map +1 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +32 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts.map +1 -0
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +47 -0
- package/dist/utils/extractUserClaimsFromIdToken.d.ts.map +1 -0
- package/dist/utils/flattenUserSchema.d.ts +65 -0
- package/dist/utils/flattenUserSchema.d.ts.map +1 -0
- package/dist/utils/formatDate.d.ts +34 -0
- package/dist/utils/formatDate.d.ts.map +1 -0
- package/dist/utils/generateFlattenedUserProfile.d.ts +54 -0
- package/dist/utils/generateFlattenedUserProfile.d.ts.map +1 -0
- package/dist/utils/generatePkceStorageKey.d.ts +35 -0
- package/dist/utils/generatePkceStorageKey.d.ts.map +1 -0
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts +35 -0
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts.map +1 -0
- package/dist/utils/generateUserProfile.d.ts +56 -0
- package/dist/utils/generateUserProfile.d.ts.map +1 -0
- package/dist/utils/get.d.ts +30 -0
- package/dist/utils/get.d.ts.map +1 -0
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts +61 -0
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts.map +1 -0
- package/dist/utils/getLatestStateParam.d.ts +41 -0
- package/dist/utils/getLatestStateParam.d.ts.map +1 -0
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts +30 -0
- package/dist/utils/getRedirectBasedSignUpUrl.d.ts.map +1 -0
- package/dist/utils/identifyPlatform.d.ts +31 -0
- package/dist/utils/identifyPlatform.d.ts.map +1 -0
- package/dist/utils/isEmpty.d.ts +49 -0
- package/dist/utils/isEmpty.d.ts.map +1 -0
- package/dist/utils/isRecognizedBaseUrlPattern.d.ts +33 -0
- package/dist/utils/isRecognizedBaseUrlPattern.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +143 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/parseApiErrorMessage.d.ts +29 -0
- package/dist/utils/parseApiErrorMessage.d.ts.map +1 -0
- package/dist/utils/processOpenIDScopes.d.ts +42 -0
- package/dist/utils/processOpenIDScopes.d.ts.map +1 -0
- package/dist/utils/processUsername.d.ts +74 -0
- package/dist/utils/processUsername.d.ts.map +1 -0
- package/dist/utils/removeTrailingSlash.d.ts +32 -0
- package/dist/utils/removeTrailingSlash.d.ts.map +1 -0
- package/dist/utils/resolveFieldName.d.ts +20 -0
- package/dist/utils/resolveFieldName.d.ts.map +1 -0
- package/dist/utils/resolveFieldType.d.ts +21 -0
- package/dist/utils/resolveFieldType.d.ts.map +1 -0
- package/dist/utils/set.d.ts +31 -0
- package/dist/utils/set.d.ts.map +1 -0
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts +49 -0
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts.map +1 -0
- package/dist/utils/v2/containsMetaFlowTemplateLiteral.d.ts +57 -0
- package/dist/utils/v2/containsMetaFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/v2/countryCodeToFlagEmoji.d.ts +26 -0
- package/dist/utils/v2/countryCodeToFlagEmoji.d.ts.map +1 -0
- package/dist/utils/v2/extractEmojiFromUri.d.ts +32 -0
- package/dist/utils/v2/extractEmojiFromUri.d.ts.map +1 -0
- package/dist/utils/v2/isEmojiUri.d.ts +34 -0
- package/dist/utils/v2/isEmojiUri.d.ts.map +1 -0
- package/dist/utils/v2/isMetaFlowTemplateLiteral.d.ts +45 -0
- package/dist/utils/v2/isMetaFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/v2/isTranslationFlowTemplateLiteral.d.ts +45 -0
- package/dist/utils/v2/isTranslationFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/v2/parseFlowTemplateLiteral.d.ts +96 -0
- package/dist/utils/v2/parseFlowTemplateLiteral.d.ts.map +1 -0
- package/dist/utils/v2/resolveFlowTemplateLiterals.d.ts +42 -0
- package/dist/utils/v2/resolveFlowTemplateLiterals.d.ts.map +1 -0
- package/dist/utils/v2/resolveLocaleDisplayName.d.ts +30 -0
- package/dist/utils/v2/resolveLocaleDisplayName.d.ts.map +1 -0
- package/dist/utils/v2/resolveLocaleEmoji.d.ts +31 -0
- package/dist/utils/v2/resolveLocaleEmoji.d.ts.map +1 -0
- package/dist/utils/v2/resolveMeta.d.ts +35 -0
- package/dist/utils/v2/resolveMeta.d.ts.map +1 -0
- package/dist/utils/withVendorCSSClassPrefix.d.ts +33 -0
- package/dist/utils/withVendorCSSClassPrefix.d.ts.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,48 @@
|
|
|
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 organization handle from an ThunderID base URL.
|
|
20
|
+
*
|
|
21
|
+
* This function parses ThunderID URLs with the standard pattern:
|
|
22
|
+
* - https://dev.asgardeo.io/t/{orgHandle}
|
|
23
|
+
* - https://stage.asgardeo.io/t/{orgHandle}
|
|
24
|
+
* - https://prod.asgardeo.io/t/{orgHandle}
|
|
25
|
+
* - https://{subdomain}.asgardeo.io/t/{orgHandle}
|
|
26
|
+
*
|
|
27
|
+
* @param baseUrl - The base URL of the ThunderID identity server
|
|
28
|
+
* @returns The extracted organization handle
|
|
29
|
+
* @throws {ThunderIDRuntimeError} When the URL doesn't match the expected ThunderID pattern,
|
|
30
|
+
* indicating a custom domain is configured and organizationHandle must be provided explicitly
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Standard ThunderID URLs
|
|
35
|
+
* const handle1 = deriveOrganizationHandleFromBaseUrl('https://dev.asgardeo.io/t/dxlab');
|
|
36
|
+
* // Returns: 'dxlab'
|
|
37
|
+
*
|
|
38
|
+
* const handle2 = deriveOrganizationHandleFromBaseUrl('https://stage.asgardeo.io/t/myorg');
|
|
39
|
+
* // Returns: 'myorg'
|
|
40
|
+
*
|
|
41
|
+
* // Custom domain - returns empty string with a warning
|
|
42
|
+
* const handle2 = deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');
|
|
43
|
+
* // Returns: '' and logs a warning
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const deriveOrganizationHandleFromBaseUrl: (baseUrl?: string) => string;
|
|
47
|
+
export default deriveOrganizationHandleFromBaseUrl;
|
|
48
|
+
//# sourceMappingURL=deriveOrganizationHandleFromBaseUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveOrganizationHandleFromBaseUrl.d.ts","sourceRoot":"","sources":["../../src/utils/deriveOrganizationHandleFromBaseUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,mCAAmC,GAAI,UAAU,MAAM,KAAG,MAuD/D,CAAC;AAEF,eAAe,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
33
|
+
//# sourceMappingURL=extractPkceStorageKeyFromState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractPkceStorageKeyFromState.d.ts","sourceRoot":"","sources":["../../src/utils/extractPkceStorageKeyFromState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,8BAA8B,GAAI,OAAO,MAAM,KAAG,MAIvD,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
|
|
@@ -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
|
+
import { IdToken } from '../models/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: IdToken, subjectSeparator?: string) => string;
|
|
31
|
+
export default extractTenantDomainFromIdTokenPayload;
|
|
32
|
+
//# sourceMappingURL=extractTenantDomainFromIdTokenPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractTenantDomainFromIdTokenPayload.d.ts","sourceRoot":"","sources":["../../src/utils/extractTenantDomainFromIdTokenPayload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAExC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,qCAAqC,GAAI,SAAS,OAAO,EAAE,yBAAsB,KAAG,MASzF,CAAC;AAEF,eAAe,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { IdToken } from '../models/token';
|
|
19
|
+
/**
|
|
20
|
+
* Removes standard protocol-specific claims from the ID token payload
|
|
21
|
+
* and returns an object of user-specific claims with original attribute names preserved.
|
|
22
|
+
*
|
|
23
|
+
* @param payload The raw ID token payload.
|
|
24
|
+
* @returns A cleaned-up object containing only user-specific claims with original attribute names.
|
|
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
|
+
* given_name: 'John'
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* const userClaims = extractUserClaimsFromIdToken(idTokenPayload);
|
|
38
|
+
* // userClaims will be:
|
|
39
|
+
* // {
|
|
40
|
+
* // email: 'user@example.com',
|
|
41
|
+
* // given_name: 'John'
|
|
42
|
+
* // }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const extractUserClaimsFromIdToken: (payload: IdToken) => Record<string, unknown>;
|
|
46
|
+
export default extractUserClaimsFromIdToken;
|
|
47
|
+
//# sourceMappingURL=extractUserClaimsFromIdToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractUserClaimsFromIdToken.d.ts","sourceRoot":"","sources":["../../src/utils/extractUserClaimsFromIdToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,4BAA4B,GAAI,SAAS,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA2B9E,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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, FlattenedSchema } from '../models/scim2-schema';
|
|
19
|
+
/**
|
|
20
|
+
* Flattens nested schema attributes into a flat structure for easier processing
|
|
21
|
+
*
|
|
22
|
+
* This function processes SCIM2 schemas and creates a flattened representation by:
|
|
23
|
+
* - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')
|
|
24
|
+
* - Adding schema ID reference to each flattened attribute
|
|
25
|
+
* - Preserving all original attribute properties while adding schema context
|
|
26
|
+
* - Only including leaf-level attributes (sub-attributes) and top-level simple attributes
|
|
27
|
+
*
|
|
28
|
+
* @param schemas - Array of SCIM2 schemas containing nested attribute structures
|
|
29
|
+
* @returns Array of flattened schema attributes with dot-notation names and schema references
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const schemas = [
|
|
34
|
+
* {
|
|
35
|
+
* id: 'urn:ietf:params:scim:schemas:core:2.0:User',
|
|
36
|
+
* attributes: [
|
|
37
|
+
* {
|
|
38
|
+
* name: 'userName',
|
|
39
|
+
* type: 'string',
|
|
40
|
+
* multiValued: false
|
|
41
|
+
* },
|
|
42
|
+
* {
|
|
43
|
+
* name: 'name',
|
|
44
|
+
* type: 'complex',
|
|
45
|
+
* multiValued: false,
|
|
46
|
+
* subAttributes: [
|
|
47
|
+
* { name: 'givenName', type: 'string', multiValued: false },
|
|
48
|
+
* { name: 'familyName', type: 'string', multiValued: false }
|
|
49
|
+
* ]
|
|
50
|
+
* }
|
|
51
|
+
* ]
|
|
52
|
+
* }
|
|
53
|
+
* ];
|
|
54
|
+
*
|
|
55
|
+
* const flattened = flattenUserSchema(schemas);
|
|
56
|
+
* // Result: [
|
|
57
|
+
* // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
|
|
58
|
+
* // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
|
|
59
|
+
* // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }
|
|
60
|
+
* // ]
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const flattenUserSchema: (schemas: Schema[]) => FlattenedSchema[];
|
|
64
|
+
export default flattenUserSchema;
|
|
65
|
+
//# sourceMappingURL=flattenUserSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenUserSchema.d.ts","sourceRoot":"","sources":["../../src/utils/flattenUserSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,QAAA,MAAM,iBAAiB,GAAI,SAAS,MAAM,EAAE,KAAG,eAAe,EA2B7D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -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
|
+
* Formats a date string to a human-readable format.
|
|
20
|
+
*
|
|
21
|
+
* @param dateString - The date string to format (optional)
|
|
22
|
+
* @returns A formatted date string in 'Month Day, Year' format, or '-' if no date is provided, or the original string if parsing fails
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* formatDate('2025-07-09T10:30:00Z'); // Returns "July 9, 2025"
|
|
27
|
+
* formatDate(''); // Returns "-"
|
|
28
|
+
* formatDate(undefined); // Returns "-"
|
|
29
|
+
* formatDate('invalid-date'); // Returns "invalid-date"
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const formatDate: (dateString?: string) => string;
|
|
33
|
+
export default formatDate;
|
|
34
|
+
//# sourceMappingURL=formatDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/utils/formatDate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,UAAU,GAAI,aAAa,MAAM,KAAG,MAYzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { User } from '../models/user';
|
|
19
|
+
/**
|
|
20
|
+
* Generates a flattened user profile from a response object and schema definitions.
|
|
21
|
+
*
|
|
22
|
+
* This function processes user data according to schema specifications, creating
|
|
23
|
+
* a flat object with dot notation keys instead of nested objects. Multi-valued
|
|
24
|
+
* properties and type-specific defaults are handled appropriately.
|
|
25
|
+
*
|
|
26
|
+
* Additionally, any fields present in the response but not defined in the schema
|
|
27
|
+
* will be included to ensure no user data is lost during flattening.
|
|
28
|
+
*
|
|
29
|
+
* @param meResponse - The response object containing user data
|
|
30
|
+
* @param processedSchemas - Array of schema objects defining field properties
|
|
31
|
+
* @param processedSchemas[].name - The field name/path for the property
|
|
32
|
+
* @param processedSchemas[].type - The data type of the field (e.g., 'STRING')
|
|
33
|
+
* @param processedSchemas[].multiValued - Whether the field can contain multiple values
|
|
34
|
+
*
|
|
35
|
+
* @returns A flattened user profile object with dot notation keys
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const schemas = [
|
|
40
|
+
* { name: 'name.givenName', type: 'STRING', multiValued: false },
|
|
41
|
+
* { name: 'emails', type: 'STRING', multiValued: true }
|
|
42
|
+
* ];
|
|
43
|
+
* const response = {
|
|
44
|
+
* name: { givenName: 'John' },
|
|
45
|
+
* emails: 'john@example.com',
|
|
46
|
+
* country: 'US' // This will be included even if not in schema
|
|
47
|
+
* };
|
|
48
|
+
* const profile = generateFlattenedUserProfile(response, schemas);
|
|
49
|
+
* // Result: { "name.givenName": 'John', emails: ['john@example.com'], country: 'US' }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare const generateFlattenedUserProfile: (meResponse: any, processedSchemas: any[]) => User;
|
|
53
|
+
export default generateFlattenedUserProfile;
|
|
54
|
+
//# sourceMappingURL=generateFlattenedUserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFlattenedUserProfile.d.ts","sourceRoot":"","sources":["../../src/utils/generateFlattenedUserProfile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,4BAA4B,GAAI,YAAY,GAAG,EAAE,kBAAkB,GAAG,EAAE,KAAG,IAuHhF,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
35
|
+
//# sourceMappingURL=generatePkceStorageKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePkceStorageKey.d.ts","sourceRoot":"","sources":["../../src/utils/generatePkceStorageKey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,sBAAsB,GAAI,WAAW,cAAc,KAAG,MAa3D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
35
|
+
//# sourceMappingURL=generateStateParamForRequestCorrelation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateStateParamForRequestCorrelation.d.ts","sourceRoot":"","sources":["../../src/utils/generateStateParamForRequestCorrelation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,uCAAuC,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,MAIlF,CAAC;AAEF,eAAe,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { User } from '../models/user';
|
|
19
|
+
/**
|
|
20
|
+
* Creates a profile structure from ME response based on processed schemas
|
|
21
|
+
*
|
|
22
|
+
* This function processes each schema attribute and populates the profile dynamically by:
|
|
23
|
+
* - Extracting values from the ME response using the schema attribute names
|
|
24
|
+
* - Handling multi-valued attributes by converting single values to arrays when needed
|
|
25
|
+
* - Setting appropriate default values based on schema type and multiValued properties
|
|
26
|
+
* - Using dynamic property setting to build the final profile object
|
|
27
|
+
*
|
|
28
|
+
* @param meResponse - The ME API response containing user data
|
|
29
|
+
* @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties
|
|
30
|
+
* @returns Flat profile object with dynamically populated user attributes
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const meResponse = {
|
|
35
|
+
* userName: 'john.doe',
|
|
36
|
+
* emails: ['john@example.com', 'john.doe@work.com'],
|
|
37
|
+
* name: { givenName: 'John', familyName: 'Doe' }
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* const schemas = [
|
|
41
|
+
* { name: 'userName', type: 'STRING', multiValued: false },
|
|
42
|
+
* { name: 'emails', type: 'STRING', multiValued: true },
|
|
43
|
+
* { name: 'name.givenName', type: 'STRING', multiValued: false }
|
|
44
|
+
* ];
|
|
45
|
+
*
|
|
46
|
+
* const profile = generateUserProfile(meResponse, schemas);
|
|
47
|
+
* // Result: {
|
|
48
|
+
* // userName: 'john.doe',
|
|
49
|
+
* // emails: ['john@example.com', 'john.doe@work.com'],
|
|
50
|
+
* // 'name.givenName': 'John'
|
|
51
|
+
* // }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const generateUserProfile: (meResponse: any, processedSchemas: any[]) => User;
|
|
55
|
+
export default generateUserProfile;
|
|
56
|
+
//# sourceMappingURL=generateUserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateUserProfile.d.ts","sourceRoot":"","sources":["../../src/utils/generateUserProfile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,QAAA,MAAM,mBAAmB,GAAI,YAAY,GAAG,EAAE,kBAAkB,GAAG,EAAE,KAAG,IA0BvE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
* Gets the value at path of object. If the resolved value is undefined,
|
|
20
|
+
* the defaultValue is returned in its place.
|
|
21
|
+
* Similar to Lodash's get() function
|
|
22
|
+
*
|
|
23
|
+
* @param object - The object to query
|
|
24
|
+
* @param path - The path of the property to get
|
|
25
|
+
* @param defaultValue - The value returned for undefined resolved values
|
|
26
|
+
* @returns The resolved value
|
|
27
|
+
*/
|
|
28
|
+
declare const get: (object: any, path: string | string[], defaultValue?: any) => any;
|
|
29
|
+
export default get;
|
|
30
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/utils/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;GASG;AACH,QAAA,MAAM,GAAG,GAAI,QAAQ,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,eAAe,GAAG,KAAG,GAQvE,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { ExtendedAuthorizeRequestUrlParams } from '../models/oauth-request';
|
|
19
|
+
/**
|
|
20
|
+
* Generates a map of authorization request URL parameters for OIDC authorization requests.
|
|
21
|
+
*
|
|
22
|
+
* This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,
|
|
23
|
+
* and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.
|
|
24
|
+
*
|
|
25
|
+
* @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and prompt.
|
|
26
|
+
* @param pkceOptions - PKCE options, including the PKCE key for state correlation.
|
|
27
|
+
* @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).
|
|
28
|
+
* @returns A Map of key-value pairs representing the authorization request URL parameters.
|
|
29
|
+
*
|
|
30
|
+
* @throws {ThunderIDRuntimeError} If a code challenge is provided without a code challenge method.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const params = getAuthorizeRequestUrlParams({
|
|
34
|
+
* options: {
|
|
35
|
+
* redirectUri: 'https://app/callback',
|
|
36
|
+
* clientId: 'client123',
|
|
37
|
+
* scope: ['openid', 'profile'],
|
|
38
|
+
* responseMode: 'query',
|
|
39
|
+
* codeChallenge: 'abc',
|
|
40
|
+
* codeChallengeMethod: 'S256',
|
|
41
|
+
* prompt: 'login'
|
|
42
|
+
* },
|
|
43
|
+
* pkceOptions: { key: 'pkce_code_verifier_1' },
|
|
44
|
+
* customParams: { foo: 'bar' }
|
|
45
|
+
* });
|
|
46
|
+
* // Returns a Map with all required OIDC params, PKCE, and custom params.
|
|
47
|
+
*/
|
|
48
|
+
declare const getAuthorizeRequestUrlParams: (options: {
|
|
49
|
+
clientId: string;
|
|
50
|
+
codeChallenge?: string;
|
|
51
|
+
codeChallengeMethod?: string;
|
|
52
|
+
instanceId?: string;
|
|
53
|
+
prompt?: string;
|
|
54
|
+
redirectUri: string;
|
|
55
|
+
responseMode?: string;
|
|
56
|
+
scopes?: string;
|
|
57
|
+
} & ExtendedAuthorizeRequestUrlParams, pkceOptions: {
|
|
58
|
+
key: string;
|
|
59
|
+
}, customParams: Record<string, string | number | boolean>) => Map<string, string>;
|
|
60
|
+
export default getAuthorizeRequestUrlParams;
|
|
61
|
+
//# sourceMappingURL=getAuthorizeRequestUrlParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAuthorizeRequestUrlParams.d.ts","sourceRoot":"","sources":["../../src/utils/getAuthorizeRequestUrlParams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAC,iCAAiC,EAAC,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,4BAA4B,GAChC,SAAS;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iCAAiC,EACrC,aAAa;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,EAC1B,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KACtD,GAAG,CAAC,MAAM,EAAE,MAAM,CA0DpB,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* Finds the latest state parameter based on the most recent PKCE storage key.
|
|
21
|
+
*
|
|
22
|
+
* This utility combines the functionality of finding the latest PKCE key and generating
|
|
23
|
+
* the corresponding state parameter for request correlation.
|
|
24
|
+
*
|
|
25
|
+
* @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).
|
|
26
|
+
* @param state - Optional state string to prepend to the request correlation.
|
|
27
|
+
* @returns The latest state parameter string or null if no PKCE keys exist.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const latestState = getLatestStateParam(sessionStorage, "myState");
|
|
31
|
+
* // Returns: "myState_request_2" (if latest PKCE key is pkce_code_verifier_2)
|
|
32
|
+
*
|
|
33
|
+
* const latestStateNoPrefix = getLatestStateParam(sessionStorage);
|
|
34
|
+
* // Returns: "request_2" (if latest PKCE key is pkce_code_verifier_2)
|
|
35
|
+
*
|
|
36
|
+
* const noKeys = getLatestStateParam(emptyStorage);
|
|
37
|
+
* // Returns: null (if no PKCE keys exist)
|
|
38
|
+
*/
|
|
39
|
+
declare const getLatestStateParam: (tempStore: TemporaryStore, state?: string) => string | null;
|
|
40
|
+
export default getLatestStateParam;
|
|
41
|
+
//# sourceMappingURL=getLatestStateParam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLatestStateParam.d.ts","sourceRoot":"","sources":["../../src/utils/getLatestStateParam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAsB/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,mBAAmB,GAAI,WAAW,cAAc,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,IAQjF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|