@sassoftware/viya-serverjs 0.2.4 → 0.4.0
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/.babelrc +6 -6
- package/.dockerignore +2 -2
- package/.env +29 -29
- package/.env.proxy +32 -32
- package/.env.server +30 -30
- package/.eslintignore +3 -3
- package/.eslintrc.json +42 -42
- package/Dockerfile +44 -44
- package/README.md +99 -99
- package/cli.js +9 -9
- package/lib/config.js +16 -16
- package/lib/handlers/appCallback.js +23 -24
- package/lib/handlers/codeAuth.js +17 -18
- package/lib/handlers/decodeJwt.js +3 -3
- package/lib/handlers/favicon.js +22 -25
- package/lib/handlers/getApp.js +20 -21
- package/lib/handlers/getApp2.js +22 -25
- package/lib/handlers/getUser.js +14 -17
- package/lib/handlers/index.js +3 -3
- package/lib/handlers/keepAlive.js +28 -31
- package/lib/handlers/keepAlive2.js +9 -12
- package/lib/handlers/logon.js +12 -15
- package/lib/handlers/logout.js +24 -28
- package/lib/handlers/proxyMapUri.js +6 -11
- package/lib/handlers/proxyOnResponse.js +6 -7
- package/lib/handlers/reactDev.js +22 -25
- package/lib/handlers/setCookies.js +52 -53
- package/lib/iService.js +106 -104
- package/lib/index.js +23 -21
- package/lib/parseDocker.js +3 -3
- package/lib/plugins/SASauth.js +30 -32
- package/lib/plugins/appCookie.js +36 -38
- package/lib/plugins/setContext.js +22 -25
- package/lib/plugins/setDefaultRoutes.js +61 -58
- package/lib/plugins/setupAuth.js +35 -38
- package/lib/plugins/setupUserRoutes.js +16 -16
- package/lib/plugins/token.js +9 -10
- package/lib/schemes/SASTokenScheme.js +24 -27
- package/package.json +85 -79
- package/public/data/Cluster_SDOH1.sas +181 -181
- package/public/data/Cluster_SDOH6.sas +179 -179
- package/public/data/NeuralNetwork_High_med.sas +2408 -2408
- package/public/data/NeuralNetwork_high_med1.sas +2408 -2408
- package/public/data/cars.csv +429 -429
- package/public/data/cmdList.txt +15 -15
- package/public/data/iris.csv +151 -151
- package/public/index.html +355 -360
- package/public/indexProxy.html +351 -351
- package/public/simplesubmit.html +233 -0
- package/server.js +362 -362
- package/src/config.js +90 -90
- package/src/handlers/appCallback.js +40 -40
- package/src/handlers/codeAuth.js +31 -31
- package/src/handlers/decodeJwt.js +10 -10
- package/src/handlers/favicon.js +23 -23
- package/src/handlers/getApp.js +52 -52
- package/src/handlers/getApp2.js +25 -25
- package/src/handlers/getUser.js +20 -20
- package/src/handlers/index.js +36 -36
- package/src/handlers/keepAlive.js +53 -53
- package/src/handlers/keepAlive2.js +12 -12
- package/src/handlers/logon.js +23 -23
- package/src/handlers/logout.js +42 -42
- package/src/handlers/proxyMapUri.js +25 -25
- package/src/handlers/proxyOnResponse.js +11 -11
- package/src/handlers/reactDev.js +29 -29
- package/src/handlers/setCookies.js +81 -79
- package/src/iService.js +346 -347
- package/src/index.js +251 -249
- package/src/parseDocker.js +32 -32
- package/src/plugins/SASauth.js +78 -78
- package/src/plugins/appCookie.js +51 -49
- package/src/plugins/setContext.js +33 -33
- package/src/plugins/setDefaultRoutes.js +256 -253
- package/src/plugins/setupAuth.js +49 -49
- package/src/plugins/setupUserRoutes.js +47 -47
- package/src/plugins/token.js +10 -10
- package/src/schemes/SASTokenScheme.js +43 -43
- package/src/visionIndex.html +23 -23
- package/start.sh +14 -14
- package/tls/viyatls.sh +2 -2
package/lib/plugins/setupAuth.js
CHANGED
|
@@ -4,26 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
function
|
|
8
|
-
function
|
|
7
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
8
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
9
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
10
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
|
-
/*
|
|
12
|
-
* ------------------------------------------------------------------------------------
|
|
13
|
-
* * Copyright (c) SAS Institute Inc.
|
|
14
|
-
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* * you may not use this file except in compliance with the License.
|
|
16
|
-
* * You may obtain a copy of the License at
|
|
17
|
-
* *
|
|
18
|
-
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
* *
|
|
20
|
-
* * Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* * See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
* ----------------------------------------------------------------------------------------
|
|
26
|
-
*
|
|
11
|
+
/*
|
|
12
|
+
* ------------------------------------------------------------------------------------
|
|
13
|
+
* * Copyright (c) SAS Institute Inc.
|
|
14
|
+
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
* * you may not use this file except in compliance with the License.
|
|
16
|
+
* * You may obtain a copy of the License at
|
|
17
|
+
* *
|
|
18
|
+
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
* *
|
|
20
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
* * See the License for the specific language governing permissions and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
* ----------------------------------------------------------------------------------------
|
|
26
|
+
*
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
var SASauth = require('./SASauth');
|
|
@@ -32,53 +32,50 @@ var token = require('./token');
|
|
|
32
32
|
var setDefaultRoutes = require('./setDefaultRoutes');
|
|
33
33
|
var log = require('debug')('auth');
|
|
34
34
|
|
|
35
|
-
/** Notes:
|
|
36
|
-
* If api then register sasAuth and token - no cookies
|
|
37
|
-
* If app, then register sasAuth and cookie(session) but no token
|
|
35
|
+
/** Notes:
|
|
36
|
+
* If api then register sasAuth and token - no cookies
|
|
37
|
+
* If app, then register sasAuth and cookie(session) but no token
|
|
38
38
|
*/
|
|
39
39
|
function setupAuth(_x, _x2) {
|
|
40
40
|
return _setupAuth.apply(this, arguments);
|
|
41
41
|
}
|
|
42
42
|
function _setupAuth() {
|
|
43
|
-
_setupAuth = _asyncToGenerator(/*#__PURE__*/
|
|
43
|
+
_setupAuth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(server, options) {
|
|
44
44
|
var def;
|
|
45
|
-
return
|
|
46
|
-
while (1) switch (_context.
|
|
45
|
+
return _regenerator().w(function (_context) {
|
|
46
|
+
while (1) switch (_context.n) {
|
|
47
47
|
case 0:
|
|
48
48
|
if (!(options.authFlow === 'server')) {
|
|
49
|
-
_context.
|
|
49
|
+
_context.n = 5;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
|
-
_context.
|
|
52
|
+
_context.n = 1;
|
|
53
53
|
return server.register({
|
|
54
54
|
plugin: SASauth,
|
|
55
55
|
options: options
|
|
56
56
|
});
|
|
57
|
-
case
|
|
58
|
-
_context.
|
|
57
|
+
case 1:
|
|
58
|
+
_context.n = 2;
|
|
59
59
|
return appCookie(server, options);
|
|
60
|
-
case
|
|
60
|
+
case 2:
|
|
61
61
|
def = 'session';
|
|
62
62
|
if (!(options.serverMode === 'api')) {
|
|
63
|
-
_context.
|
|
63
|
+
_context.n = 4;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
_context.
|
|
66
|
+
_context.n = 3;
|
|
67
67
|
return server.register({
|
|
68
68
|
plugin: token
|
|
69
69
|
});
|
|
70
|
-
case
|
|
70
|
+
case 3:
|
|
71
71
|
def = 'token';
|
|
72
|
-
case
|
|
72
|
+
case 4:
|
|
73
73
|
log('***********************Default auth', def);
|
|
74
74
|
server.auth["default"](def);
|
|
75
75
|
// console.log(server.registerations);
|
|
76
|
-
case
|
|
76
|
+
case 5:
|
|
77
77
|
setDefaultRoutes(server, options);
|
|
78
|
-
return _context.
|
|
79
|
-
case 14:
|
|
80
|
-
case "end":
|
|
81
|
-
return _context.stop();
|
|
78
|
+
return _context.a(2, true);
|
|
82
79
|
}
|
|
83
80
|
}, _callee);
|
|
84
81
|
}));
|
|
@@ -11,22 +11,22 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
15
|
-
* ------------------------------------------------------------------------------------
|
|
16
|
-
* Copyright (c) SAS Institute Inc.
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
* ---------------------------------------------------------------------------------------
|
|
29
|
-
*
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
15
|
+
* ------------------------------------------------------------------------------------
|
|
16
|
+
* Copyright (c) SAS Institute Inc.
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
* ---------------------------------------------------------------------------------------
|
|
29
|
+
*
|
|
30
30
|
*/
|
|
31
31
|
function setupUserRoutes(u, options) {
|
|
32
32
|
if (u == null) {
|
package/lib/plugins/token.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
function
|
|
3
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
5
5
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
6
6
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
7
7
|
exports.plugin = {
|
|
@@ -13,17 +13,16 @@ function itoken(_x) {
|
|
|
13
13
|
return _itoken.apply(this, arguments);
|
|
14
14
|
}
|
|
15
15
|
function _itoken() {
|
|
16
|
-
_itoken = _asyncToGenerator(/*#__PURE__*/
|
|
17
|
-
return
|
|
18
|
-
while (1) switch (_context.
|
|
16
|
+
_itoken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(server) {
|
|
17
|
+
return _regenerator().w(function (_context) {
|
|
18
|
+
while (1) switch (_context.n) {
|
|
19
19
|
case 0:
|
|
20
|
-
_context.
|
|
20
|
+
_context.n = 1;
|
|
21
21
|
return server.auth.scheme('SAStoken', require('../schemes/SASTokenScheme'));
|
|
22
|
-
case
|
|
22
|
+
case 1:
|
|
23
23
|
server.auth.strategy('token', 'SAStoken');
|
|
24
|
-
case
|
|
25
|
-
|
|
26
|
-
return _context.stop();
|
|
24
|
+
case 2:
|
|
25
|
+
return _context.a(2);
|
|
27
26
|
}
|
|
28
27
|
}, _callee);
|
|
29
28
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
function
|
|
3
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
5
5
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
7
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -10,22 +10,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
10
10
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
11
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
|
-
/*
|
|
14
|
-
* ------------------------------------------------------------------------------------
|
|
15
|
-
* Copyright (c) SAS Institute Inc.
|
|
16
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License.
|
|
18
|
-
* You may obtain a copy of the License at
|
|
19
|
-
*
|
|
20
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
-
* See the License for the specific language governing permissions and
|
|
26
|
-
* limitations under the License.
|
|
27
|
-
* ---------------------------------------------------------------------------------------
|
|
28
|
-
*
|
|
13
|
+
/*
|
|
14
|
+
* ------------------------------------------------------------------------------------
|
|
15
|
+
* Copyright (c) SAS Institute Inc.
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License.
|
|
18
|
+
* You may obtain a copy of the License at
|
|
19
|
+
*
|
|
20
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
* See the License for the specific language governing permissions and
|
|
26
|
+
* limitations under the License.
|
|
27
|
+
* ---------------------------------------------------------------------------------------
|
|
28
|
+
*
|
|
29
29
|
*/
|
|
30
30
|
// lean code to handle of incoming tokens if present
|
|
31
31
|
// designed to used with appCookie and SASauth
|
|
@@ -34,30 +34,27 @@ var Boom = require('@hapi/boom');
|
|
|
34
34
|
module.exports = function SASTokenScheme(server, options) {
|
|
35
35
|
var scheme = {
|
|
36
36
|
authenticate: function () {
|
|
37
|
-
var _authenticate = _asyncToGenerator(/*#__PURE__*/
|
|
37
|
+
var _authenticate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request, h) {
|
|
38
38
|
var authorization, _authorization$split, _authorization$split2, tokenType, token, credentials;
|
|
39
|
-
return
|
|
40
|
-
while (1) switch (_context.
|
|
39
|
+
return _regenerator().w(function (_context) {
|
|
40
|
+
while (1) switch (_context.n) {
|
|
41
41
|
case 0:
|
|
42
42
|
authorization = request.headers.authorization;
|
|
43
43
|
server.log('SASToken', authorization);
|
|
44
44
|
if (authorization) {
|
|
45
|
-
_context.
|
|
45
|
+
_context.n = 1;
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
48
48
|
throw Boom.unauthorized(null, 'session');
|
|
49
|
-
case
|
|
49
|
+
case 1:
|
|
50
50
|
_authorization$split = authorization.split(' '), _authorization$split2 = _slicedToArray(_authorization$split, 2), tokenType = _authorization$split2[0], token = _authorization$split2[1];
|
|
51
51
|
credentials = {
|
|
52
52
|
token: token,
|
|
53
53
|
tokenType: tokenType
|
|
54
54
|
};
|
|
55
|
-
return _context.
|
|
55
|
+
return _context.a(2, h.authenticated({
|
|
56
56
|
credentials: credentials
|
|
57
57
|
}));
|
|
58
|
-
case 7:
|
|
59
|
-
case "end":
|
|
60
|
-
return _context.stop();
|
|
61
58
|
}
|
|
62
59
|
}, _callee);
|
|
63
60
|
}));
|
package/package.json
CHANGED
|
@@ -1,79 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sassoftware/viya-serverjs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Easy to use app server for SAS Viya applications",
|
|
5
|
-
"author": "Deva Kumaraswamy <deva.kumar@sas.com>",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
|
-
"bin": {
|
|
9
|
-
"@sassoftware/viya-appserverjs": "cli.js"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"restaf",
|
|
13
|
-
"Viya",
|
|
14
|
-
"SAS",
|
|
15
|
-
"server",
|
|
16
|
-
"RESTAPI"
|
|
17
|
-
],
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=20.4.0"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/sassoftware/viya-server#readme",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://github.com/sassoftware/viya-server.git"
|
|
25
|
-
},
|
|
26
|
-
"bugs": {
|
|
27
|
-
"url": "https://github.com/sassoftware/viya-server/issues"
|
|
28
|
-
},
|
|
29
|
-
"unpkg": "./lib/index.js",
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "rimraf lib && babel src --out-dir lib",
|
|
32
|
-
"test": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@hapi/
|
|
42
|
-
"@hapi/
|
|
43
|
-
"@hapi/
|
|
44
|
-
"@hapi/
|
|
45
|
-
"@hapi/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"@babel/
|
|
69
|
-
"@babel/
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@sassoftware/viya-serverjs",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Easy to use app server for SAS Viya applications",
|
|
5
|
+
"author": "Deva Kumaraswamy <deva.kumar@sas.com>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"@sassoftware/viya-appserverjs": "cli.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"restaf",
|
|
13
|
+
"Viya",
|
|
14
|
+
"SAS",
|
|
15
|
+
"server",
|
|
16
|
+
"RESTAPI"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20.4.0"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/sassoftware/viya-server#readme",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/sassoftware/viya-server.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/sassoftware/viya-server/issues"
|
|
28
|
+
},
|
|
29
|
+
"unpkg": "./lib/index.js",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "rimraf lib && babel src --out-dir lib",
|
|
32
|
+
"test": "node cli --env=./.env --docker=./Dockerfile",
|
|
33
|
+
"submit": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 APPENTRY=simplesubmit.html node cli --env=./.env --docker=./Dockerfile",
|
|
34
|
+
"server": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node server.js --env=./.env.server --docker=./Dockerfile",
|
|
35
|
+
"debug": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node --inspect-brk server.js --env=./.env.server --docker=./Dockerfile",
|
|
36
|
+
"proxy": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node cli --env=./.env.proxy --docker=./Dockerfile",
|
|
37
|
+
"pub": "npm publish --tag dev --access public",
|
|
38
|
+
"lint": "npx eslint --fix src/*.js"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@hapi/bell": "^13.1.0",
|
|
42
|
+
"@hapi/boom": "^10.0.1",
|
|
43
|
+
"@hapi/cookie": "^12.0.1",
|
|
44
|
+
"@hapi/h2o2": "^10.0.4",
|
|
45
|
+
"@hapi/hapi": "^21.4.4",
|
|
46
|
+
"@hapi/inert": "^7.1.0",
|
|
47
|
+
"@hapi/vision": "^7.0.3",
|
|
48
|
+
"axios": "^1.13.2",
|
|
49
|
+
"core-js": "^3.47.0",
|
|
50
|
+
"cross-spawn": "^7.0.6",
|
|
51
|
+
"debug": "^4.4.3",
|
|
52
|
+
"docker-file-parser": "^1.0.7",
|
|
53
|
+
"eslint-config-prettier": "^10.1.8",
|
|
54
|
+
"handlebars": "^4.7.8",
|
|
55
|
+
"hapi-require-https": "^6.0.0",
|
|
56
|
+
"joi": "^18.0.2",
|
|
57
|
+
"jwt-decode": "^4.0.0",
|
|
58
|
+
"node-cache-promise": "^1.0.2",
|
|
59
|
+
"only": "0.0.2",
|
|
60
|
+
"qs": "^6.14.0",
|
|
61
|
+
"regenerator-runtime": "^0.14.1",
|
|
62
|
+
"request-debug": "^0.2.0",
|
|
63
|
+
"selfsigned": "^5.4.0",
|
|
64
|
+
"uuid": "^13.0.0",
|
|
65
|
+
"yargs": "18.0.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@babel/cli": "^7.28.3",
|
|
69
|
+
"@babel/core": "^7.28.5",
|
|
70
|
+
"@babel/eslint-parser": "7.28.5",
|
|
71
|
+
"@babel/preset-env": "^7.28.5",
|
|
72
|
+
"cross-env": "^10.1.0",
|
|
73
|
+
"eslint": "^9.39.2",
|
|
74
|
+
"prettier": "^3.7.4",
|
|
75
|
+
"rimraf": "^6.1.2",
|
|
76
|
+
"shx": "^0.4.0"
|
|
77
|
+
},
|
|
78
|
+
"resolutions": {
|
|
79
|
+
"@babel/traverse": "7.26.10"
|
|
80
|
+
},
|
|
81
|
+
"overrides": {
|
|
82
|
+
"gopd": "1.2.0",
|
|
83
|
+
"get-intrinsic": "1.2.7"
|
|
84
|
+
}
|
|
85
|
+
}
|