@vuu-ui/vuu-data-remote 0.13.107 → 0.13.108
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/cjs/ConnectionManager.js +24 -23
- package/cjs/ConnectionManager.js.map +1 -1
- package/cjs/DedicatedWorker.js +6 -1
- package/cjs/DedicatedWorker.js.map +1 -1
- package/cjs/WebSocketConnection.js +17 -11
- package/cjs/WebSocketConnection.js.map +1 -1
- package/cjs/authenticate.js +0 -15
- package/cjs/authenticate.js.map +1 -1
- package/cjs/index.js +0 -9
- package/cjs/index.js.map +1 -1
- package/cjs/inlined-worker.js +343 -259
- package/cjs/inlined-worker.js.map +1 -1
- package/esm/ConnectionManager.js +26 -25
- package/esm/ConnectionManager.js.map +1 -1
- package/esm/DedicatedWorker.js +6 -1
- package/esm/DedicatedWorker.js.map +1 -1
- package/esm/WebSocketConnection.js +17 -11
- package/esm/WebSocketConnection.js.map +1 -1
- package/esm/authenticate.js +1 -15
- package/esm/authenticate.js.map +1 -1
- package/esm/index.js +1 -4
- package/esm/index.js.map +1 -1
- package/esm/inlined-worker.js +343 -259
- package/esm/inlined-worker.js.map +1 -1
- package/package.json +7 -7
- package/types/ConnectionManager.d.ts +6 -5
- package/types/DedicatedWorker.d.ts +2 -1
- package/types/WebSocketConnection.d.ts +38 -19
- package/types/authenticate.d.ts +0 -4
- package/types/index.d.ts +2 -5
- package/types/inlined-worker.d.ts +1 -1
- package/types/server-proxy/server-proxy.d.ts +2 -2
- package/cjs/LostConnectionHandler.js +0 -80
- package/cjs/LostConnectionHandler.js.map +0 -1
- package/cjs/VuuAuthProvider.js +0 -87
- package/cjs/VuuAuthProvider.js.map +0 -1
- package/cjs/VuuAuthenticator.js +0 -50
- package/cjs/VuuAuthenticator.js.map +0 -1
- package/esm/LostConnectionHandler.js +0 -76
- package/esm/LostConnectionHandler.js.map +0 -1
- package/esm/VuuAuthProvider.js +0 -85
- package/esm/VuuAuthProvider.js.map +0 -1
- package/esm/VuuAuthenticator.js +0 -47
- package/esm/VuuAuthenticator.js.map +0 -1
- package/types/LostConnectionHandler.d.ts +0 -28
- package/types/VuuAuthProvider.d.ts +0 -38
- package/types/VuuAuthenticator.d.ts +0 -21
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
class RetryOptionsImpl {
|
|
7
|
-
constructor(retryIntervals) {
|
|
8
|
-
this.retryIntervals = retryIntervals;
|
|
9
|
-
__publicField(this, "ind", 0);
|
|
10
|
-
console.log(`[RetryOptionsImpl] constructor`);
|
|
11
|
-
}
|
|
12
|
-
next() {
|
|
13
|
-
this.ind = Math.min(this.retryIntervals.length, this.ind + 1);
|
|
14
|
-
}
|
|
15
|
-
get remaining() {
|
|
16
|
-
return this.retryIntervals.length - this.ind;
|
|
17
|
-
}
|
|
18
|
-
get interval() {
|
|
19
|
-
if (this.ind === this.retryIntervals.length) {
|
|
20
|
-
return -1;
|
|
21
|
-
} else {
|
|
22
|
-
return this.retryIntervals[this.ind] * 1e3;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function RetryOptions(retryIntervals) {
|
|
27
|
-
if (Array.isArray(retryIntervals)) {
|
|
28
|
-
return new RetryOptionsImpl(retryIntervals);
|
|
29
|
-
} else {
|
|
30
|
-
throw Error("[lostConnectionHandler] RetryOptions, invalid retryIntervals");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const defaultRetryIntervals = [1, 2, 3, 5, 10, 30, 60, 120];
|
|
34
|
-
class RetryGenerator {
|
|
35
|
-
constructor(vuuAuth, options) {
|
|
36
|
-
this.vuuAuth = vuuAuth;
|
|
37
|
-
__publicField(this, "options");
|
|
38
|
-
this.options = options;
|
|
39
|
-
console.log("[RetryGenerator] constructor");
|
|
40
|
-
}
|
|
41
|
-
async *[Symbol.asyncIterator]() {
|
|
42
|
-
let connected = false;
|
|
43
|
-
do {
|
|
44
|
-
await new Promise(
|
|
45
|
-
(resolve) => setTimeout(resolve, this.options.interval)
|
|
46
|
-
);
|
|
47
|
-
try {
|
|
48
|
-
await this.vuuAuth.login();
|
|
49
|
-
connected = true;
|
|
50
|
-
yield "connected";
|
|
51
|
-
} catch (err) {
|
|
52
|
-
}
|
|
53
|
-
this.options.next();
|
|
54
|
-
} while (!connected && this.options.interval !== -1);
|
|
55
|
-
if (connected) {
|
|
56
|
-
return;
|
|
57
|
-
} else {
|
|
58
|
-
yield "connection-failed";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
class LostConnectionHandler {
|
|
63
|
-
constructor(vuuAuth, retryIntervals = defaultRetryIntervals) {
|
|
64
|
-
this.vuuAuth = vuuAuth;
|
|
65
|
-
this.retryIntervals = retryIntervals;
|
|
66
|
-
}
|
|
67
|
-
async reconnect() {
|
|
68
|
-
for await (const result of new RetryGenerator(
|
|
69
|
-
this.vuuAuth,
|
|
70
|
-
RetryOptions(this.retryIntervals)
|
|
71
|
-
)) {
|
|
72
|
-
console.log(` ... async iterator result = ${result}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
exports.LostConnectionHandler = LostConnectionHandler;
|
|
78
|
-
exports.RetryGenerator = RetryGenerator;
|
|
79
|
-
exports.RetryOptions = RetryOptions;
|
|
80
|
-
//# sourceMappingURL=LostConnectionHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LostConnectionHandler.js","sources":["../../../packages/vuu-data-remote/src/LostConnectionHandler.ts"],"sourcesContent":["import { VuuAuthenticator } from \"./VuuAuthenticator\";\n\ninterface RetryOptions {\n interval: number;\n next: () => void;\n remaining: number;\n}\n\nclass RetryOptionsImpl implements RetryOptions {\n private ind = 0;\n constructor(private retryIntervals: number[]) {\n console.log(`[RetryOptionsImpl] constructor`);\n }\n next() {\n this.ind = Math.min(this.retryIntervals.length, this.ind + 1);\n }\n get remaining() {\n return this.retryIntervals.length - this.ind;\n }\n get interval() {\n if (this.ind === this.retryIntervals.length) {\n return -1;\n } else {\n return this.retryIntervals[this.ind] * 1000;\n }\n }\n}\n\nexport function RetryOptions(retryIntervals: number[]) {\n if (Array.isArray(retryIntervals)) {\n return new RetryOptionsImpl(retryIntervals);\n } else {\n throw Error(\"[lostConnectionHandler] RetryOptions, invalid retryIntervals\");\n }\n}\n\nconst defaultRetryIntervals = [1, 2, 3, 5, 10, 30, 60, 120];\n\nexport class RetryGenerator {\n private options: RetryOptions;\n\n constructor(\n private vuuAuth: VuuAuthenticator,\n options: RetryOptions,\n ) {\n this.options = options;\n console.log(\"[RetryGenerator] constructor\");\n }\n\n async *[Symbol.asyncIterator](): AsyncGenerator {\n let connected = false;\n do {\n await new Promise((resolve) =>\n setTimeout(resolve, this.options.interval),\n );\n try {\n await this.vuuAuth.login();\n connected = true;\n yield \"connected\";\n } catch (err) {\n // try again\n }\n this.options.next();\n } while (!connected && this.options.interval !== -1);\n if (connected) {\n return;\n } else {\n yield \"connection-failed\";\n }\n }\n}\n\nexport class LostConnectionHandler {\n constructor(\n private vuuAuth: VuuAuthenticator,\n private retryIntervals = defaultRetryIntervals,\n ) {}\n async reconnect() {\n for await (const result of new RetryGenerator(\n this.vuuAuth,\n RetryOptions(this.retryIntervals),\n )) {\n console.log(` ... async iterator result = ${result}`);\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAQA,MAAM,gBAAyC,CAAA;AAAA,EAE7C,YAAoB,cAA0B,EAAA;AAA1B,IAAA,IAAA,CAAA,cAAA,GAAA,cAAA;AADpB,IAAA,aAAA,CAAA,IAAA,EAAQ,KAAM,EAAA,CAAA,CAAA;AAEZ,IAA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,IAAG,GAAA;AACD,MAAA,MAAM,IAAI,OAAA;AAAA,QAAQ,CAAC,OACjB,KAAA,UAAA,CAAW,OAAS,EAAA,IAAA,CAAK,QAAQ,QAAQ;AAAA,OAC3C;AACA,MAAI,IAAA;AACF,QAAM,MAAA,IAAA,CAAK,QAAQ,KAAM,EAAA;AACzB,QAAY,SAAA,GAAA,IAAA;AACZ,QAAM,MAAA,WAAA;AAAA,eACC,GAAK,EAAA;AAAA;AAGd,MAAA,IAAA,CAAK,QAAQ,IAAK,EAAA;AAAA,KACX,QAAA,CAAC,SAAa,IAAA,IAAA,CAAK,QAAQ,QAAa,KAAA,CAAA,CAAA;AACjD,IAAA,IAAI,SAAW,EAAA;AACb,MAAA;AAAA,KACK,MAAA;AACL,MAAM,MAAA,mBAAA;AAAA;AACR;AAEJ;AAEO,MAAM,qBAAsB,CAAA;AAAA,EACjC,WAAA,CACU,OACA,EAAA,cAAA,GAAiB,qBACzB,EAAA;AAFQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,cAAA,GAAA,cAAA;AAAA;AACP,EACH,MAAM,SAAY,GAAA;AAChB,IAAA,WAAA,MAAiB,UAAU,IAAI,cAAA;AAAA,MAC7B,IAAK,CAAA,OAAA;AAAA,MACL,YAAA,CAAa,KAAK,cAAc;AAAA,KAC/B,EAAA;AACD,MAAQ,OAAA,CAAA,GAAA,CAAI,CAAiC,8BAAA,EAAA,MAAM,CAAE,CAAA,CAAA;AAAA;AACvD;AAEJ;;;;;;"}
|
package/cjs/VuuAuthProvider.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
4
|
-
var authenticate = require('./authenticate.js');
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
9
|
-
class VuuAuthProvider {
|
|
10
|
-
constructor(authEndpoint) {
|
|
11
|
-
this.authEndpoint = authEndpoint;
|
|
12
|
-
__publicField(this, "login", async (username, password) => {
|
|
13
|
-
const date = /* @__PURE__ */ new Date();
|
|
14
|
-
const days = 1;
|
|
15
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
16
|
-
if (username && password) {
|
|
17
|
-
const { token } = await this.getVuuTokenWithUsernameAndPassword(
|
|
18
|
-
username,
|
|
19
|
-
password
|
|
20
|
-
);
|
|
21
|
-
document.cookie = `vuu-auth-user=${username};expires=${date.toUTCString()};path=/`;
|
|
22
|
-
document.cookie = `vuu-auth-password=${password};expires=${date.toUTCString()};path=/`;
|
|
23
|
-
document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;
|
|
24
|
-
return this.redirectToApplication();
|
|
25
|
-
} else {
|
|
26
|
-
const userName = vuuUtils.getCookieValue("vuu-auth-user");
|
|
27
|
-
const password2 = vuuUtils.getCookieValue("vuu-auth-password");
|
|
28
|
-
if (userName && password2) {
|
|
29
|
-
const { authorizations, token } = await this.getVuuTokenWithUsernameAndPassword(userName, password2);
|
|
30
|
-
document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;
|
|
31
|
-
return {
|
|
32
|
-
authorizations,
|
|
33
|
-
user: {
|
|
34
|
-
userName
|
|
35
|
-
},
|
|
36
|
-
token
|
|
37
|
-
};
|
|
38
|
-
} else {
|
|
39
|
-
return this.redirectToLoginPage();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async getVuuTokenWithUsernameAndPassword(username, password) {
|
|
45
|
-
const response = await fetch(this.authEndpoint, {
|
|
46
|
-
method: "POST",
|
|
47
|
-
credentials: "include",
|
|
48
|
-
headers: {
|
|
49
|
-
"Content-Type": "application/json",
|
|
50
|
-
"access-control-allow-origin": location.host
|
|
51
|
-
},
|
|
52
|
-
body: JSON.stringify({
|
|
53
|
-
username,
|
|
54
|
-
password
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
if (response.ok) {
|
|
58
|
-
const vuuAuthToken = response.headers.get("vuu-auth-token");
|
|
59
|
-
if (typeof vuuAuthToken === "string" && vuuAuthToken.length > 0) {
|
|
60
|
-
const { authorizations } = authenticate.parseVuuUserFromToken(vuuAuthToken);
|
|
61
|
-
return { authorizations, token: vuuAuthToken };
|
|
62
|
-
} else {
|
|
63
|
-
throw Error(`Authentication failed auth token not returned by server`);
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
throw Error(`Authentication failed, ${response.status}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
clear() {
|
|
70
|
-
document.cookie = "vuu-auth-user= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
71
|
-
document.cookie = "vuu-auth-password= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
72
|
-
document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
73
|
-
}
|
|
74
|
-
redirectToLoginPage() {
|
|
75
|
-
window.location.href = "login.html";
|
|
76
|
-
}
|
|
77
|
-
redirectToApplication() {
|
|
78
|
-
window.location.href = "index.html";
|
|
79
|
-
}
|
|
80
|
-
logout() {
|
|
81
|
-
this.clear();
|
|
82
|
-
this.redirectToLoginPage();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
exports.VuuAuthProvider = VuuAuthProvider;
|
|
87
|
-
//# sourceMappingURL=VuuAuthProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VuuAuthProvider.js","sources":["../../../packages/vuu-data-remote/src/VuuAuthProvider.ts"],"sourcesContent":["import { getCookieValue } from \"@vuu-ui/vuu-utils\";\nimport { parseVuuUserFromToken } from \"./authenticate\";\n\nexport type User = {\n userName: string;\n};\n\nexport interface AuthProvider {\n login: (\n username?: string,\n password?: string,\n ) => Promise<{ authorizations: string[]; token: string; user: User }>;\n logout: () => void;\n}\n\n/**\n * The Vuu AuthProvider is a simple Demoware auth provider that\n * grabs username and pasdsword from. a simple login form and\n * exchanges these for a Vuu Token. Password is manipulated in\n * plain text, hence not suitable for real world usage.\n *\n * This AuthProvider is used by the login panel, which sets\n * user credentials in cookies.\n * It is then used by the application itself to retrieve the\n * credentials and login to vuu.\n */\nexport class VuuAuthProvider implements AuthProvider {\n constructor(private authEndpoint: string) {}\n\n login = async (username?: string, password?: string) => {\n const date = new Date();\n const days = 1;\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n\n if (username && password) {\n // coming from login panel\n\n // TODO what if the authorizations have changed\n const { token } = await this.getVuuTokenWithUsernameAndPassword(\n username,\n password,\n );\n document.cookie = `vuu-auth-user=${username};expires=${date.toUTCString()};path=/`;\n document.cookie = `vuu-auth-password=${password};expires=${date.toUTCString()};path=/`;\n document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;\n return this.redirectToApplication() as never;\n } else {\n const userName = getCookieValue(\"vuu-auth-user\");\n const password = getCookieValue(\"vuu-auth-password\");\n if (userName && password) {\n const { authorizations, token } =\n await this.getVuuTokenWithUsernameAndPassword(userName, password);\n document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;\n\n return {\n authorizations,\n user: {\n userName,\n },\n token,\n };\n } else {\n return this.redirectToLoginPage() as never;\n }\n }\n };\n\n private async getVuuTokenWithUsernameAndPassword(\n username: string,\n password: string,\n ) {\n const response = await fetch(this.authEndpoint, {\n method: \"POST\",\n credentials: \"include\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"access-control-allow-origin\": location.host,\n },\n body: JSON.stringify({\n username,\n password,\n }),\n });\n\n if (response.ok) {\n const vuuAuthToken = response.headers.get(\"vuu-auth-token\");\n if (typeof vuuAuthToken === \"string\" && vuuAuthToken.length > 0) {\n const { authorizations } = parseVuuUserFromToken(vuuAuthToken);\n return { authorizations, token: vuuAuthToken };\n } else {\n throw Error(`Authentication failed auth token not returned by server`);\n }\n } else {\n throw Error(`Authentication failed, ${response.status}`);\n }\n }\n\n private clear() {\n document.cookie =\n \"vuu-auth-user= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie =\n \"vuu-auth-password= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie =\n \"vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n }\n\n private redirectToLoginPage() {\n window.location.href = \"login.html\";\n }\n\n private redirectToApplication() {\n window.location.href = \"index.html\";\n }\n\n logout() {\n this.clear();\n this.redirectToLoginPage();\n }\n}\n"],"names":["getCookieValue","password","parseVuuUserFromToken"],"mappings":";;;;;;;;AA0BO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAoB,YAAsB,EAAA;AAAtB,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAEpB,IAAQ,aAAA,CAAA,IAAA,EAAA,OAAA,EAAA,OAAO,UAAmB,QAAsB,KAAA;AACtD,MAAM,MAAA,IAAA,uBAAW,IAAK,EAAA;AACtB,MAAA,MAAM,IAAO,GAAA,CAAA;AACb,MAAK,IAAA,CAAA,OAAA,CAAQ,KAAK,OAAQ,EAAA,GAAI,OAAO,EAAK,GAAA,EAAA,GAAK,KAAK,GAAI,CAAA;AAExD,MAAA,IAAI,YAAY,QAAU,EAAA;AAIxB,QAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAM,IAAK,CAAA,kCAAA;AAAA,UAC3B,QAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,QAAA,CAAS,SAAS,CAAiB,cAAA,EAAA,QAAQ,CAAY,SAAA,EAAA,IAAA,CAAK,aAAa,CAAA,OAAA,CAAA;AACzE,QAAA,QAAA,CAAS,SAAS,CAAqB,kBAAA,EAAA,QAAQ,CAAY,SAAA,EAAA,IAAA,CA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I,gBAAgB,CAAA;AAC1D,MAAA,IAAI,OAAO,YAAA,KAAiB,QAAY,IAAA,YAAA,CAAa,SAAS,CAAG,EAAA;AAC/D,QAAA,MAAM,EAAE,cAAA,EAAmB,GAAAC,kCAAA,CAAsB,YAAY,CAAA;AAC7D,QAAO,OAAA,EAAE,cAAgB,EAAA,KAAA,EAAO,YAAa,EAAA;AAAA,OACxC,MAAA;AACL,QAAA,MAAM,MAAM,CAAyD,uDAAA,CAAA,CAAA;AAAA;AACvE,KACK,MAAA;AACL,MAAA,MAAM,KAAM,CAAA,CAAA,uBAAA,EAA0B,QAAS,CAAA,MAAM,CAAE,CAAA,CAAA;AAAA;AACzD;AACF,EAEQ,KAAQ,GAAA;AACd,IAAA,QAAA,CAAS,MACP,GAAA,0DAAA;AACF,IAAA,QAAA,CAAS,MACP,GAAA,8DAAA;AACF,IAAA,QAAA,CAAS,MACP,GAAA,2DAAA;AAAA;AACJ,EAEQ,mBAAsB,GAAA;AAC5B,IAAA,MAAA,CAAO,SAAS,IAAO,GAAA,YAAA;AAAA;AACzB,EAEQ,qBAAwB,GAAA;AAC9B,IAAA,MAAA,CAAO,SAAS,IAAO,GAAA,YAAA;AAAA;AACzB,EAEA,MAAS,GAAA;AACP,IAAA,IAAA,CAAK,KAAM,EAAA;AACX,IAAA,IAAA,CAAK,mBAAoB,EAAA;AAAA;AAE7B;;;;"}
|
package/cjs/VuuAuthenticator.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var ConnectionManager = require('./ConnectionManager.js');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
-
const VuuAuthTokenIssuePolicy = {
|
|
9
|
-
BearerToken: "bearer-token",
|
|
10
|
-
UsernamePassword: "username-password"
|
|
11
|
-
};
|
|
12
|
-
class VuuAuthenticator {
|
|
13
|
-
constructor({
|
|
14
|
-
authProvider,
|
|
15
|
-
authTokenIssuePolicy = VuuAuthTokenIssuePolicy.BearerToken,
|
|
16
|
-
websocketUrl
|
|
17
|
-
}) {
|
|
18
|
-
__publicField(this, "authProvider");
|
|
19
|
-
__publicField(this, "authTokenIssuePolicy");
|
|
20
|
-
__publicField(this, "websocketUrl");
|
|
21
|
-
__publicField(this, "openWebsocketConnection", async (vuuToken) => {
|
|
22
|
-
await ConnectionManager.connect(
|
|
23
|
-
{
|
|
24
|
-
url: this.websocketUrl,
|
|
25
|
-
token: vuuToken
|
|
26
|
-
},
|
|
27
|
-
true
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
__publicField(this, "login", async () => {
|
|
31
|
-
const { authorizations, user, token } = await this.authProvider.login();
|
|
32
|
-
if (token && user) {
|
|
33
|
-
await this.openWebsocketConnection(token);
|
|
34
|
-
return [user, authorizations];
|
|
35
|
-
} else {
|
|
36
|
-
throw Error("[VuuAuthenticator] login failed");
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
__publicField(this, "logout", () => {
|
|
40
|
-
this.authProvider.logout();
|
|
41
|
-
});
|
|
42
|
-
this.authProvider = authProvider;
|
|
43
|
-
this.authTokenIssuePolicy = authTokenIssuePolicy;
|
|
44
|
-
this.websocketUrl = websocketUrl;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
exports.VuuAuthTokenIssuePolicy = VuuAuthTokenIssuePolicy;
|
|
49
|
-
exports.VuuAuthenticator = VuuAuthenticator;
|
|
50
|
-
//# sourceMappingURL=VuuAuthenticator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VuuAuthenticator.js","sources":["../../../packages/vuu-data-remote/src/VuuAuthenticator.ts"],"sourcesContent":["import ConnectionManager from \"./ConnectionManager\";\nimport { ValueOf } from \"@vuu-ui/vuu-utils\";\nimport { User, type AuthProvider } from \"./VuuAuthProvider\";\n\nexport const VuuAuthTokenIssuePolicy = {\n BearerToken: \"bearer-token\",\n UsernamePassword: \"username-password\",\n} as const;\n\nexport type VuuAuthTokenIssuePolicy = ValueOf<typeof VuuAuthTokenIssuePolicy>;\n\nexport interface VuuAuthenticatorConstructorOptions {\n authProvider: AuthProvider;\n authTokenIssuePolicy?: VuuAuthTokenIssuePolicy;\n websocketUrl: string;\n}\n\nexport class VuuAuthenticator {\n private authProvider: AuthProvider;\n private authTokenIssuePolicy: VuuAuthTokenIssuePolicy;\n private websocketUrl: string;\n\n constructor({\n authProvider,\n authTokenIssuePolicy = VuuAuthTokenIssuePolicy.BearerToken,\n websocketUrl,\n }: VuuAuthenticatorConstructorOptions) {\n this.authProvider = authProvider;\n this.authTokenIssuePolicy = authTokenIssuePolicy;\n this.websocketUrl = websocketUrl;\n }\n\n private openWebsocketConnection = async (vuuToken: string) => {\n await ConnectionManager.connect(\n {\n url: this.websocketUrl,\n token: vuuToken,\n },\n true,\n );\n };\n\n login = async (): Promise<[User, string[]] | never> => {\n const { authorizations, user, token } = await this.authProvider.login();\n if (token && user) {\n await this.openWebsocketConnection(token);\n return [user, authorizations];\n } else {\n throw Error(\"[VuuAuthenticator] login failed\");\n }\n };\n\n logout = () => {\n this.authProvider.logout();\n };\n}\n"],"names":[],"mappings":";;;;;;;AAIO,MAAM,uBAA0B,GAAA;AAAA,EACrC,WAAa,EAAA,cAAA;AAAA,EACb,gBAAkB,EAAA;AACpB;AAUO,MAAM,gBAAiB,CAAA;AAAA,EAK5B,WAAY,CAAA;AAAA,IACV,YAAA;AAAA,IACA,uBAAuB,uBAAwB,CAAA,WAAA;AAAA,IAC/C;AAAA,GACqC,EAAA;AARvC,IAAQ,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AACR,IAAQ,aAAA,CAAA,IAAA,EAAA,sBAAA,CAAA;AACR,IAAQ,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AAYR,IAAQ,aAAA,CAAA,IAAA,EAAA,yBAAA,EAA0B,OAAO,QAAqB,KAAA;AAC5D,MAAA,MAAM,iBAAkB,CAAA,OAAA;AAAA,QACtB;AAAA,UACE,KAAK,IAAK,CAAA,YAAA;AAAA,UACV,KAAO,EAAA;AAAA,SACT;AAAA,QACA;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,EAAQ,YAA+C;AACrD,MAAM,MAAA,EAAE,gBAAgB,IAAM,EAAA,KAAA,KAAU,MAAM,IAAA,CAAK,aAAa,KAAM,EAAA;AACtE,MAAA,IAAI,SAAS,IAAM,EAAA;AACjB,QAAM,MAAA,IAAA,CAAK,wBAAwB,KAAK,CAAA;AACxC,QAAO,OAAA,CAAC,MAAM,cAAc,CAAA;AAAA,OACvB,MAAA;AACL,QAAA,MAAM,MAAM,iCAAiC,CAAA;AAAA;AAC/C,KACF,CAAA;AAEA,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,EAAS,MAAM;AACb,MAAA,IAAA,CAAK,aAAa,MAAO,EAAA;AAAA,KAC3B,CAAA;AA3BE,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AACpB,IAAA,IAAA,CAAK,oBAAuB,GAAA,oBAAA;AAC5B,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AAAA;AA0BxB;;;;;"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
class RetryOptionsImpl {
|
|
5
|
-
constructor(retryIntervals) {
|
|
6
|
-
this.retryIntervals = retryIntervals;
|
|
7
|
-
__publicField(this, "ind", 0);
|
|
8
|
-
console.log(`[RetryOptionsImpl] constructor`);
|
|
9
|
-
}
|
|
10
|
-
next() {
|
|
11
|
-
this.ind = Math.min(this.retryIntervals.length, this.ind + 1);
|
|
12
|
-
}
|
|
13
|
-
get remaining() {
|
|
14
|
-
return this.retryIntervals.length - this.ind;
|
|
15
|
-
}
|
|
16
|
-
get interval() {
|
|
17
|
-
if (this.ind === this.retryIntervals.length) {
|
|
18
|
-
return -1;
|
|
19
|
-
} else {
|
|
20
|
-
return this.retryIntervals[this.ind] * 1e3;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function RetryOptions(retryIntervals) {
|
|
25
|
-
if (Array.isArray(retryIntervals)) {
|
|
26
|
-
return new RetryOptionsImpl(retryIntervals);
|
|
27
|
-
} else {
|
|
28
|
-
throw Error("[lostConnectionHandler] RetryOptions, invalid retryIntervals");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const defaultRetryIntervals = [1, 2, 3, 5, 10, 30, 60, 120];
|
|
32
|
-
class RetryGenerator {
|
|
33
|
-
constructor(vuuAuth, options) {
|
|
34
|
-
this.vuuAuth = vuuAuth;
|
|
35
|
-
__publicField(this, "options");
|
|
36
|
-
this.options = options;
|
|
37
|
-
console.log("[RetryGenerator] constructor");
|
|
38
|
-
}
|
|
39
|
-
async *[Symbol.asyncIterator]() {
|
|
40
|
-
let connected = false;
|
|
41
|
-
do {
|
|
42
|
-
await new Promise(
|
|
43
|
-
(resolve) => setTimeout(resolve, this.options.interval)
|
|
44
|
-
);
|
|
45
|
-
try {
|
|
46
|
-
await this.vuuAuth.login();
|
|
47
|
-
connected = true;
|
|
48
|
-
yield "connected";
|
|
49
|
-
} catch (err) {
|
|
50
|
-
}
|
|
51
|
-
this.options.next();
|
|
52
|
-
} while (!connected && this.options.interval !== -1);
|
|
53
|
-
if (connected) {
|
|
54
|
-
return;
|
|
55
|
-
} else {
|
|
56
|
-
yield "connection-failed";
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
class LostConnectionHandler {
|
|
61
|
-
constructor(vuuAuth, retryIntervals = defaultRetryIntervals) {
|
|
62
|
-
this.vuuAuth = vuuAuth;
|
|
63
|
-
this.retryIntervals = retryIntervals;
|
|
64
|
-
}
|
|
65
|
-
async reconnect() {
|
|
66
|
-
for await (const result of new RetryGenerator(
|
|
67
|
-
this.vuuAuth,
|
|
68
|
-
RetryOptions(this.retryIntervals)
|
|
69
|
-
)) {
|
|
70
|
-
console.log(` ... async iterator result = ${result}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { LostConnectionHandler, RetryGenerator, RetryOptions };
|
|
76
|
-
//# sourceMappingURL=LostConnectionHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LostConnectionHandler.js","sources":["../../../packages/vuu-data-remote/src/LostConnectionHandler.ts"],"sourcesContent":["import { VuuAuthenticator } from \"./VuuAuthenticator\";\n\ninterface RetryOptions {\n interval: number;\n next: () => void;\n remaining: number;\n}\n\nclass RetryOptionsImpl implements RetryOptions {\n private ind = 0;\n constructor(private retryIntervals: number[]) {\n console.log(`[RetryOptionsImpl] constructor`);\n }\n next() {\n this.ind = Math.min(this.retryIntervals.length, this.ind + 1);\n }\n get remaining() {\n return this.retryIntervals.length - this.ind;\n }\n get interval() {\n if (this.ind === this.retryIntervals.length) {\n return -1;\n } else {\n return this.retryIntervals[this.ind] * 1000;\n }\n }\n}\n\nexport function RetryOptions(retryIntervals: number[]) {\n if (Array.isArray(retryIntervals)) {\n return new RetryOptionsImpl(retryIntervals);\n } else {\n throw Error(\"[lostConnectionHandler] RetryOptions, invalid retryIntervals\");\n }\n}\n\nconst defaultRetryIntervals = [1, 2, 3, 5, 10, 30, 60, 120];\n\nexport class RetryGenerator {\n private options: RetryOptions;\n\n constructor(\n private vuuAuth: VuuAuthenticator,\n options: RetryOptions,\n ) {\n this.options = options;\n console.log(\"[RetryGenerator] constructor\");\n }\n\n async *[Symbol.asyncIterator](): AsyncGenerator {\n let connected = false;\n do {\n await new Promise((resolve) =>\n setTimeout(resolve, this.options.interval),\n );\n try {\n await this.vuuAuth.login();\n connected = true;\n yield \"connected\";\n } catch (err) {\n // try again\n }\n this.options.next();\n } while (!connected && this.options.interval !== -1);\n if (connected) {\n return;\n } else {\n yield \"connection-failed\";\n }\n }\n}\n\nexport class LostConnectionHandler {\n constructor(\n private vuuAuth: VuuAuthenticator,\n private retryIntervals = defaultRetryIntervals,\n ) {}\n async reconnect() {\n for await (const result of new RetryGenerator(\n this.vuuAuth,\n RetryOptions(this.retryIntervals),\n )) {\n console.log(` ... async iterator result = ${result}`);\n }\n }\n}\n"],"names":[],"mappings":";;;AAQA,MAAM,gBAAyC,CAAA;AAAA,EAE7C,YAAoB,cAA0B,EAAA;AAA1B,IAAA,IAAA,CAAA,cAAA,GAAA,cAAA;AADpB,IAAA,aAAA,CAAA,IAAA,EAAQ,KAAM,EAAA,CAAA,CAAA;AAEZ,IAAA,OAAA,CAAQ,IAAI,CAAgC,8BAAA,CAAA,CAAA;AAAA;AAC9C,EACA,IAAO,GAAA;AACL,IAAK,IAAA,CAAA,GAAA,GAAM,KAAK,GAAI,CAAA,IAAA,CAAK,eAAe,MAAQ,EAAA,IAAA,CAAK,MAAM,CAAC,CAAA;AAAA;AAC9D,EACA,IAAI,SAAY,GAAA;AACd,IAAO,OAAA,IAAA,CAAK,cAAe,CAAA,MAAA,GAAS,IAAK,CAAA,GAAA;AAAA;AAC3C,EACA,IAAI,QAAW,GAAA;AACb,IAAA,IAAI,IAAK,CAAA,GAAA,KAAQ,IAAK,CAAA,cAAA,CAAe,MAAQ,EAAA;AAC3C,MAAO,OAAA,CAAA,CAAA;AAAA,KACF,MAAA;AACL,MAAA,OAAO,IAAK,CAAA,cAAA,CAAe,IAAK,CAAA,GAAG,CAAI,GAAA,GAAA;AAAA;AACzC;AAEJ;AAEO,SAAS,aAAa,cAA0B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zB,EAAA;AAFQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AACA,IAAA,IAAA,CAAA,cAAA,GAAA,cAAA;AAAA;AACP,EACH,MAAM,SAAY,GAAA;AAChB,IAAA,WAAA,MAAiB,UAAU,IAAI,cAAA;AAAA,MAC7B,IAAK,CAAA,OAAA;AAAA,MACL,YAAA,CAAa,KAAK,cAAc;AAAA,KAC/B,EAAA;AACD,MAAQ,OAAA,CAAA,GAAA,CAAI,CAAiC,8BAAA,EAAA,MAAM,CAAE,CAAA,CAAA;AAAA;AACvD;AAEJ;;;;"}
|
package/esm/VuuAuthProvider.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { getCookieValue } from '@vuu-ui/vuu-utils';
|
|
2
|
-
import { parseVuuUserFromToken } from './authenticate.js';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
7
|
-
class VuuAuthProvider {
|
|
8
|
-
constructor(authEndpoint) {
|
|
9
|
-
this.authEndpoint = authEndpoint;
|
|
10
|
-
__publicField(this, "login", async (username, password) => {
|
|
11
|
-
const date = /* @__PURE__ */ new Date();
|
|
12
|
-
const days = 1;
|
|
13
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
14
|
-
if (username && password) {
|
|
15
|
-
const { token } = await this.getVuuTokenWithUsernameAndPassword(
|
|
16
|
-
username,
|
|
17
|
-
password
|
|
18
|
-
);
|
|
19
|
-
document.cookie = `vuu-auth-user=${username};expires=${date.toUTCString()};path=/`;
|
|
20
|
-
document.cookie = `vuu-auth-password=${password};expires=${date.toUTCString()};path=/`;
|
|
21
|
-
document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;
|
|
22
|
-
return this.redirectToApplication();
|
|
23
|
-
} else {
|
|
24
|
-
const userName = getCookieValue("vuu-auth-user");
|
|
25
|
-
const password2 = getCookieValue("vuu-auth-password");
|
|
26
|
-
if (userName && password2) {
|
|
27
|
-
const { authorizations, token } = await this.getVuuTokenWithUsernameAndPassword(userName, password2);
|
|
28
|
-
document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;
|
|
29
|
-
return {
|
|
30
|
-
authorizations,
|
|
31
|
-
user: {
|
|
32
|
-
userName
|
|
33
|
-
},
|
|
34
|
-
token
|
|
35
|
-
};
|
|
36
|
-
} else {
|
|
37
|
-
return this.redirectToLoginPage();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async getVuuTokenWithUsernameAndPassword(username, password) {
|
|
43
|
-
const response = await fetch(this.authEndpoint, {
|
|
44
|
-
method: "POST",
|
|
45
|
-
credentials: "include",
|
|
46
|
-
headers: {
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
"access-control-allow-origin": location.host
|
|
49
|
-
},
|
|
50
|
-
body: JSON.stringify({
|
|
51
|
-
username,
|
|
52
|
-
password
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
if (response.ok) {
|
|
56
|
-
const vuuAuthToken = response.headers.get("vuu-auth-token");
|
|
57
|
-
if (typeof vuuAuthToken === "string" && vuuAuthToken.length > 0) {
|
|
58
|
-
const { authorizations } = parseVuuUserFromToken(vuuAuthToken);
|
|
59
|
-
return { authorizations, token: vuuAuthToken };
|
|
60
|
-
} else {
|
|
61
|
-
throw Error(`Authentication failed auth token not returned by server`);
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
throw Error(`Authentication failed, ${response.status}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
clear() {
|
|
68
|
-
document.cookie = "vuu-auth-user= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
69
|
-
document.cookie = "vuu-auth-password= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
70
|
-
document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
71
|
-
}
|
|
72
|
-
redirectToLoginPage() {
|
|
73
|
-
window.location.href = "login.html";
|
|
74
|
-
}
|
|
75
|
-
redirectToApplication() {
|
|
76
|
-
window.location.href = "index.html";
|
|
77
|
-
}
|
|
78
|
-
logout() {
|
|
79
|
-
this.clear();
|
|
80
|
-
this.redirectToLoginPage();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export { VuuAuthProvider };
|
|
85
|
-
//# sourceMappingURL=VuuAuthProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VuuAuthProvider.js","sources":["../../../packages/vuu-data-remote/src/VuuAuthProvider.ts"],"sourcesContent":["import { getCookieValue } from \"@vuu-ui/vuu-utils\";\nimport { parseVuuUserFromToken } from \"./authenticate\";\n\nexport type User = {\n userName: string;\n};\n\nexport interface AuthProvider {\n login: (\n username?: string,\n password?: string,\n ) => Promise<{ authorizations: string[]; token: string; user: User }>;\n logout: () => void;\n}\n\n/**\n * The Vuu AuthProvider is a simple Demoware auth provider that\n * grabs username and pasdsword from. a simple login form and\n * exchanges these for a Vuu Token. Password is manipulated in\n * plain text, hence not suitable for real world usage.\n *\n * This AuthProvider is used by the login panel, which sets\n * user credentials in cookies.\n * It is then used by the application itself to retrieve the\n * credentials and login to vuu.\n */\nexport class VuuAuthProvider implements AuthProvider {\n constructor(private authEndpoint: string) {}\n\n login = async (username?: string, password?: string) => {\n const date = new Date();\n const days = 1;\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n\n if (username && password) {\n // coming from login panel\n\n // TODO what if the authorizations have changed\n const { token } = await this.getVuuTokenWithUsernameAndPassword(\n username,\n password,\n );\n document.cookie = `vuu-auth-user=${username};expires=${date.toUTCString()};path=/`;\n document.cookie = `vuu-auth-password=${password};expires=${date.toUTCString()};path=/`;\n document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;\n return this.redirectToApplication() as never;\n } else {\n const userName = getCookieValue(\"vuu-auth-user\");\n const password = getCookieValue(\"vuu-auth-password\");\n if (userName && password) {\n const { authorizations, token } =\n await this.getVuuTokenWithUsernameAndPassword(userName, password);\n document.cookie = `vuu-auth-token=${token};expires=${date.toUTCString()};path=/`;\n\n return {\n authorizations,\n user: {\n userName,\n },\n token,\n };\n } else {\n return this.redirectToLoginPage() as never;\n }\n }\n };\n\n private async getVuuTokenWithUsernameAndPassword(\n username: string,\n password: string,\n ) {\n const response = await fetch(this.authEndpoint, {\n method: \"POST\",\n credentials: \"include\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"access-control-allow-origin\": location.host,\n },\n body: JSON.stringify({\n username,\n password,\n }),\n });\n\n if (response.ok) {\n const vuuAuthToken = response.headers.get(\"vuu-auth-token\");\n if (typeof vuuAuthToken === \"string\" && vuuAuthToken.length > 0) {\n const { authorizations } = parseVuuUserFromToken(vuuAuthToken);\n return { authorizations, token: vuuAuthToken };\n } else {\n throw Error(`Authentication failed auth token not returned by server`);\n }\n } else {\n throw Error(`Authentication failed, ${response.status}`);\n }\n }\n\n private clear() {\n document.cookie =\n \"vuu-auth-user= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie =\n \"vuu-auth-password= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie =\n \"vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n }\n\n private redirectToLoginPage() {\n window.location.href = \"login.html\";\n }\n\n private redirectToApplication() {\n window.location.href = \"index.html\";\n }\n\n logout() {\n this.clear();\n this.redirectToLoginPage();\n }\n}\n"],"names":["password"],"mappings":";;;;;;AA0BO,MAAM,eAAwC,CAAA;AAAA,EACnD,YAAoB,YAAsB,EAAA;AAAtB,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAEpB,IAAQ,aAAA,CAAA,IAAA,EAAA,OAAA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B,GAAA;AAC9B,IAAA,MAAA,CAAO,SAAS,IAAO,GAAA,YAAA;AAAA;AACzB,EAEA,MAAS,GAAA;AACP,IAAA,IAAA,CAAK,KAAM,EAAA;AACX,IAAA,IAAA,CAAK,mBAAoB,EAAA;AAAA;AAE7B;;;;"}
|
package/esm/VuuAuthenticator.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import ConnectionManager from './ConnectionManager.js';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
const VuuAuthTokenIssuePolicy = {
|
|
7
|
-
BearerToken: "bearer-token",
|
|
8
|
-
UsernamePassword: "username-password"
|
|
9
|
-
};
|
|
10
|
-
class VuuAuthenticator {
|
|
11
|
-
constructor({
|
|
12
|
-
authProvider,
|
|
13
|
-
authTokenIssuePolicy = VuuAuthTokenIssuePolicy.BearerToken,
|
|
14
|
-
websocketUrl
|
|
15
|
-
}) {
|
|
16
|
-
__publicField(this, "authProvider");
|
|
17
|
-
__publicField(this, "authTokenIssuePolicy");
|
|
18
|
-
__publicField(this, "websocketUrl");
|
|
19
|
-
__publicField(this, "openWebsocketConnection", async (vuuToken) => {
|
|
20
|
-
await ConnectionManager.connect(
|
|
21
|
-
{
|
|
22
|
-
url: this.websocketUrl,
|
|
23
|
-
token: vuuToken
|
|
24
|
-
},
|
|
25
|
-
true
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
__publicField(this, "login", async () => {
|
|
29
|
-
const { authorizations, user, token } = await this.authProvider.login();
|
|
30
|
-
if (token && user) {
|
|
31
|
-
await this.openWebsocketConnection(token);
|
|
32
|
-
return [user, authorizations];
|
|
33
|
-
} else {
|
|
34
|
-
throw Error("[VuuAuthenticator] login failed");
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
__publicField(this, "logout", () => {
|
|
38
|
-
this.authProvider.logout();
|
|
39
|
-
});
|
|
40
|
-
this.authProvider = authProvider;
|
|
41
|
-
this.authTokenIssuePolicy = authTokenIssuePolicy;
|
|
42
|
-
this.websocketUrl = websocketUrl;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { VuuAuthTokenIssuePolicy, VuuAuthenticator };
|
|
47
|
-
//# sourceMappingURL=VuuAuthenticator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VuuAuthenticator.js","sources":["../../../packages/vuu-data-remote/src/VuuAuthenticator.ts"],"sourcesContent":["import ConnectionManager from \"./ConnectionManager\";\nimport { ValueOf } from \"@vuu-ui/vuu-utils\";\nimport { User, type AuthProvider } from \"./VuuAuthProvider\";\n\nexport const VuuAuthTokenIssuePolicy = {\n BearerToken: \"bearer-token\",\n UsernamePassword: \"username-password\",\n} as const;\n\nexport type VuuAuthTokenIssuePolicy = ValueOf<typeof VuuAuthTokenIssuePolicy>;\n\nexport interface VuuAuthenticatorConstructorOptions {\n authProvider: AuthProvider;\n authTokenIssuePolicy?: VuuAuthTokenIssuePolicy;\n websocketUrl: string;\n}\n\nexport class VuuAuthenticator {\n private authProvider: AuthProvider;\n private authTokenIssuePolicy: VuuAuthTokenIssuePolicy;\n private websocketUrl: string;\n\n constructor({\n authProvider,\n authTokenIssuePolicy = VuuAuthTokenIssuePolicy.BearerToken,\n websocketUrl,\n }: VuuAuthenticatorConstructorOptions) {\n this.authProvider = authProvider;\n this.authTokenIssuePolicy = authTokenIssuePolicy;\n this.websocketUrl = websocketUrl;\n }\n\n private openWebsocketConnection = async (vuuToken: string) => {\n await ConnectionManager.connect(\n {\n url: this.websocketUrl,\n token: vuuToken,\n },\n true,\n );\n };\n\n login = async (): Promise<[User, string[]] | never> => {\n const { authorizations, user, token } = await this.authProvider.login();\n if (token && user) {\n await this.openWebsocketConnection(token);\n return [user, authorizations];\n } else {\n throw Error(\"[VuuAuthenticator] login failed\");\n }\n };\n\n logout = () => {\n this.authProvider.logout();\n };\n}\n"],"names":[],"mappings":";;;;;AAIO,MAAM,uBAA0B,GAAA;AAAA,EACrC,WAAa,EAAA,cAAA;AAAA,EACb,gBAAkB,EAAA;AACpB;AAUO,MAAM,gBAAiB,CAAA;AAAA,EAK5B,WAAY,CAAA;AAAA,IACV,YAAA;AAAA,IACA,uBAAuB,uBAAwB,CAAA,WAAA;AAAA,IAC/C;AAAA,GACqC,EAAA;AARvC,IAAQ,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AACR,IAAQ,aAAA,CAAA,IAAA,EAAA,sBAAA,CAAA;AACR,IAAQ,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AAYR,IAAQ,aAAA,CAAA,IAAA,EAAA,yBAAA,EAA0B,OAAO,QAAqB,KAAA;AAC5D,MAAA,MAAM,iBAAkB,CAAA,OAAA;AAAA,QACtB;AAAA,UACE,KAAK,IAAK,CAAA,YAAA;AAAA,UACV,KAAO,EAAA;AAAA,SACT;AAAA,QACA;AAAA,OACF;AAAA,KACF,CAAA;AAEA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,EAAQ,YAA+C;AACrD,MAAM,MAAA,EAAE,gBAAgB,IAAM,EAAA,KAAA,KAAU,MAAM,IAAA,CAAK,aAAa,KAAM,EAAA;AACtE,MAAA,IAAI,SAAS,IAAM,EAAA;AACjB,QAAM,MAAA,IAAA,CAAK,wBAAwB,KAAK,CAAA;AACxC,QAAO,OAAA,CAAC,MAAM,cAAc,CAAA;AAAA,OACvB,MAAA;AACL,QAAA,MAAM,MAAM,iCAAiC,CAAA;AAAA;AAC/C,KACF,CAAA;AAEA,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,EAAS,MAAM;AACb,MAAA,IAAA,CAAK,aAAa,MAAO,EAAA;AAAA,KAC3B,CAAA;AA3BE,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AACpB,IAAA,IAAA,CAAK,oBAAuB,GAAA,oBAAA;AAC5B,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AAAA;AA0BxB;;;;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { VuuAuthenticator } from "./VuuAuthenticator";
|
|
2
|
-
interface RetryOptions {
|
|
3
|
-
interval: number;
|
|
4
|
-
next: () => void;
|
|
5
|
-
remaining: number;
|
|
6
|
-
}
|
|
7
|
-
declare class RetryOptionsImpl implements RetryOptions {
|
|
8
|
-
private retryIntervals;
|
|
9
|
-
private ind;
|
|
10
|
-
constructor(retryIntervals: number[]);
|
|
11
|
-
next(): void;
|
|
12
|
-
get remaining(): number;
|
|
13
|
-
get interval(): number;
|
|
14
|
-
}
|
|
15
|
-
export declare function RetryOptions(retryIntervals: number[]): RetryOptionsImpl;
|
|
16
|
-
export declare class RetryGenerator {
|
|
17
|
-
private vuuAuth;
|
|
18
|
-
private options;
|
|
19
|
-
constructor(vuuAuth: VuuAuthenticator, options: RetryOptions);
|
|
20
|
-
[Symbol.asyncIterator](): AsyncGenerator;
|
|
21
|
-
}
|
|
22
|
-
export declare class LostConnectionHandler {
|
|
23
|
-
private vuuAuth;
|
|
24
|
-
private retryIntervals;
|
|
25
|
-
constructor(vuuAuth: VuuAuthenticator, retryIntervals?: number[]);
|
|
26
|
-
reconnect(): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export type User = {
|
|
2
|
-
userName: string;
|
|
3
|
-
};
|
|
4
|
-
export interface AuthProvider {
|
|
5
|
-
login: (username?: string, password?: string) => Promise<{
|
|
6
|
-
authorizations: string[];
|
|
7
|
-
token: string;
|
|
8
|
-
user: User;
|
|
9
|
-
}>;
|
|
10
|
-
logout: () => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The Vuu AuthProvider is a simple Demoware auth provider that
|
|
14
|
-
* grabs username and pasdsword from. a simple login form and
|
|
15
|
-
* exchanges these for a Vuu Token. Password is manipulated in
|
|
16
|
-
* plain text, hence not suitable for real world usage.
|
|
17
|
-
*
|
|
18
|
-
* This AuthProvider is used by the login panel, which sets
|
|
19
|
-
* user credentials in cookies.
|
|
20
|
-
* It is then used by the application itself to retrieve the
|
|
21
|
-
* credentials and login to vuu.
|
|
22
|
-
*/
|
|
23
|
-
export declare class VuuAuthProvider implements AuthProvider {
|
|
24
|
-
private authEndpoint;
|
|
25
|
-
constructor(authEndpoint: string);
|
|
26
|
-
login: (username?: string, password?: string) => Promise<{
|
|
27
|
-
authorizations: string[];
|
|
28
|
-
user: {
|
|
29
|
-
userName: string;
|
|
30
|
-
};
|
|
31
|
-
token: string;
|
|
32
|
-
}>;
|
|
33
|
-
private getVuuTokenWithUsernameAndPassword;
|
|
34
|
-
private clear;
|
|
35
|
-
private redirectToLoginPage;
|
|
36
|
-
private redirectToApplication;
|
|
37
|
-
logout(): void;
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ValueOf } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { User, type AuthProvider } from "./VuuAuthProvider";
|
|
3
|
-
export declare const VuuAuthTokenIssuePolicy: {
|
|
4
|
-
readonly BearerToken: "bearer-token";
|
|
5
|
-
readonly UsernamePassword: "username-password";
|
|
6
|
-
};
|
|
7
|
-
export type VuuAuthTokenIssuePolicy = ValueOf<typeof VuuAuthTokenIssuePolicy>;
|
|
8
|
-
export interface VuuAuthenticatorConstructorOptions {
|
|
9
|
-
authProvider: AuthProvider;
|
|
10
|
-
authTokenIssuePolicy?: VuuAuthTokenIssuePolicy;
|
|
11
|
-
websocketUrl: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class VuuAuthenticator {
|
|
14
|
-
private authProvider;
|
|
15
|
-
private authTokenIssuePolicy;
|
|
16
|
-
private websocketUrl;
|
|
17
|
-
constructor({ authProvider, authTokenIssuePolicy, websocketUrl, }: VuuAuthenticatorConstructorOptions);
|
|
18
|
-
private openWebsocketConnection;
|
|
19
|
-
login: () => Promise<[User, string[]] | never>;
|
|
20
|
-
logout: () => void;
|
|
21
|
-
}
|