@asgardeo/javascript 0.1.3 → 0.1.5
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/dist/AsgardeoJavaScriptClient.d.ts +1 -0
- package/dist/__legacy__/models/client-config.d.ts +19 -6
- package/dist/cjs/index.js +28 -27
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +28 -27
- package/dist/index.js.map +2 -2
- package/dist/models/client.d.ts +10 -0
- package/dist/models/config.d.ts +26 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -823,8 +823,8 @@ var AuthenticationHelper = class {
|
|
|
823
823
|
(await this._config()).clientId,
|
|
824
824
|
issuer ?? "",
|
|
825
825
|
this._cryptoHelper.decodeIdToken(idToken).sub,
|
|
826
|
-
(await this._config()).clockTolerance,
|
|
827
|
-
(await this._config()).
|
|
826
|
+
(await this._config()).tokenValidation?.idToken?.clockTolerance,
|
|
827
|
+
(await this._config()).tokenValidation?.idToken?.validateIssuer ?? true
|
|
828
828
|
);
|
|
829
829
|
}
|
|
830
830
|
getAuthenticatedUserInfo(idToken) {
|
|
@@ -866,7 +866,7 @@ var AuthenticationHelper = class {
|
|
|
866
866
|
}
|
|
867
867
|
const parsedResponse = await response.json();
|
|
868
868
|
parsedResponse.created_at = (/* @__PURE__ */ new Date()).getTime();
|
|
869
|
-
const shouldValidateIdToken = (await this._config()).
|
|
869
|
+
const shouldValidateIdToken = (await this._config()).tokenValidation?.idToken?.validate;
|
|
870
870
|
if (shouldValidateIdToken) {
|
|
871
871
|
return this.validateIdToken(parsedResponse.id_token).then(async () => {
|
|
872
872
|
await this._storageManager.setSessionData(parsedResponse, userId);
|
|
@@ -965,12 +965,16 @@ var getAuthorizeRequestUrlParams_default = getAuthorizeRequestUrlParams;
|
|
|
965
965
|
|
|
966
966
|
// src/__legacy__/client.ts
|
|
967
967
|
var DefaultConfig = {
|
|
968
|
-
|
|
968
|
+
tokenValidation: {
|
|
969
|
+
idToken: {
|
|
970
|
+
validate: true,
|
|
971
|
+
validateIssuer: true,
|
|
972
|
+
clockTolerance: 300
|
|
973
|
+
}
|
|
974
|
+
},
|
|
969
975
|
enablePKCE: true,
|
|
970
976
|
responseMode: "query",
|
|
971
|
-
sendCookiesInRequests: true
|
|
972
|
-
validateIDToken: true,
|
|
973
|
-
validateIDTokenIssuer: true
|
|
977
|
+
sendCookiesInRequests: true
|
|
974
978
|
};
|
|
975
979
|
var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
976
980
|
/**
|
|
@@ -3451,32 +3455,29 @@ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
|
3451
3455
|
"The provided base URL does not conform to valid URL syntax."
|
|
3452
3456
|
);
|
|
3453
3457
|
}
|
|
3454
|
-
const
|
|
3455
|
-
if (!hostname.endsWith(".asgardeo.io")) {
|
|
3456
|
-
throw new AsgardeoRuntimeError(
|
|
3457
|
-
"Organization handle is required since a custom domain is configured.",
|
|
3458
|
-
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-001",
|
|
3459
|
-
"javascript",
|
|
3460
|
-
"The provided base URL uses a custom domain. Please provide the organizationHandle explicitly in the configuration."
|
|
3461
|
-
);
|
|
3462
|
-
}
|
|
3463
|
-
const pathSegments = parsedUrl.pathname.split("/").filter((segment) => segment.length > 0);
|
|
3458
|
+
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
3464
3459
|
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3460
|
+
console.warn(
|
|
3461
|
+
new AsgardeoRuntimeError(
|
|
3462
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3463
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002",
|
|
3464
|
+
"javascript",
|
|
3465
|
+
"The provided base URL does not follow the expected URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration."
|
|
3466
|
+
).toString()
|
|
3470
3467
|
);
|
|
3468
|
+
return "";
|
|
3471
3469
|
}
|
|
3472
3470
|
const organizationHandle = pathSegments[1];
|
|
3473
3471
|
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3472
|
+
console.warn(
|
|
3473
|
+
new AsgardeoRuntimeError(
|
|
3474
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3475
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003",
|
|
3476
|
+
"javascript",
|
|
3477
|
+
"The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration."
|
|
3478
|
+
).toString()
|
|
3479
3479
|
);
|
|
3480
|
+
return "";
|
|
3480
3481
|
}
|
|
3481
3482
|
return organizationHandle;
|
|
3482
3483
|
};
|