@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
|
@@ -35,7 +35,7 @@ export declare class AsgardeoAuthClient<T> {
|
|
|
35
35
|
private authHelper;
|
|
36
36
|
private cryptoUtils;
|
|
37
37
|
private cryptoHelper;
|
|
38
|
-
private
|
|
38
|
+
private instanceIdValue;
|
|
39
39
|
static authHelperInstance: any;
|
|
40
40
|
/**
|
|
41
41
|
* This is the constructor method that returns an instance of the .
|
package/dist/cjs/index.js
CHANGED
|
@@ -1067,12 +1067,16 @@ var getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
|
+
const AUTH_INSTANCE_PREFIX = "instance_";
|
|
1071
|
+
let customStateValue = "";
|
|
1072
|
+
if (options.instanceId) {
|
|
1073
|
+
customStateValue = AUTH_INSTANCE_PREFIX + options.instanceId;
|
|
1074
|
+
} else if (customParams) {
|
|
1075
|
+
customStateValue = customParams[OIDCRequestConstants_default.Params.STATE]?.toString() ?? "";
|
|
1076
|
+
}
|
|
1070
1077
|
authorizeRequestParams.set(
|
|
1071
1078
|
OIDCRequestConstants_default.Params.STATE,
|
|
1072
|
-
generateStateParamForRequestCorrelation_default(
|
|
1073
|
-
pkceKey,
|
|
1074
|
-
customParams ? customParams[OIDCRequestConstants_default.Params.STATE]?.toString() : ""
|
|
1075
|
-
)
|
|
1079
|
+
generateStateParamForRequestCorrelation_default(pkceKey, customStateValue)
|
|
1076
1080
|
);
|
|
1077
1081
|
return authorizeRequestParams;
|
|
1078
1082
|
};
|
|
@@ -1114,6 +1118,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1114
1118
|
__publicField(this, "authHelper");
|
|
1115
1119
|
__publicField(this, "cryptoUtils");
|
|
1116
1120
|
__publicField(this, "cryptoHelper");
|
|
1121
|
+
__publicField(this, "instanceIdValue");
|
|
1117
1122
|
}
|
|
1118
1123
|
/**
|
|
1119
1124
|
*
|
|
@@ -1136,18 +1141,18 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1136
1141
|
*/
|
|
1137
1142
|
async initialize(config, store, inputCryptoUtils, instanceID) {
|
|
1138
1143
|
const { clientId } = config;
|
|
1139
|
-
if (!
|
|
1140
|
-
|
|
1144
|
+
if (!this.instanceIdValue) {
|
|
1145
|
+
this.instanceIdValue = 0;
|
|
1141
1146
|
} else {
|
|
1142
|
-
|
|
1147
|
+
this.instanceIdValue += 1;
|
|
1143
1148
|
}
|
|
1144
1149
|
if (instanceID) {
|
|
1145
|
-
|
|
1150
|
+
this.instanceIdValue = instanceID;
|
|
1146
1151
|
}
|
|
1147
1152
|
if (!clientId) {
|
|
1148
|
-
this.storageManager = new StorageManager_default(`instance_${
|
|
1153
|
+
this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}`, store);
|
|
1149
1154
|
} else {
|
|
1150
|
-
this.storageManager = new StorageManager_default(`instance_${
|
|
1155
|
+
this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}-${clientId}`, store);
|
|
1151
1156
|
}
|
|
1152
1157
|
this.cryptoUtils = inputCryptoUtils;
|
|
1153
1158
|
this.cryptoHelper = new IsomorphicCrypto(inputCryptoUtils);
|
|
@@ -1192,7 +1197,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1192
1197
|
*/
|
|
1193
1198
|
// eslint-disable-next-line class-methods-use-this
|
|
1194
1199
|
getInstanceId() {
|
|
1195
|
-
return
|
|
1200
|
+
return this.instanceIdValue;
|
|
1196
1201
|
}
|
|
1197
1202
|
/**
|
|
1198
1203
|
* This is an async method that returns a Promise that resolves with the authorization URL.
|
|
@@ -1250,6 +1255,7 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1250
1255
|
clientId: configData.clientId,
|
|
1251
1256
|
codeChallenge,
|
|
1252
1257
|
codeChallengeMethod: PKCEConstants_default.DEFAULT_CODE_CHALLENGE_METHOD,
|
|
1258
|
+
instanceId: this.getInstanceId().toString(),
|
|
1253
1259
|
prompt: configData.prompt,
|
|
1254
1260
|
redirectUri: configData.afterSignInUrl,
|
|
1255
1261
|
responseMode: configData.responseMode,
|
|
@@ -2012,7 +2018,6 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
2012
2018
|
await this.authHelperInstance.clearSession(userId);
|
|
2013
2019
|
}
|
|
2014
2020
|
};
|
|
2015
|
-
__publicField(_AsgardeoAuthClient, "instanceIdValue");
|
|
2016
2021
|
// FIXME: Validate this.
|
|
2017
2022
|
// Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205
|
|
2018
2023
|
__publicField(_AsgardeoAuthClient, "authHelperInstance");
|