@nsshunt/stsoauth2plugin 0.1.22 → 0.1.25

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.
@@ -0,0 +1,32 @@
1
+ export class CryptoUtils {
2
+ constructor() {
3
+ this.DigestMessage = async function (message) {
4
+ const encoder = new TextEncoder();
5
+ const data = encoder.encode(message);
6
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
7
+ const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
8
+ //let b64 = window.btoa(String.fromCharCode(...hashArray));
9
+ const b64 = btoa(String.fromCharCode(...hashArray)); // Use below if a HEX string is required
10
+ // const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
11
+ return b64;
12
+ };
13
+ this.CreateRandomString = (size = 43) => {
14
+ //const randomValues = Array.from(window.crypto.getRandomValues(new Uint8Array(size)))
15
+ const randomValues = Array.from(crypto.getRandomValues(new Uint8Array(size)));
16
+ //let b64 = window.btoa(String.fromCharCode(...randomValues));
17
+ const b64 = btoa(String.fromCharCode(...randomValues));
18
+ return b64;
19
+ //return randomValues.toString('base64');
20
+ };
21
+ this.CreateRandomStringEx = () => {
22
+ const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.';
23
+ let random = '';
24
+ //const randomValues = Array.from(window.crypto.getRandomValues(new Uint8Array(43)));
25
+ const randomValues = Array.from(crypto.getRandomValues(new Uint8Array(43)));
26
+ randomValues.forEach(v => (random += charset[v % charset.length]));
27
+ return random;
28
+ };
29
+ }
30
+ }
31
+ export default CryptoUtils;
32
+ //# sourceMappingURL=CryptoUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CryptoUtils.js","sourceRoot":"","sources":["../../src/Utils/CryptoUtils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IAAxB;QACC,kBAAa,GAAG,KAAK,WAAW,OAAO;YACtC,M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AO,MAAM,CAAC;QACf,CAAC,CAAA;IACF,CAAC;CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,49 @@
1
+ // https://github.com/auth0/auth0-spa-js/blob/1de6427f81a8c5b005e9b6d10b9efb1e73542528/static/index.html
2
+ // https://stackoverflow.com/questions/12446317/change-url-without-redirecting-using-javascript
3
+ class QueryParams {
4
+ constructor() {
5
+ this.DecodeQueryParams = (params) => {
6
+ const retObj = {};
7
+ const arr = Object.keys(params)
8
+ .filter(k => typeof params[k] !== 'undefined')
9
+ .map(k => {
10
+ retObj[decodeURIComponent(k)] = decodeURIComponent(params[k]);
11
+ });
12
+ return retObj;
13
+ };
14
+ this.CreateQueryParams = (params) => {
15
+ return Object.keys(params)
16
+ .filter(k => typeof params[k] !== 'undefined')
17
+ .map(k => {
18
+ if (Array.isArray(params[k])) {
19
+ return encodeURIComponent(k) + '=' + encodeURIComponent(params[k].join(' '));
20
+ }
21
+ else {
22
+ return encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
23
+ }
24
+ })
25
+ .join('&');
26
+ };
27
+ this._GetQueryParams = (param) => {
28
+ let retVal = {};
29
+ const uri = param.split("?");
30
+ if (uri.length == 2) {
31
+ const vars = uri[1].split("&");
32
+ const getVars = {};
33
+ let tmp = "";
34
+ vars.forEach(function (v) {
35
+ tmp = v.split("=");
36
+ if (tmp.length == 2)
37
+ getVars[tmp[0]] = tmp[1];
38
+ });
39
+ retVal = this.DecodeQueryParams(getVars);
40
+ }
41
+ return retVal;
42
+ };
43
+ this.GetQueryParams = () => {
44
+ return this._GetQueryParams(window.location.href);
45
+ };
46
+ }
47
+ }
48
+ export default QueryParams;
49
+ //# sourceMappingURL=QueryParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryParams.js","sourceRoot":"","sources":["../../src/Utils/QueryParams.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,+FAA+F;AAC/F,MAAM,WAAW;IAAjB;QACC,sBAAiB,GAAG,CAA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,IAAI,CAAC,EAAE;gBACpB,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC/B,MAAM,OAAO,GAAG,EAAE,CAAC;gBACnB,IAAI,GAAG,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;oBACvB,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACnB,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;wBAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;aACzC;YACD,OAAO,MAAM,CAAC;QACf,CAAC,CAAA;QAED,mBAAc,GAAG,GAAG,EAAE;YACrB,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC,CAAA;IACF,CAAC;CAAA;AAED,eAAe,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import { STSOAuth2Manager } from './stsoauth2manager';
2
+ export * from './stsoauth2types';
3
+ export * from './stsoauth2manager';
4
+ export * from './stsoauth2worker';
5
+ export const STSOAuth2ManagerPlugin = {
6
+ install: (app, router) => {
7
+ const om = new STSOAuth2Manager(app, router);
8
+ app.config.globalProperties.$sts.om = om;
9
+ }
10
+ };
11
+ //export default STSOAuth2ManagerPlugin
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AAEjC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC7C,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAC1C,CAAC;CACD,CAAA;AACD,uCAAuC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ describe("Test Latency Controller", () => {
3
+ test('Testing Module', async () => {
4
+ expect.assertions(1);
5
+ expect(1).toEqual(1);
6
+ });
7
+ });
8
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";AACA,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IAExC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;QAEjC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,152 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _MemoryStorage_store, _ClientStorageFactory_storage;
13
+ import Debug from "debug";
14
+ const debug = Debug(`proc:${process.pid}:storage.ts`);
15
+ import * as Cookies from 'es-cookie';
16
+ export var ClientStorageType;
17
+ (function (ClientStorageType) {
18
+ ClientStorageType["LOCAL_STORAGE"] = "LocalStorage";
19
+ ClientStorageType["SESSION_STORAGE"] = "SessionStorage";
20
+ ClientStorageType["COOKIE_STORAGE"] = "CookieStorage";
21
+ ClientStorageType["MEMORY_STORAGE"] = "MemoryStorage"; //@@ todo
22
+ })(ClientStorageType || (ClientStorageType = {}));
23
+ class CookieStorage {
24
+ constructor() {
25
+ this.get = (key) => {
26
+ const raw = Cookies.get(key);
27
+ if (raw) {
28
+ return JSON.parse(raw);
29
+ }
30
+ else {
31
+ return null;
32
+ }
33
+ };
34
+ this.set = (key, value, options = {}) => {
35
+ let cookieAttributes = {};
36
+ if ('https:' === window.location.protocol) {
37
+ cookieAttributes = {
38
+ secure: true,
39
+ sameSite: 'none'
40
+ };
41
+ }
42
+ if (options && options.daysUntilExpire) {
43
+ cookieAttributes.expires = options.daysUntilExpire;
44
+ }
45
+ else {
46
+ cookieAttributes.expires = 1;
47
+ }
48
+ debug(`CookieStorage.set: key: ${key}, value: [${value}]`);
49
+ Cookies.set(key, JSON.stringify(value), cookieAttributes);
50
+ };
51
+ this.remove = (key) => {
52
+ Cookies.remove(key);
53
+ };
54
+ }
55
+ }
56
+ class SessionStorage {
57
+ constructor() {
58
+ this.get = (key) => {
59
+ const value = sessionStorage.getItem(key);
60
+ if (typeof value === 'undefined') {
61
+ return null;
62
+ }
63
+ if (value === null) {
64
+ return null;
65
+ }
66
+ return JSON.parse(value);
67
+ };
68
+ this.set = (key, value) => {
69
+ debug(`SessionStorage.set: key: ${key}, value: [${value}]`);
70
+ sessionStorage.setItem(key, JSON.stringify(value));
71
+ };
72
+ this.remove = (key) => {
73
+ sessionStorage.removeItem(key);
74
+ };
75
+ }
76
+ }
77
+ class LocalStorage {
78
+ constructor() {
79
+ this.get = (key) => {
80
+ const value = localStorage.getItem(key);
81
+ if (typeof value === 'undefined') {
82
+ return null;
83
+ }
84
+ if (value === null) {
85
+ return null;
86
+ }
87
+ return JSON.parse(value);
88
+ };
89
+ this.set = (key, value) => {
90
+ debug(`LocalStorage.set: key: ${key}, value: [${value}]`);
91
+ localStorage.setItem(key, JSON.stringify(value));
92
+ };
93
+ this.remove = (key) => {
94
+ localStorage.removeItem(key);
95
+ };
96
+ }
97
+ }
98
+ class MemoryStorage {
99
+ constructor() {
100
+ _MemoryStorage_store.set(this, {});
101
+ this.get = (key) => {
102
+ const value = __classPrivateFieldGet(this, _MemoryStorage_store, "f")[key];
103
+ if (typeof value === 'undefined') {
104
+ return null;
105
+ }
106
+ if (value === null) {
107
+ return null;
108
+ }
109
+ return value;
110
+ };
111
+ this.set = (key, value) => {
112
+ debug(`MemoryStorage.set: key: ${key}, value: [${value}]`);
113
+ __classPrivateFieldGet(this, _MemoryStorage_store, "f")[key] = value;
114
+ };
115
+ this.remove = (key) => {
116
+ delete __classPrivateFieldGet(this, _MemoryStorage_store, "f")[key];
117
+ };
118
+ }
119
+ }
120
+ _MemoryStorage_store = new WeakMap();
121
+ export class ClientStorageOptions {
122
+ constructor() {
123
+ this.clientStorageType = ClientStorageType.MEMORY_STORAGE;
124
+ }
125
+ }
126
+ export class ClientStorageFactory {
127
+ constructor(options) {
128
+ _ClientStorageFactory_storage.set(this, null);
129
+ switch (options.clientStorageType) {
130
+ case ClientStorageType.SESSION_STORAGE:
131
+ __classPrivateFieldSet(this, _ClientStorageFactory_storage, new SessionStorage(), "f");
132
+ break;
133
+ case ClientStorageType.LOCAL_STORAGE:
134
+ __classPrivateFieldSet(this, _ClientStorageFactory_storage, new LocalStorage(), "f");
135
+ break;
136
+ case ClientStorageType.COOKIE_STORAGE:
137
+ __classPrivateFieldSet(this, _ClientStorageFactory_storage, new CookieStorage(), "f");
138
+ break;
139
+ case ClientStorageType.MEMORY_STORAGE:
140
+ __classPrivateFieldSet(this, _ClientStorageFactory_storage, new MemoryStorage(), "f");
141
+ break;
142
+ default:
143
+ throw new Error(`Unknown [${options.clientStorageType}] storage type.`);
144
+ }
145
+ return;
146
+ }
147
+ GetStorage() {
148
+ return __classPrivateFieldGet(this, _ClientStorageFactory_storage, "f");
149
+ }
150
+ }
151
+ _ClientStorageFactory_storage = new WeakMap();
152
+ //# sourceMappingURL=stsStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stsStorage.js","sourceRoot":"","sources":["../src/stsStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,OAAO,CAAC,GAAG,aAAa,CAAC,CAAC;AAEtD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AASrC,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC5B,mDAA8B,CAAA;IAC9B,uDAAkC,CAAA;IAClC,qDAAgC,CAAA;IAChC,qDAAgC,CAAA,CAAC,SAAS;AAC3C,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED,MAAM,aAAa;IAAnB;QAEC,QAAG,GAAG,CAAC,GAAW,EAAK,EAAE;YACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,GAAG,EAAE;gBACR,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACvB;iBAAM;gBACN,OAAO,IAAI,CAAC;aACZ;QACF,CAAC,CAAA;QAED,QAAG,GAAG,CAAC,GAAW,EAAE,KAAQ,EAAE,UAAsB,EAAG,EAAE,EAAE;YAC1D,IAAI,gBAAgB,GAA6B,EAAG,CAAC;YACrD,IAAI,QAAQ,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AAC,CAAC;YAC3D,uBAAA,IAAI,4BAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAA;QAED,WAAM,GAAG,CAAC,GAAW,EAAQ,EAAE;YAC9B,OAAO,uBAAA,IAAI,4BAAO,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC,CAAA;IACF,CAAC;CAAA;;AAED,MAAM,OAAO,oBAAoB;IAAjC;QACC,sBAAiB,GAAsB,iBAAiB,CAAC,cAAc,CAAC;IAEzE,CAAC;CAAA;AAED,MAAM,OAAO,oBAAoB;IAIhC,YAAY,OAA6B;QAFzC,wCAAW,IAAI,EAAC;QAGf,QAAQ,OAAO,CAAC,iBAAiB,EAAE;YACnC,KAAK,iBAAiB,CAAC,eAAe;gBACrC,uBAAA,IAAI,iCAAY,IAAI,cAAc,EAAK,MAAA,CAAC;gBACxC,MAAM;YACP,KAAK,iBAAiB,CAAC,aAAa;gBACnC,uBAAA,IAAI,iCAAY,IAAI,YAAY,EAAK,MAAA,CAAC;gBACtC,MAAM;YACP,KAAK,iBAAiB,CAAC,cAAc;gBACpC,uBAAA,IAAI,iCAAY,IAAI,aAAa,EAAK,MAAA,CAAC;gBACvC,MAAM;YACP,KAAK,iBAAiB,CAAC,cAAc;gBACpC,uBAAA,IAAI,iCAAY,IAAI,aAAa,EAAK,MAAA,CAAC;gBACvC,MAAM;YACP;gBACC,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,CAAC,iBAAiB,iBAAiB,CAAC,CAAC;SACxE;QACD,OAAO;IACR,CAAC;IAED,UAAU;QAET,OAAO,uBAAA,IAAI,qCAAS,CAAC;IACtB,CAAC;CACD"}
@@ -0,0 +1,325 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _STSOAuth2Manager_storageManager, _STSOAuth2Manager_router, _STSOAuth2Manager_store, _STSOAuth2Manager_cUtils, _STSOAuth2Manager_qParams, _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY, _STSOAuth2Manager_STORAGE_SESSION_KEY, _STSOAuth2Manager_aic, _STSOAuth2Manager_options, _STSOAuth2Manager_messages, _STSOAuth2Manager_oauth2ManagerPort, _STSOAuth2Manager_messageId, _STSOAuth2Manager_messageHandlers, _STSOAuth2Manager_messageTimeout, _STSOAuth2Manager_worker, _STSOAuth2Manager_transactionStore, _STSOAuth2Manager_ProcessMessageResponse, _STSOAuth2Manager_PostMessage, _STSOAuth2Manager_HandleErrorEvent, _STSOAuth2Manager_HandleAuthenticateEvent, _STSOAuth2Manager_SetupRoute, _STSOAuth2Manager_SetupStoreNamespace;
13
+ import Debug from "debug";
14
+ const debug = Debug(`proc:${process.pid}:stsoauth2manager.ts`);
15
+ import { OAuth2ParameterType } from '@nsshunt/stsutils';
16
+ import CryptoUtils from './Utils/CryptoUtils';
17
+ import QueryParams from './Utils/QueryParams';
18
+ import { IOauth2ListenerCommand } from './stsoauth2types';
19
+ import { ClientStorageType, ClientStorageFactory } from './stsStorage';
20
+ //import createPersistedState from "vuex-persistedstate"; // https://www.npmjs.com/package/vuex-persistedstate
21
+ import jwt_decode from "jwt-decode";
22
+ //import { transformWithEsbuild } from "vite";
23
+ // STS Client SDK for SPAs
24
+ export class STSOAuth2Manager {
25
+ constructor(app, options) {
26
+ _STSOAuth2Manager_storageManager.set(this, null);
27
+ _STSOAuth2Manager_router.set(this, null);
28
+ _STSOAuth2Manager_store.set(this, null);
29
+ _STSOAuth2Manager_cUtils.set(this, new CryptoUtils());
30
+ _STSOAuth2Manager_qParams.set(this, new QueryParams());
31
+ _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY.set(this, 'authorize_options.stsmda.com.au');
32
+ _STSOAuth2Manager_STORAGE_SESSION_KEY.set(this, 'session.stsmda.com.au');
33
+ _STSOAuth2Manager_aic.set(this, null);
34
+ _STSOAuth2Manager_options.set(this, null);
35
+ _STSOAuth2Manager_messages.set(this, {});
36
+ _STSOAuth2Manager_oauth2ManagerPort.set(this, void 0);
37
+ _STSOAuth2Manager_messageId.set(this, 0);
38
+ _STSOAuth2Manager_messageHandlers.set(this, {}); // keyed by messageId
39
+ _STSOAuth2Manager_messageTimeout.set(this, 1000);
40
+ _STSOAuth2Manager_worker.set(this, null);
41
+ _STSOAuth2Manager_transactionStore.set(this, null); // Transient transaction data used to establish a session via OAuth2 authorize handshake
42
+ _STSOAuth2Manager_ProcessMessageResponse.set(this, (data) => {
43
+ const messageResponse = data.data;
44
+ if (messageResponse.messageId === -1) {
45
+ // unsolicted message
46
+ switch (messageResponse.command) {
47
+ case IOauth2ListenerCommand.AUTHENTICATE_EVENT:
48
+ __classPrivateFieldGet(this, _STSOAuth2Manager_HandleAuthenticateEvent, "f").call(this, messageResponse.payload);
49
+ break;
50
+ case IOauth2ListenerCommand.ERROR:
51
+ __classPrivateFieldGet(this, _STSOAuth2Manager_HandleErrorEvent, "f").call(this, messageResponse.payload);
52
+ break;
53
+ default:
54
+ throw new Error(`ProcessMessageResponse command [${messageResponse.command}] not valid.`);
55
+ }
56
+ }
57
+ else {
58
+ const callBack = __classPrivateFieldGet(this, _STSOAuth2Manager_messageHandlers, "f")[messageResponse.messageId];
59
+ if (callBack) {
60
+ callBack(messageResponse);
61
+ }
62
+ else {
63
+ throw new Error(`Message: [${messageResponse.messageId}] does not exists in callBacks.`);
64
+ }
65
+ }
66
+ });
67
+ _STSOAuth2Manager_PostMessage.set(this, (message) => {
68
+ var _a, _b;
69
+ message.messageId = (__classPrivateFieldSet(this, _STSOAuth2Manager_messageId, (_b = __classPrivateFieldGet(this, _STSOAuth2Manager_messageId, "f"), _a = _b++, _b), "f"), _a);
70
+ return new Promise((resolve, reject) => {
71
+ // Setup message timeout
72
+ const timeout = setTimeout(() => {
73
+ delete __classPrivateFieldGet(this, _STSOAuth2Manager_messageHandlers, "f")[message.messageId];
74
+ reject(`Message: [${message.messageId}] timeout error after: [${__classPrivateFieldGet(this, _STSOAuth2Manager_messageTimeout, "f")}] ms.`);
75
+ }, __classPrivateFieldGet(this, _STSOAuth2Manager_messageTimeout, "f"));
76
+ // Setup message callback based on messageId
77
+ __classPrivateFieldGet(this, _STSOAuth2Manager_messageHandlers, "f")[message.messageId] = (response) => {
78
+ clearTimeout(timeout);
79
+ delete __classPrivateFieldGet(this, _STSOAuth2Manager_messageHandlers, "f")[message.messageId];
80
+ resolve(response);
81
+ };
82
+ // Send the message
83
+ __classPrivateFieldGet(this, _STSOAuth2Manager_oauth2ManagerPort, "f").postMessage(message);
84
+ });
85
+ }
86
+ // Will come from message channel
87
+ );
88
+ // Will come from message channel
89
+ _STSOAuth2Manager_HandleErrorEvent.set(this, (error) => {
90
+ __classPrivateFieldGet(this, _STSOAuth2Manager_store, "f").commit('AuthorizeError', {
91
+ message: error
92
+ });
93
+ // plugin to do this ...
94
+ setTimeout(() => {
95
+ __classPrivateFieldGet(this, _STSOAuth2Manager_router, "f").replace('/error'); //@@ was push
96
+ }, 0);
97
+ });
98
+ _STSOAuth2Manager_HandleAuthenticateEvent.set(this, (id_token) => {
99
+ if (__classPrivateFieldGet(this, _STSOAuth2Manager_options, "f").authenticateEvent) {
100
+ __classPrivateFieldGet(this, _STSOAuth2Manager_options, "f").authenticateEvent(id_token);
101
+ }
102
+ __classPrivateFieldGet(this, _STSOAuth2Manager_store, "f").commit('stsOAuth2SDK/SessionData', id_token);
103
+ });
104
+ _STSOAuth2Manager_SetupRoute.set(this, (app, router) => {
105
+ router.beforeEach(async (to, from) => {
106
+ const store = app.config.globalProperties.$store;
107
+ const sts = app.config.globalProperties.$sts;
108
+ debug(`beforeEach: from: [${from.path}], to: [${to.path}]`); // gray
109
+ if (store.getters['stsOAuth2SDK/LoggedIn'] === false) {
110
+ console.log(`Not logged in`);
111
+ // Not logged in
112
+ if (to.path.localeCompare('/authorize') === 0) {
113
+ console.log(`to = /authorize`);
114
+ return true;
115
+ }
116
+ else if (to.path.localeCompare('/consent') === 0) {
117
+ // Need to check if we are in the correct state, if not - drop back to the start of the process
118
+ if (typeof store.getters.Session.sessionId !== 'undefined') {
119
+ return true;
120
+ }
121
+ }
122
+ if (to.path.localeCompare('/logout') === 0) {
123
+ return true;
124
+ }
125
+ if (to.path.localeCompare('/error') === 0) {
126
+ return true;
127
+ }
128
+ if (to.path.localeCompare('/logout') === 0) {
129
+ return true;
130
+ }
131
+ const str = to.query;
132
+ // Check if this route is from a redirect from the authorization server
133
+ if (str[OAuth2ParameterType.CODE] || str[OAuth2ParameterType.ERROR]) {
134
+ console.log(`#SetupRout:str = [${str}]`);
135
+ const retVal = await sts.om.HandleRedirect(str);
136
+ if (retVal) {
137
+ // Success
138
+ setTimeout(() => {
139
+ window.history.replaceState({}, document.title, window.location.origin + '/');
140
+ }, 0);
141
+ return true;
142
+ }
143
+ else {
144
+ // Error
145
+ //@@ need the error data here - or use the vuex store ?
146
+ __classPrivateFieldGet(this, _STSOAuth2Manager_router, "f").replace('/error'); //@@ was push
147
+ //@@ should replaceState be used as in above?
148
+ return false;
149
+ }
150
+ }
151
+ const sessionRestored = await sts.om.RestoreSession();
152
+ console.log(`#SetupRoute:sessionRestored [${sessionRestored}]`);
153
+ if (sessionRestored !== true) {
154
+ console.log('Session not restored - Need to Authorize');
155
+ sts.om.Authorize();
156
+ return false;
157
+ }
158
+ else {
159
+ return '/';
160
+ //router.replace({ path: '/' })
161
+ }
162
+ }
163
+ else {
164
+ // Prevent pages if already logged in
165
+ if (to.path.localeCompare('/consent') === 0) {
166
+ return '/';
167
+ /*
168
+ router.replace({ path: '/' })
169
+ return false;
170
+ */
171
+ }
172
+ if (to.path.localeCompare('/authorize') === 0) {
173
+ router.replace({ path: '/' });
174
+ return false;
175
+ }
176
+ if (to.path.localeCompare('/logout') === 0) {
177
+ router.replace({ path: '/' });
178
+ return false;
179
+ }
180
+ return true;
181
+ /*
182
+ if (to.path.localeCompare('/') === 0) {
183
+ // In case press the back button in the browser shows previous query string params, replace them ...
184
+ setTimeout(() => {
185
+ window.history.replaceState(
186
+ {},
187
+ document.title,
188
+ window.location.origin + '/');
189
+ }, 0);
190
+ return true;
191
+ }
192
+ */
193
+ }
194
+ });
195
+ });
196
+ _STSOAuth2Manager_SetupStoreNamespace.set(this, () => {
197
+ __classPrivateFieldGet(this, _STSOAuth2Manager_store, "f").registerModule('stsOAuth2SDK', {
198
+ namespaced: true,
199
+ state() {
200
+ return {
201
+ // STS Client SDK options. These are parameters initiated by the client SPA and used for the end-to-end transaction processing.
202
+ //authorizeOptions: { },
203
+ sessionData: {},
204
+ };
205
+ },
206
+ getters: {
207
+ SessionData(state) {
208
+ return state.sessionData;
209
+ },
210
+ LoggedIn(state) {
211
+ if (typeof state.sessionData === 'undefined') {
212
+ return false;
213
+ }
214
+ if (state.sessionData === null) {
215
+ return false;
216
+ }
217
+ return true;
218
+ },
219
+ UserDetails(state) {
220
+ //if (state.sessionData && state.sessionData.id_token) {
221
+ if (state.sessionData) {
222
+ const id_token = state.sessionData;
223
+ const decodedIdToken = jwt_decode(id_token);
224
+ return decodedIdToken;
225
+ }
226
+ else {
227
+ return null;
228
+ }
229
+ }
230
+ },
231
+ mutations: {
232
+ SessionData(state, sessionData) {
233
+ state.sessionData = sessionData;
234
+ console.log(`commit [sessionData]: ${JSON.stringify(sessionData)}`);
235
+ },
236
+ }
237
+ }, { preserveState: true });
238
+ });
239
+ this.RestoreSession = async () => {
240
+ try {
241
+ const response = await __classPrivateFieldGet(this, _STSOAuth2Manager_PostMessage, "f").call(this, { command: IOauth2ListenerCommand.RESTORE_SESSION });
242
+ return response.payload;
243
+ }
244
+ catch (error) {
245
+ console.log(`RestoreSession Error: ${error}`); //red
246
+ return false;
247
+ }
248
+ };
249
+ this.Authorize = async () => {
250
+ try {
251
+ const response = await __classPrivateFieldGet(this, _STSOAuth2Manager_PostMessage, "f").call(this, { command: IOauth2ListenerCommand.AUTHORIZE });
252
+ __classPrivateFieldGet(this, _STSOAuth2Manager_transactionStore, "f").set(__classPrivateFieldGet(this, _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY, "f"), response.payload.authorizeOptions);
253
+ const url = response.payload.url;
254
+ window.location.replace(url);
255
+ }
256
+ catch (error) {
257
+ console.log(`Authorize Error: ${error}`); // red
258
+ }
259
+ };
260
+ this.HandleRedirect = async (queryVars) => {
261
+ try {
262
+ let response = null;
263
+ if (queryVars[OAuth2ParameterType.CODE]) {
264
+ const authorizeOptions = __classPrivateFieldGet(this, _STSOAuth2Manager_transactionStore, "f").get(__classPrivateFieldGet(this, _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY, "f"));
265
+ __classPrivateFieldGet(this, _STSOAuth2Manager_transactionStore, "f").remove(__classPrivateFieldGet(this, _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY, "f"));
266
+ response = await __classPrivateFieldGet(this, _STSOAuth2Manager_PostMessage, "f").call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: {
267
+ queryVars: queryVars,
268
+ authorizeOptions
269
+ } });
270
+ }
271
+ else {
272
+ response = await __classPrivateFieldGet(this, _STSOAuth2Manager_PostMessage, "f").call(this, { command: IOauth2ListenerCommand.HANDLE_REDIRECT, payload: queryVars });
273
+ }
274
+ return response.payload;
275
+ }
276
+ catch (error) {
277
+ console.log(`HandleRedirect Error: ${error}`); // red
278
+ return false;
279
+ }
280
+ };
281
+ this.Logout = async () => {
282
+ try {
283
+ const response = await __classPrivateFieldGet(this, _STSOAuth2Manager_PostMessage, "f").call(this, { command: IOauth2ListenerCommand.LOGOUT });
284
+ return response.payload;
285
+ }
286
+ catch (error) {
287
+ console.log(`Logout Error: ${error}`); // red
288
+ return false;
289
+ }
290
+ };
291
+ __classPrivateFieldSet(this, _STSOAuth2Manager_options, options, "f");
292
+ __classPrivateFieldSet(this, _STSOAuth2Manager_storageManager, app.config.globalProperties.$sts.storage, "f");
293
+ __classPrivateFieldSet(this, _STSOAuth2Manager_store, app.config.globalProperties.$store, "f");
294
+ __classPrivateFieldSet(this, _STSOAuth2Manager_aic, app.config.globalProperties.$sts.aic.PrimaryPublishInstrumentController, "f");
295
+ __classPrivateFieldSet(this, _STSOAuth2Manager_router, app.config.globalProperties.$router, "f");
296
+ // Use session storage for the transient nature of the OAuth2 authorize handshake. Once completed, the storage will be removed.
297
+ __classPrivateFieldSet(this, _STSOAuth2Manager_transactionStore, new ClientStorageFactory({ clientStorageType: ClientStorageType.SESSION_STORAGE }).GetStorage(), "f");
298
+ if (__classPrivateFieldGet(this, _STSOAuth2Manager_options, "f").workerFactory) {
299
+ __classPrivateFieldSet(this, _STSOAuth2Manager_worker, __classPrivateFieldGet(this, _STSOAuth2Manager_options, "f").workerFactory(), "f");
300
+ }
301
+ else {
302
+ __classPrivateFieldSet(this, _STSOAuth2Manager_worker, new Worker(new URL('./stsoauth2worker.ts', import.meta.url), {
303
+ type: 'module'
304
+ }), "f");
305
+ }
306
+ __classPrivateFieldGet(this, _STSOAuth2Manager_worker, "f").onmessage = (data) => {
307
+ console.log(`this.#worker.onmessage = [${data}]`); // green
308
+ };
309
+ __classPrivateFieldGet(this, _STSOAuth2Manager_worker, "f").onerror = function (error) {
310
+ console.log(`this.#worker.onerror = [${JSON.stringify(error)}]`); // green
311
+ };
312
+ const { port1: oauth2ManagerPort, // process message port
313
+ port2: oauth2WorkerPort // collector message port
314
+ } = new MessageChannel();
315
+ __classPrivateFieldSet(this, _STSOAuth2Manager_oauth2ManagerPort, oauth2ManagerPort, "f");
316
+ __classPrivateFieldGet(this, _STSOAuth2Manager_worker, "f").postMessage(oauth2WorkerPort, [oauth2WorkerPort]);
317
+ __classPrivateFieldGet(this, _STSOAuth2Manager_oauth2ManagerPort, "f").onmessage = (data) => {
318
+ __classPrivateFieldGet(this, _STSOAuth2Manager_ProcessMessageResponse, "f").call(this, data);
319
+ };
320
+ __classPrivateFieldGet(this, _STSOAuth2Manager_SetupStoreNamespace, "f").call(this);
321
+ __classPrivateFieldGet(this, _STSOAuth2Manager_SetupRoute, "f").call(this, app, options.router);
322
+ }
323
+ }
324
+ _STSOAuth2Manager_storageManager = new WeakMap(), _STSOAuth2Manager_router = new WeakMap(), _STSOAuth2Manager_store = new WeakMap(), _STSOAuth2Manager_cUtils = new WeakMap(), _STSOAuth2Manager_qParams = new WeakMap(), _STSOAuth2Manager_STORAGE_AUTHORIZE_OPTIONS_KEY = new WeakMap(), _STSOAuth2Manager_STORAGE_SESSION_KEY = new WeakMap(), _STSOAuth2Manager_aic = new WeakMap(), _STSOAuth2Manager_options = new WeakMap(), _STSOAuth2Manager_messages = new WeakMap(), _STSOAuth2Manager_oauth2ManagerPort = new WeakMap(), _STSOAuth2Manager_messageId = new WeakMap(), _STSOAuth2Manager_messageHandlers = new WeakMap(), _STSOAuth2Manager_messageTimeout = new WeakMap(), _STSOAuth2Manager_worker = new WeakMap(), _STSOAuth2Manager_transactionStore = new WeakMap(), _STSOAuth2Manager_ProcessMessageResponse = new WeakMap(), _STSOAuth2Manager_PostMessage = new WeakMap(), _STSOAuth2Manager_HandleErrorEvent = new WeakMap(), _STSOAuth2Manager_HandleAuthenticateEvent = new WeakMap(), _STSOAuth2Manager_SetupRoute = new WeakMap(), _STSOAuth2Manager_SetupStoreNamespace = new WeakMap();
325
+ //# sourceMappingURL=stsoauth2manager.js.map
@@ -0,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