@nsshunt/ststestrunner 1.1.146 → 1.1.147
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/ststestrunner.cjs
CHANGED
|
@@ -37020,43 +37020,20 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
37020
37020
|
}
|
|
37021
37021
|
};
|
|
37022
37022
|
GetAccessToken = async () => {
|
|
37023
|
-
let timeout = void 0;
|
|
37024
37023
|
const start = performance.now();
|
|
37025
37024
|
try {
|
|
37026
37025
|
if (this.#accesssToken) return this.#accesssToken;
|
|
37027
|
-
const lockKey = "GetAccessToken";
|
|
37028
|
-
const lockTimeout = 6e4;
|
|
37029
|
-
if (this._lockHelper.GetOnHold(lockKey) === true) try {
|
|
37030
|
-
performance.now();
|
|
37031
|
-
await this._lockHelper.WaitOnHold(lockKey, lockTimeout);
|
|
37032
|
-
if (this.#accesssToken) return this.#accesssToken;
|
|
37033
|
-
else {
|
|
37034
|
-
this.Error(chalk.default.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
37035
|
-
this.Error(chalk.default.red(`GetAccessToken(): continue anyway ...`));
|
|
37036
|
-
}
|
|
37037
|
-
} catch (error) {
|
|
37038
|
-
this.Error(chalk.default.red(`GetAccessToken(): Error: [${error}]`));
|
|
37039
|
-
}
|
|
37040
|
-
this._lockHelper.SetOnHold(lockKey);
|
|
37041
|
-
timeout = setTimeout(() => {
|
|
37042
|
-
this.Warning(chalk.default.magenta(`GetAccessToken(): Timeout: [${this._authMaxTimeout}] exceeded for getting access token ...`));
|
|
37043
|
-
}, this._authMaxTimeout);
|
|
37044
37026
|
const scopes = `api://fb6513e4-16fe-4931-bed8-33b82b404a14/_.stsfhir5:All`.split(" ").sort().join(" ");
|
|
37045
37027
|
const authendpointUrl = `${this._options.authOptions.asendpoint}:${this._options.authOptions.asport}`;
|
|
37046
|
-
const
|
|
37028
|
+
const retVal = await this.GetAPITokenFromAuthServerUsingScope({
|
|
37047
37029
|
clientId: "d8277fce-bb48-44c2-bbf1-257fe13a444b",
|
|
37048
37030
|
authClientSecret: "64e3ef37-c7b8-4cb1-880a-e6ad3ab36e3c",
|
|
37049
37031
|
scope: scopes,
|
|
37050
37032
|
endPoint: authendpointUrl
|
|
37051
37033
|
});
|
|
37052
|
-
|
|
37053
|
-
const totalTime = performance.now() - start;
|
|
37054
|
-
if (totalTime > this._authMaxTimeout) this.Warning(chalk.default.magenta(`GetAccessToken(): The total time for getting the access token: [${totalTime}]`));
|
|
37055
|
-
this.#accesssToken = workingAaccesssToken;
|
|
37056
|
-
this._lockHelper.ReleaseOnHold(lockKey);
|
|
37034
|
+
this.#accesssToken = retVal;
|
|
37057
37035
|
return this.#accesssToken;
|
|
37058
37036
|
} catch (error) {
|
|
37059
|
-
if (timeout) clearTimeout(timeout);
|
|
37060
37037
|
error.message = `GetAccessToken(): Error: [${error}], Duration until error: [${performance.now() - start}]`;
|
|
37061
37038
|
this.Error(error);
|
|
37062
37039
|
return "";
|