@nsshunt/stsoauth2plugin 1.0.169 → 1.0.171
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/index.cjs +37 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
- package/types/commonTypes.d.ts +26 -0
- package/types/commonTypes.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/stsoauth2manager.d.ts.map +1 -1
- package/types/stsoauth2worker.d.ts.map +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,6 @@ let vue = require("vue");
|
|
|
26
26
|
let node_worker_threads = require("node:worker_threads");
|
|
27
27
|
node_worker_threads = __toESM(node_worker_threads);
|
|
28
28
|
let _nsshunt_stsutils = require("@nsshunt/stsutils");
|
|
29
|
-
let _nsshunt_stsauthclient = require("@nsshunt/stsauthclient");
|
|
30
29
|
let _nsshunt_stsvueutils = require("@nsshunt/stsvueutils");
|
|
31
30
|
let pinia = require("pinia");
|
|
32
31
|
let _nsshunt_stsinstrumentmanagerclient = require("@nsshunt/stsinstrumentmanagerclient");
|
|
@@ -375,6 +374,34 @@ Object.defineProperties(createChalk.prototype, styles);
|
|
|
375
374
|
var chalk = createChalk();
|
|
376
375
|
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
377
376
|
//#endregion
|
|
377
|
+
//#region src/commonTypes.ts
|
|
378
|
+
var OAuth2ParameterType = /* @__PURE__ */ function(OAuth2ParameterType) {
|
|
379
|
+
OAuth2ParameterType["AUDIENCE"] = "AUDIENCE";
|
|
380
|
+
OAuth2ParameterType["CLIENT_ID"] = "client_id";
|
|
381
|
+
OAuth2ParameterType["CLIENT_SECRET"] = "client_secret";
|
|
382
|
+
OAuth2ParameterType["RESPONSE_TYPE"] = "response_type";
|
|
383
|
+
OAuth2ParameterType["SCOPE"] = "scope";
|
|
384
|
+
OAuth2ParameterType["STATE"] = "state";
|
|
385
|
+
OAuth2ParameterType["REDIRECT_URI"] = "redirect_uri";
|
|
386
|
+
OAuth2ParameterType["ERROR"] = "error";
|
|
387
|
+
OAuth2ParameterType["ERROR_DESCRIPTION"] = "error_description";
|
|
388
|
+
OAuth2ParameterType["ERROR_CODES"] = "error_codes";
|
|
389
|
+
OAuth2ParameterType["ERROR_URI"] = "error_uri";
|
|
390
|
+
OAuth2ParameterType["GRANT_TYPE"] = "grant_type";
|
|
391
|
+
OAuth2ParameterType["CODE"] = "code";
|
|
392
|
+
OAuth2ParameterType["ACCESS_TOKEN"] = "access_token";
|
|
393
|
+
OAuth2ParameterType["TOKEN_TYPE"] = "token_type";
|
|
394
|
+
OAuth2ParameterType["EXPIRES_IN"] = "expires_in";
|
|
395
|
+
OAuth2ParameterType["USERNAME"] = "username";
|
|
396
|
+
OAuth2ParameterType["PASSWORD"] = "password";
|
|
397
|
+
OAuth2ParameterType["REFRESH_TOKEN"] = "refresh_token";
|
|
398
|
+
OAuth2ParameterType["RESPONSE_MODE"] = "response_mode";
|
|
399
|
+
OAuth2ParameterType["TIMESTAMP"] = "timestamp";
|
|
400
|
+
OAuth2ParameterType["TRACE_ID"] = "trace_id";
|
|
401
|
+
OAuth2ParameterType["CORRELATION_ID"] = "correlation_id";
|
|
402
|
+
return OAuth2ParameterType;
|
|
403
|
+
}({});
|
|
404
|
+
//#endregion
|
|
378
405
|
//#region src/stsoauth2types.ts
|
|
379
406
|
var AuthorizeOptionsResponseType = /* @__PURE__ */ function(AuthorizeOptionsResponseType) {
|
|
380
407
|
AuthorizeOptionsResponseType["CODE"] = "code";
|
|
@@ -662,7 +689,7 @@ var STSOAuth2Manager = class {
|
|
|
662
689
|
return;
|
|
663
690
|
}
|
|
664
691
|
const str = to.query;
|
|
665
|
-
if (str[
|
|
692
|
+
if (str[OAuth2ParameterType.CODE] || str[OAuth2ParameterType.ERROR]) {
|
|
666
693
|
this.#LogDebugMessage(chalk.magenta(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`));
|
|
667
694
|
const retVal = await oAuth2Manager.HandleRedirect(str);
|
|
668
695
|
this.#LogDebugMessage(chalk.magenta(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`));
|
|
@@ -755,7 +782,7 @@ var STSOAuth2Manager = class {
|
|
|
755
782
|
try {
|
|
756
783
|
this.#LogDebugMessage(chalk.magenta(`STSOAuth2Manager:HandleRedirect`));
|
|
757
784
|
let response = null;
|
|
758
|
-
if (queryVars[
|
|
785
|
+
if (queryVars[OAuth2ParameterType.CODE]) {
|
|
759
786
|
const authorizeOptions = this.#transactionStore.get(this.#STORAGE_AUTHORIZE_OPTIONS_KEY);
|
|
760
787
|
this.#transactionStore.remove(this.#STORAGE_AUTHORIZE_OPTIONS_KEY);
|
|
761
788
|
this.#LogDebugMessage(chalk.magenta(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`));
|
|
@@ -1825,10 +1852,10 @@ var STSOAuth2Worker = class {
|
|
|
1825
1852
|
this.#LogMessage(url);
|
|
1826
1853
|
try {
|
|
1827
1854
|
const rConfig = new _nsshunt_stsutils.STSAxiosConfig(url, "post").withData({
|
|
1828
|
-
[
|
|
1829
|
-
[
|
|
1830
|
-
[
|
|
1831
|
-
[
|
|
1855
|
+
[OAuth2ParameterType.CLIENT_ID]: this.#options.client_id,
|
|
1856
|
+
[OAuth2ParameterType.SCOPE]: this.#options.scope,
|
|
1857
|
+
[OAuth2ParameterType.REDIRECT_URI]: this.#options.redirect_uri,
|
|
1858
|
+
[OAuth2ParameterType.AUDIENCE]: this.#options.audience
|
|
1832
1859
|
}).withDefaultHeaders().withCredentials().withTimeout(this.#options.timeout);
|
|
1833
1860
|
this.#LogDebugMessage(chalk.magenta(`#RestoreSession:session request detail: [${JSON.stringify(rConfig)}]`));
|
|
1834
1861
|
if (_nsshunt_stsutils.isNode && this.#agentManager) rConfig.withAgentManager(this.#agentManager);
|
|
@@ -1900,7 +1927,7 @@ var STSOAuth2Worker = class {
|
|
|
1900
1927
|
const authorizeOptions = payload.authorizeOptions;
|
|
1901
1928
|
this.#LogDebugMessage(chalk.magenta(`#HandleRedirect: HandleRedirect`));
|
|
1902
1929
|
this.#LogDebugMessage(chalk.magenta(`#HandleRedirect: HandleRedirect:Query Vars: [${JSON.stringify(queryVars)}]`));
|
|
1903
|
-
if (queryVars[
|
|
1930
|
+
if (queryVars[OAuth2ParameterType.CODE]) {
|
|
1904
1931
|
const response = queryVars;
|
|
1905
1932
|
this.#LogInfoMessage(`authorizeOptions from transaction state: [${JSON.stringify(authorizeOptions)}]`);
|
|
1906
1933
|
const redirectState = response.state;
|
|
@@ -1915,7 +1942,7 @@ var STSOAuth2Worker = class {
|
|
|
1915
1942
|
this.#HandleErrorEvent({ message: "State un-matched" });
|
|
1916
1943
|
return false;
|
|
1917
1944
|
}
|
|
1918
|
-
} else if (queryVars[
|
|
1945
|
+
} else if (queryVars[OAuth2ParameterType.ERROR]) {
|
|
1919
1946
|
this.#LogErrorMessage(chalk.red(`State un-matched (1)`));
|
|
1920
1947
|
this.#HandleErrorEvent({ message: "State un-matched" });
|
|
1921
1948
|
return false;
|
|
@@ -2056,6 +2083,7 @@ var STSOAuth2ManagerPlugin = { install: (app, options) => {
|
|
|
2056
2083
|
exports.AuthorizeOptionsResponseMode = AuthorizeOptionsResponseMode;
|
|
2057
2084
|
exports.AuthorizeOptionsResponseType = AuthorizeOptionsResponseType;
|
|
2058
2085
|
exports.IOauth2ListenerCommand = IOauth2ListenerCommand;
|
|
2086
|
+
exports.OAuth2ParameterType = OAuth2ParameterType;
|
|
2059
2087
|
exports.OAuthGrantTypes = OAuthGrantTypes;
|
|
2060
2088
|
exports.STSOAuth2Manager = STSOAuth2Manager;
|
|
2061
2089
|
exports.STSOAuth2ManagerPlugin = STSOAuth2ManagerPlugin;
|