@asgardeo/javascript 0.7.2 → 0.7.3
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/__legacy__/client.d.ts +1 -1
- package/dist/cjs/index.js +17 -12
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +17 -12
- package/dist/index.js.map +2 -2
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -957,12 +957,16 @@ var getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
|
|
|
957
957
|
}
|
|
958
958
|
});
|
|
959
959
|
}
|
|
960
|
+
const AUTH_INSTANCE_PREFIX = "instance_";
|
|
961
|
+
let customStateValue = "";
|
|
962
|
+
if (options.instanceId) {
|
|
963
|
+
customStateValue = AUTH_INSTANCE_PREFIX + options.instanceId;
|
|
964
|
+
} else if (customParams) {
|
|
965
|
+
customStateValue = customParams[OIDCRequestConstants_default.Params.STATE]?.toString() ?? "";
|
|
966
|
+
}
|
|
960
967
|
authorizeRequestParams.set(
|
|
961
968
|
OIDCRequestConstants_default.Params.STATE,
|
|
962
|
-
generateStateParamForRequestCorrelation_default(
|
|
963
|
-
pkceKey,
|
|
964
|
-
customParams ? customParams[OIDCRequestConstants_default.Params.STATE]?.toString() : ""
|
|
965
|
-
)
|
|
969
|
+
generateStateParamForRequestCorrelation_default(pkceKey, customStateValue)
|
|
966
970
|
);
|
|
967
971
|
return authorizeRequestParams;
|
|
968
972
|
};
|
|
@@ -1004,6 +1008,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1004
1008
|
__publicField(this, "authHelper");
|
|
1005
1009
|
__publicField(this, "cryptoUtils");
|
|
1006
1010
|
__publicField(this, "cryptoHelper");
|
|
1011
|
+
__publicField(this, "instanceIdValue");
|
|
1007
1012
|
}
|
|
1008
1013
|
/**
|
|
1009
1014
|
*
|
|
@@ -1026,18 +1031,18 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1026
1031
|
*/
|
|
1027
1032
|
async initialize(config, store, inputCryptoUtils, instanceID) {
|
|
1028
1033
|
const { clientId } = config;
|
|
1029
|
-
if (!
|
|
1030
|
-
|
|
1034
|
+
if (!this.instanceIdValue) {
|
|
1035
|
+
this.instanceIdValue = 0;
|
|
1031
1036
|
} else {
|
|
1032
|
-
|
|
1037
|
+
this.instanceIdValue += 1;
|
|
1033
1038
|
}
|
|
1034
1039
|
if (instanceID) {
|
|
1035
|
-
|
|
1040
|
+
this.instanceIdValue = instanceID;
|
|
1036
1041
|
}
|
|
1037
1042
|
if (!clientId) {
|
|
1038
|
-
this.storageManager = new StorageManager_default(`instance_${
|
|
1043
|
+
this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}`, store);
|
|
1039
1044
|
} else {
|
|
1040
|
-
this.storageManager = new StorageManager_default(`instance_${
|
|
1045
|
+
this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}-${clientId}`, store);
|
|
1041
1046
|
}
|
|
1042
1047
|
this.cryptoUtils = inputCryptoUtils;
|
|
1043
1048
|
this.cryptoHelper = new IsomorphicCrypto(inputCryptoUtils);
|
|
@@ -1082,7 +1087,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1082
1087
|
*/
|
|
1083
1088
|
// eslint-disable-next-line class-methods-use-this
|
|
1084
1089
|
getInstanceId() {
|
|
1085
|
-
return
|
|
1090
|
+
return this.instanceIdValue;
|
|
1086
1091
|
}
|
|
1087
1092
|
/**
|
|
1088
1093
|
* This is an async method that returns a Promise that resolves with the authorization URL.
|
|
@@ -1140,6 +1145,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1140
1145
|
clientId: configData.clientId,
|
|
1141
1146
|
codeChallenge,
|
|
1142
1147
|
codeChallengeMethod: PKCEConstants_default.DEFAULT_CODE_CHALLENGE_METHOD,
|
|
1148
|
+
instanceId: this.getInstanceId().toString(),
|
|
1143
1149
|
prompt: configData.prompt,
|
|
1144
1150
|
redirectUri: configData.afterSignInUrl,
|
|
1145
1151
|
responseMode: configData.responseMode,
|
|
@@ -1902,7 +1908,6 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1902
1908
|
await this.authHelperInstance.clearSession(userId);
|
|
1903
1909
|
}
|
|
1904
1910
|
};
|
|
1905
|
-
__publicField(_AsgardeoAuthClient, "instanceIdValue");
|
|
1906
1911
|
// FIXME: Validate this.
|
|
1907
1912
|
// Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205
|
|
1908
1913
|
__publicField(_AsgardeoAuthClient, "authHelperInstance");
|