@nsshunt/stsoauth2plugin 1.0.4 → 1.0.6
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/stsoauth2plugin.mjs +1525 -0
- package/dist/stsoauth2plugin.mjs.map +1 -0
- package/dist/stsoauth2plugin.umd.js +2 -0
- package/dist/stsoauth2plugin.umd.js.map +1 -0
- package/package.json +24 -23
- package/types/Utils/CryptoUtils.d.ts +1 -1
- package/types/Utils/CryptoUtils.d.ts.map +1 -1
- package/types/Utils/QueryParams.d.ts +5 -4
- package/types/Utils/QueryParams.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/stores/stsoauth2store.d.ts +1 -1
- package/types/stores/stsoauth2store.d.ts.map +1 -1
- package/types/stsoauth2manager.d.ts.map +1 -1
- package/types/stsoauth2types.d.ts +1 -1
- package/types/stsoauth2types.d.ts.map +1 -1
- package/types/stsoauth2worker.d.ts.map +1 -1
- package/dist/Utils/CryptoUtils.js +0 -58
- package/dist/Utils/CryptoUtils.js.map +0 -1
- package/dist/Utils/QueryParams.js +0 -49
- package/dist/Utils/QueryParams.js.map +0 -1
- package/dist/index.js +0 -44
- package/dist/index.js.map +0 -1
- package/dist/index.test.js +0 -8
- package/dist/index.test.js.map +0 -1
- package/dist/stores/stsoauth2store.js +0 -57
- package/dist/stores/stsoauth2store.js.map +0 -1
- package/dist/stores/testStore.js +0 -32
- package/dist/stores/testStore.js.map +0 -1
- package/dist/stsPluginKeys.js +0 -6
- package/dist/stsPluginKeys.js.map +0 -1
- package/dist/stsoauth2launcher.js +0 -10
- package/dist/stsoauth2launcher.js.map +0 -1
- package/dist/stsoauth2manager.js +0 -455
- package/dist/stsoauth2manager.js.map +0 -1
- package/dist/stsoauth2types.js +0 -38
- package/dist/stsoauth2types.js.map +0 -1
- package/dist/stsoauth2worker.js +0 -611
- package/dist/stsoauth2worker.js.map +0 -1
package/dist/stsoauth2manager.js
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.STSOAuth2Manager = void 0;
|
|
30
|
-
const debug_1 = __importDefault(require("debug"));
|
|
31
|
-
let debug = null;
|
|
32
|
-
const stsutils_1 = require("@nsshunt/stsutils");
|
|
33
|
-
const detect_node_1 = __importDefault(require("detect-node"));
|
|
34
|
-
if (detect_node_1.default) {
|
|
35
|
-
debug = (0, debug_1.default)(`proc:${process.pid}:stsoauth2manager.ts`);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
debug = (0, debug_1.default)(`proc:0:stsoauth2manager.ts`);
|
|
39
|
-
}
|
|
40
|
-
const wt = __importStar(require("worker_threads"));
|
|
41
|
-
const CryptoUtils_1 = __importDefault(require("./Utils/CryptoUtils"));
|
|
42
|
-
const QueryParams_1 = __importDefault(require("./Utils/QueryParams"));
|
|
43
|
-
const stsoauth2types_1 = require("./stsoauth2types");
|
|
44
|
-
//import { IStsStorage, ClientStorageType, ClientStorageFactory } from './stsStorage'
|
|
45
|
-
const stsvueutils_1 = require("@nsshunt/stsvueutils");
|
|
46
|
-
const stsPluginKeys_1 = require("./stsPluginKeys");
|
|
47
|
-
//import { createPinia, defineStore } from 'pinia'
|
|
48
|
-
//import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
|
49
|
-
const stsoauth2store_1 = require("./stores/stsoauth2store");
|
|
50
|
-
const stspublisherserver_1 = require("@nsshunt/stspublisherserver");
|
|
51
|
-
// STS Client SDK for SPAs
|
|
52
|
-
class STSOAuth2Manager {
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
#router = null;
|
|
55
|
-
#cUtils = new CryptoUtils_1.default();
|
|
56
|
-
#qParams = new QueryParams_1.default();
|
|
57
|
-
#STORAGE_AUTHORIZE_OPTIONS_KEY = 'authorize_options.stsmda.com.au';
|
|
58
|
-
#STORAGE_SESSION_KEY = 'session.stsmda.com.au';
|
|
59
|
-
#aic = null;
|
|
60
|
-
#options = null;
|
|
61
|
-
#messages = {};
|
|
62
|
-
#oauth2ManagerPort;
|
|
63
|
-
#messageId = 0;
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
#messageHandlers = {}; // keyed by messageId
|
|
66
|
-
#messageTimeout = 10000;
|
|
67
|
-
#worker = null;
|
|
68
|
-
#transactionStore = null; // Transient transaction data used to establish a session via OAuth2 authorize handshake
|
|
69
|
-
#operationSemaphore = false;
|
|
70
|
-
#maxSemaphoreRetries = 100; // 100 retries, i.e. allow 100 x 50 = 5000ms to unblock
|
|
71
|
-
#semaphoreRetrySleep = 50; // ms
|
|
72
|
-
constructor(app, options) {
|
|
73
|
-
this.#options = options;
|
|
74
|
-
if (!detect_node_1.default) {
|
|
75
|
-
if (app.config.globalProperties.$sts[stspublisherserver_1.STSInstrumentControllerPluginKey]) {
|
|
76
|
-
const STSInstrumentController = app.config.globalProperties.$sts[stspublisherserver_1.STSInstrumentControllerPluginKey];
|
|
77
|
-
this.#aic = STSInstrumentController.PrimaryPublishInstrumentController;
|
|
78
|
-
}
|
|
79
|
-
this.#router = app.config.globalProperties.$router;
|
|
80
|
-
}
|
|
81
|
-
// Use session storage for the transient nature of the OAuth2 authorize handshake. Once completed, the storage will be removed.
|
|
82
|
-
if (detect_node_1.default) {
|
|
83
|
-
this.#transactionStore = new stsvueutils_1.ClientStorageFactory({ clientStorageType: stsvueutils_1.ClientStorageType.MEMORY_STORAGE, usePrefix: false }).GetStorage();
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.#transactionStore = new stsvueutils_1.ClientStorageFactory({ clientStorageType: stsvueutils_1.ClientStorageType.SESSION_STORAGE, usePrefix: false }).GetStorage();
|
|
87
|
-
}
|
|
88
|
-
this.#worker = this.#options.workerFactory();
|
|
89
|
-
if (!detect_node_1.default) {
|
|
90
|
-
this.#worker.onmessage = (data) => {
|
|
91
|
-
console.log(`this.#worker.onmessage = [${data}]`); // green
|
|
92
|
-
};
|
|
93
|
-
this.#worker.onerror = function (error) {
|
|
94
|
-
console.log(`this.#worker.onerror = [${JSON.stringify(error)}]`); // green
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
let workerMessage;
|
|
98
|
-
if (detect_node_1.default) {
|
|
99
|
-
const { port1: oauth2ManagerPort, // this process port
|
|
100
|
-
port2: oauth2WorkerPort // worker port
|
|
101
|
-
} = new wt.MessageChannel();
|
|
102
|
-
this.#oauth2ManagerPort = oauth2ManagerPort;
|
|
103
|
-
workerMessage = {
|
|
104
|
-
workerPort: oauth2WorkerPort,
|
|
105
|
-
options: this.#options.workerOptions
|
|
106
|
-
};
|
|
107
|
-
this.#worker.postMessage(workerMessage, [oauth2WorkerPort]);
|
|
108
|
-
this.#oauth2ManagerPort.on('message', (payload) => {
|
|
109
|
-
this.#ProcessMessageResponse(payload);
|
|
110
|
-
}).unref();
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
const { port1: oauth2ManagerPort, // this process port
|
|
114
|
-
port2: oauth2WorkerPort // worker port
|
|
115
|
-
} = new MessageChannel();
|
|
116
|
-
this.#oauth2ManagerPort = oauth2ManagerPort;
|
|
117
|
-
workerMessage = {
|
|
118
|
-
workerPort: oauth2WorkerPort,
|
|
119
|
-
options: this.#options.workerOptions
|
|
120
|
-
};
|
|
121
|
-
this.#worker.postMessage(workerMessage, [oauth2WorkerPort]);
|
|
122
|
-
this.#oauth2ManagerPort.onmessage = (data) => {
|
|
123
|
-
this.#ProcessMessageResponse(data.data);
|
|
124
|
-
};
|
|
125
|
-
this.#SetupRoute(app, this.#router);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
#ProcessMessageResponse = (data) => {
|
|
129
|
-
const messageResponse = data;
|
|
130
|
-
debug(`STSOAuth2Manager:#ProcessMessageResponse: message data = [${JSON.stringify(messageResponse)}]`.yellow);
|
|
131
|
-
if (messageResponse.messageId === -1) {
|
|
132
|
-
// unsolicted message
|
|
133
|
-
switch (messageResponse.command) {
|
|
134
|
-
case stsoauth2types_1.IOauth2ListenerCommand.AUTHENTICATE_EVENT:
|
|
135
|
-
this.#HandleAuthenticateEvent(messageResponse.payload);
|
|
136
|
-
break;
|
|
137
|
-
case stsoauth2types_1.IOauth2ListenerCommand.ERROR:
|
|
138
|
-
this.#HandleErrorEvent(messageResponse.payload);
|
|
139
|
-
break;
|
|
140
|
-
case stsoauth2types_1.IOauth2ListenerCommand.LOG:
|
|
141
|
-
this.#HandleLogEvent(messageResponse.payload);
|
|
142
|
-
break;
|
|
143
|
-
case stsoauth2types_1.IOauth2ListenerCommand.UPDATE_INSTRUMENT:
|
|
144
|
-
this.#HandleUpdateInstrumentEvent(messageResponse.payload.instrumentName, messageResponse.payload.telemetry);
|
|
145
|
-
break;
|
|
146
|
-
default:
|
|
147
|
-
throw new Error(`ProcessMessageResponse command [${messageResponse.command}] not valid.`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
const callBack = this.#messageHandlers[messageResponse.messageId];
|
|
152
|
-
if (callBack) {
|
|
153
|
-
callBack(messageResponse);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
throw new Error(`Message: [${messageResponse.messageId}] does not exists in callBacks.`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
#PostMessage = (message) => {
|
|
161
|
-
message.messageId = this.#messageId++;
|
|
162
|
-
return new Promise((resolve, reject) => {
|
|
163
|
-
// Setup message timeout
|
|
164
|
-
const timeout = setTimeout(() => {
|
|
165
|
-
delete this.#messageHandlers[message.messageId];
|
|
166
|
-
reject(`Message: [${message.messageId}] timeout error after: [${this.#messageTimeout}] ms.`);
|
|
167
|
-
}, this.#messageTimeout);
|
|
168
|
-
// Setup message callback based on messageId
|
|
169
|
-
this.#messageHandlers[message.messageId] = (response) => {
|
|
170
|
-
clearTimeout(timeout);
|
|
171
|
-
delete this.#messageHandlers[message.messageId];
|
|
172
|
-
debug(`STSOAuth2Manager:#PostMessage: resolve callback response= [${JSON.stringify(response)}]`.yellow);
|
|
173
|
-
resolve(response);
|
|
174
|
-
};
|
|
175
|
-
// Send the message
|
|
176
|
-
debug(`STSOAuth2Manager:#PostMessage: posting message = [${JSON.stringify(message)}]`.yellow);
|
|
177
|
-
this.#oauth2ManagerPort.postMessage(message);
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
#HandleLogEvent = (message) => {
|
|
181
|
-
if (this.#aic) {
|
|
182
|
-
this.#aic.LogEx(message);
|
|
183
|
-
}
|
|
184
|
-
debug(message);
|
|
185
|
-
};
|
|
186
|
-
// UpdateInstrument = (instrumentName: Gauge, telemetry: InstrumentBaseTelemetry): void => {
|
|
187
|
-
#HandleUpdateInstrumentEvent = (instrumentName, telemetry) => {
|
|
188
|
-
if (this.#aic) {
|
|
189
|
-
this.#aic.UpdateInstrument(instrumentName, telemetry);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
#GetStore = () => {
|
|
193
|
-
return (0, stsoauth2store_1.STSOauth2Store)(this.#options.pinia);
|
|
194
|
-
};
|
|
195
|
-
// Will come from message channel
|
|
196
|
-
#HandleErrorEvent = (error) => {
|
|
197
|
-
if (detect_node_1.default) {
|
|
198
|
-
// Node Mode ...
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// User Agent Mode
|
|
202
|
-
this.#GetStore().UpdateError({
|
|
203
|
-
message: error
|
|
204
|
-
});
|
|
205
|
-
// plugin to do this ...
|
|
206
|
-
setTimeout(() => {
|
|
207
|
-
this.#router.replace('/error'); //@@ was push
|
|
208
|
-
}, 0);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
#HandleAuthenticateEvent = (id_token) => {
|
|
212
|
-
if (detect_node_1.default) {
|
|
213
|
-
// Node Mode ...
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
// User Agent Mode
|
|
217
|
-
if (this.#options.authenticateEvent) {
|
|
218
|
-
this.#options.authenticateEvent(id_token);
|
|
219
|
-
}
|
|
220
|
-
this.#GetStore().UpdateIdToken(id_token);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
#SetupRoute = (app, router) => {
|
|
224
|
-
debug(`STSOAuth2Manager:#SetupRoute`.gray); // gray
|
|
225
|
-
router.beforeEach(async (to, from, next) => {
|
|
226
|
-
const oAuth2Manager = app.config.globalProperties.$sts[stsPluginKeys_1.STSOAuth2ManagerPluginKey];
|
|
227
|
-
debug(`beforeEach: from: [${from.path}], to: [${to.path}]`.gray); // gray
|
|
228
|
-
if (this.#GetStore().LoggedIn === false) {
|
|
229
|
-
console.log(`Not logged in`);
|
|
230
|
-
// Not logged in
|
|
231
|
-
if (to.path.localeCompare('/authorize') === 0) {
|
|
232
|
-
console.log(`to = /authorize`);
|
|
233
|
-
next();
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
else if (to.path.localeCompare('/consent') === 0) {
|
|
237
|
-
// Need to check if we are in the correct state, if not - drop back to the start of the process
|
|
238
|
-
if (this.#GetStore().id_token) {
|
|
239
|
-
//if (typeof store.getters.Session.sessionId !== 'undefined') {
|
|
240
|
-
next();
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (to.path.localeCompare('/logout') === 0) {
|
|
245
|
-
next();
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if (to.path.localeCompare('/error') === 0) {
|
|
249
|
-
next();
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (to.path.localeCompare('/config') === 0) {
|
|
253
|
-
next();
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
if (to.path.localeCompare('/redirected') === 0) {
|
|
257
|
-
next();
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const str = to.query;
|
|
261
|
-
// Check if this route is from a redirect from the authorization server
|
|
262
|
-
if (str[stsutils_1.OAuth2ParameterType.CODE] || str[stsutils_1.OAuth2ParameterType.ERROR]) {
|
|
263
|
-
debug(`STSOAuth2Manager:#SetupRoute:Processing redirect: [${JSON.stringify(str)}]`.magenta);
|
|
264
|
-
const retVal = await oAuth2Manager.HandleRedirect(str);
|
|
265
|
-
debug(`STSOAuth2Manager:#SetupRoute:Redirect result: [${retVal}]`.magenta);
|
|
266
|
-
if (retVal) {
|
|
267
|
-
// Success
|
|
268
|
-
next({
|
|
269
|
-
path: '/',
|
|
270
|
-
replace: true
|
|
271
|
-
});
|
|
272
|
-
/*
|
|
273
|
-
setTimeout(() => {
|
|
274
|
-
window.history.replaceState(
|
|
275
|
-
{},
|
|
276
|
-
document.title,
|
|
277
|
-
window.location.origin + '/');
|
|
278
|
-
}, 0);
|
|
279
|
-
*/
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
// Error
|
|
284
|
-
next({
|
|
285
|
-
path: '/error',
|
|
286
|
-
replace: true
|
|
287
|
-
});
|
|
288
|
-
//@@ need the error data here - or use the vuex store ?
|
|
289
|
-
//@@ this.#router.replace('/error'); //@@ was push
|
|
290
|
-
//@@ should replaceState be used as in above?
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
debug(`STSOAuth2Manager:#SetupRoute:Restoring session`);
|
|
295
|
-
const sessionRestored = await oAuth2Manager.RestoreSession();
|
|
296
|
-
debug(`STSOAuth2Manager:#SetupRoute:Session restored: [${sessionRestored}]`);
|
|
297
|
-
if (sessionRestored !== true) {
|
|
298
|
-
debug(`STSOAuth2Manager:#SetupRoute:Session not restored - need to authorize`);
|
|
299
|
-
oAuth2Manager.Authorize();
|
|
300
|
-
next();
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
next('/');
|
|
305
|
-
return;
|
|
306
|
-
//router.replace({ path: '/' })
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
// Prevent pages if already logged in
|
|
311
|
-
if (to.path.localeCompare('/consent') === 0) {
|
|
312
|
-
next('/');
|
|
313
|
-
return;
|
|
314
|
-
/*
|
|
315
|
-
router.replace({ path: '/' })
|
|
316
|
-
return false;
|
|
317
|
-
*/
|
|
318
|
-
}
|
|
319
|
-
if (to.path.localeCompare('/authorize') === 0) {
|
|
320
|
-
next('/');
|
|
321
|
-
//router.replace({ path: '/' })
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (to.path.localeCompare('/logout') === 0) {
|
|
325
|
-
next('/');
|
|
326
|
-
//router.replace({ path: '/' })
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
next();
|
|
330
|
-
/*
|
|
331
|
-
if (to.path.localeCompare('/') === 0) {
|
|
332
|
-
// In case press the back button in the browser shows previous query string params, replace them ...
|
|
333
|
-
setTimeout(() => {
|
|
334
|
-
window.history.replaceState(
|
|
335
|
-
{},
|
|
336
|
-
document.title,
|
|
337
|
-
window.location.origin + '/');
|
|
338
|
-
}, 0);
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
*/
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
};
|
|
345
|
-
//@@ this needs to be re-implemented so that access_token never leaves the auth worker
|
|
346
|
-
GetAccessToken = async () => {
|
|
347
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.ACCESS_TOKEN });
|
|
348
|
-
return response.payload;
|
|
349
|
-
};
|
|
350
|
-
// Update operation protected using operationSemaphore. This may occur when using workers and/or multiple async fetch operations.
|
|
351
|
-
ExecuteRefreshToken = async (retryCount = 0) => {
|
|
352
|
-
if (this.#operationSemaphore === true) {
|
|
353
|
-
if (retryCount > this.#maxSemaphoreRetries) {
|
|
354
|
-
throw new Error(`STSOAuth2Manager:ExecuteRefreshToken:maxSemaphoreRetries: [${this.#maxSemaphoreRetries}] exceeded.`);
|
|
355
|
-
}
|
|
356
|
-
await (0, stsutils_1.Sleep)(this.#semaphoreRetrySleep);
|
|
357
|
-
debug(`STSOAuth2Manager:ExecuteRefreshToken:locked by operationSemaphore, retry count: [${retryCount}]`.cyan);
|
|
358
|
-
return await this.ExecuteRefreshToken(retryCount + 1);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
this.#operationSemaphore = true;
|
|
362
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.EXECUTE_REFRESH_TOKEN });
|
|
363
|
-
this.#operationSemaphore = false;
|
|
364
|
-
return response.payload;
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
368
|
-
GetCookies = async () => {
|
|
369
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.COOKIES });
|
|
370
|
-
return response.payload;
|
|
371
|
-
};
|
|
372
|
-
RestoreSession = async () => {
|
|
373
|
-
try {
|
|
374
|
-
debug(`STSOAuth2Manager:RestoreSession:postMessage: [${stsoauth2types_1.IOauth2ListenerCommand.RESTORE_SESSION}]`);
|
|
375
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.RESTORE_SESSION });
|
|
376
|
-
debug(`STSOAuth2Manager:RestoreSession:response: [${JSON.stringify(response.payload)}]`);
|
|
377
|
-
return response.payload;
|
|
378
|
-
}
|
|
379
|
-
catch (error) {
|
|
380
|
-
console.log(`RestoreSession Error: ${error}`); //red
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
Authorize = async () => {
|
|
385
|
-
try {
|
|
386
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.AUTHORIZE });
|
|
387
|
-
this.#transactionStore.set(this.#STORAGE_AUTHORIZE_OPTIONS_KEY, response.payload.authorizeOptions);
|
|
388
|
-
const url = response.payload.url;
|
|
389
|
-
if (!detect_node_1.default) {
|
|
390
|
-
window.location.replace(url);
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
return response.payload.authorizeOptionsClientCopy;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
catch (error) {
|
|
397
|
-
console.log(`Authorize Error: ${error}`); // red
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
HandleRedirect = async (queryVars) => {
|
|
401
|
-
try {
|
|
402
|
-
debug(`STSOAuth2Manager:HandleRedirect`.magenta);
|
|
403
|
-
let response = null;
|
|
404
|
-
if (queryVars[stsutils_1.OAuth2ParameterType.CODE]) {
|
|
405
|
-
const authorizeOptions = this.#transactionStore.get(this.#STORAGE_AUTHORIZE_OPTIONS_KEY);
|
|
406
|
-
this.#transactionStore.remove(this.#STORAGE_AUTHORIZE_OPTIONS_KEY);
|
|
407
|
-
debug(`STSOAuth2Manager:HandleRedirect: sending HANDLE_REDIRECT command`.magenta);
|
|
408
|
-
response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.HANDLE_REDIRECT, payload: {
|
|
409
|
-
queryVars: queryVars,
|
|
410
|
-
authorizeOptions
|
|
411
|
-
} });
|
|
412
|
-
}
|
|
413
|
-
else {
|
|
414
|
-
response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.HANDLE_REDIRECT, payload: queryVars });
|
|
415
|
-
}
|
|
416
|
-
debug(`STSOAuth2Manager:HandleRedirect: HANDLE_REDIRECT response: [${JSON.stringify(response)}]`.magenta);
|
|
417
|
-
return response.payload;
|
|
418
|
-
}
|
|
419
|
-
catch (error) {
|
|
420
|
-
console.log(`HandleRedirect Error: ${error}`); // red
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
Logout = async () => {
|
|
425
|
-
try {
|
|
426
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.LOGOUT });
|
|
427
|
-
return response.payload;
|
|
428
|
-
}
|
|
429
|
-
catch (error) {
|
|
430
|
-
console.log(`Logout Error: ${error}`); // red
|
|
431
|
-
return false;
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
435
|
-
InvokeExternalAPI = async () => {
|
|
436
|
-
try {
|
|
437
|
-
const response = await this.#PostMessage({ command: stsoauth2types_1.IOauth2ListenerCommand.LOGOUT });
|
|
438
|
-
return response.payload;
|
|
439
|
-
}
|
|
440
|
-
catch (error) {
|
|
441
|
-
console.log(`InvokeExternalAPI Error: ${error}`); // red
|
|
442
|
-
return null;
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
LoggedIn = () => {
|
|
446
|
-
try {
|
|
447
|
-
return this.#GetStore().LoggedIn;
|
|
448
|
-
}
|
|
449
|
-
catch (error) {
|
|
450
|
-
return false;
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
exports.STSOAuth2Manager = STSOAuth2Manager;
|
|
455
|
-
//# sourceMappingURL=stsoauth2manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stsoauth2manager.js","sourceRoot":"","sources":["../src/stsoauth2manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,IAAI,KAAK,GAAG,IAAI,CAAC;AAEjB,gDAA2E;AAE3E,8DAAgC;AAChC,IAAI,qBAAM,EAAE;IACR,KAAK,GAAG,IAAA,eAAK,EAAC,QAAQ,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC;CAC5D;KAAM;IACH,KAAK,GAAG,IAAA,eAAK,EAAC,4BAA4B,CAAC,CAAC;CAC/C;AAED,mDAAoC;AAEpC,sEAA6C;AAC7C,sEAA8C;AAE9C,qDAE6E;AAE7E,qFAAqF;AACrF,sDAA2F;AAI3F,mDAA2D;AAE3D,kDAAkD;AAClD,qEAAqE;AAErE,4DAAwD;AAExD,oEAA6I;AAE7I,0BAA0B;AAC1B,MAAa,gBAAgB;IACzB,+DAA+D;IAC/D,OAAO,GAAQ,IAAI,CAAC;IACpB,OAAO,GAAG,IAAI,qBAAW,EAAE,CAAC;IAC5B,QAAQ,GAAG,IAAI,qBAAW,EAAE,CAAC;IAC7B,8BAA8B,GAAG,iCAAiC,CAAC;IACnE,oBAAoB,GAAG,uBAAuB,CAAC;IAC/C,IAAI,GAAgC,IAAI,CAAC;IACzC,QAAQ,GAA6B,IAAI,CAAC;IAC1C,SAAS,GAA2C,EAAG,CAAC;IACxD,kBAAkB,CAA+B;IACjD,UAAU,GAAG,CAAC,CAAC;IACf,+DAA+D;IAC/D,gBAAgB,G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,KAAK,CAAC;SAChB;IACL,CAAC,CAAA;CAaJ;AArbD,4CAqbC"}
|
package/dist/stsoauth2types.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IOauth2ListenerCommand = exports.OAuthGrantTypes = exports.AuthorizeOptionsResponseMode = exports.AuthorizeOptionsResponseType = void 0;
|
|
4
|
-
var AuthorizeOptionsResponseType;
|
|
5
|
-
(function (AuthorizeOptionsResponseType) {
|
|
6
|
-
AuthorizeOptionsResponseType["CODE"] = "code";
|
|
7
|
-
AuthorizeOptionsResponseType["ID_TOKEN"] = "id_token";
|
|
8
|
-
AuthorizeOptionsResponseType["TOKEN"] = "token";
|
|
9
|
-
})(AuthorizeOptionsResponseType = exports.AuthorizeOptionsResponseType || (exports.AuthorizeOptionsResponseType = {}));
|
|
10
|
-
var AuthorizeOptionsResponseMode;
|
|
11
|
-
(function (AuthorizeOptionsResponseMode) {
|
|
12
|
-
AuthorizeOptionsResponseMode["QUERY"] = "query";
|
|
13
|
-
AuthorizeOptionsResponseMode["FRAGMENT"] = "fragment";
|
|
14
|
-
AuthorizeOptionsResponseMode["FORM_POST"] = "form_post";
|
|
15
|
-
})(AuthorizeOptionsResponseMode = exports.AuthorizeOptionsResponseMode || (exports.AuthorizeOptionsResponseMode = {}));
|
|
16
|
-
var OAuthGrantTypes;
|
|
17
|
-
(function (OAuthGrantTypes) {
|
|
18
|
-
OAuthGrantTypes["CLIENT_CREDENTIALS"] = "client_credentials";
|
|
19
|
-
OAuthGrantTypes["AUTHORIZATION_CODE"] = "authorization_code";
|
|
20
|
-
OAuthGrantTypes["REFRESH_TOKEN"] = "refresh_token";
|
|
21
|
-
})(OAuthGrantTypes = exports.OAuthGrantTypes || (exports.OAuthGrantTypes = {}));
|
|
22
|
-
// ---------------
|
|
23
|
-
var IOauth2ListenerCommand;
|
|
24
|
-
(function (IOauth2ListenerCommand) {
|
|
25
|
-
IOauth2ListenerCommand["RESTORE_SESSION"] = "RestoreSession";
|
|
26
|
-
IOauth2ListenerCommand["AUTHORIZE"] = "Authorize";
|
|
27
|
-
IOauth2ListenerCommand["HANDLE_REDIRECT"] = "HandleRedirect";
|
|
28
|
-
IOauth2ListenerCommand["LOGOUT"] = "Logout";
|
|
29
|
-
IOauth2ListenerCommand["AUTHENTICATE_EVENT"] = "AuthenticateEvent";
|
|
30
|
-
IOauth2ListenerCommand["ERROR"] = "Error";
|
|
31
|
-
IOauth2ListenerCommand["LOG"] = "__LOG";
|
|
32
|
-
IOauth2ListenerCommand["UPDATE_INSTRUMENT"] = "__UPDATE_INSTRUMENT";
|
|
33
|
-
IOauth2ListenerCommand["ID_TOKEN"] = "__ID_TOKEN";
|
|
34
|
-
IOauth2ListenerCommand["ACCESS_TOKEN"] = "__ACCESS_TOKEN";
|
|
35
|
-
IOauth2ListenerCommand["COOKIES"] = "__COOKIES";
|
|
36
|
-
IOauth2ListenerCommand["EXECUTE_REFRESH_TOKEN"] = "__EXECUTE_REFRESH_TOKEN";
|
|
37
|
-
})(IOauth2ListenerCommand = exports.IOauth2ListenerCommand || (exports.IOauth2ListenerCommand = {}));
|
|
38
|
-
//# sourceMappingURL=stsoauth2types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stsoauth2types.js","sourceRoot":"","sources":["../src/stsoauth2types.ts"],"names":[],"mappings":";;;AAEA,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACvC,6CAAa,CAAA;IACb,qDAAqB,CAAA;IACrB,+CAAe,CAAA;AAChB,CAAC,EAJW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAIvC;AAED,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACvC,+CAAe,CAAA;IACf,qDAAqB,CAAA;IACrB,uDAAuB,CAAA;AACxB,CAAC,EAJW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAIvC;AA0BD,IAAY,eAIX;AAJD,WAAY,eAAe;IAC1B,4DAAyC,CAAA;IACzC,4DAAyC,CAAA;IACzC,kDAA+B,CAAA;AAChC,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AA6CD,kBAAkB;AAElB,IAAY,sBAaX;AAbD,WAAY,sBAAsB;IACjC,4DAAkC,CAAA;IAClC,iDAAuB,CAAA;IACvB,4DAAkC,CAAA;IAClC,2CAAiB,CAAA;IACjB,kEAAwC,CAAA;IACxC,yCAAe,CAAA;IACf,uCAAa,CAAA;IACb,mEAAyC,CAAA;IACzC,iDAAuB,CAAA;IACvB,yDAA+B,CAAA;IAC/B,+CAAqB,CAAA;IACrB,2EAAiD,CAAA;AAClD,CAAC,EAbW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAajC"}
|