@sassoftware/viya-serverjs 0.3.0 → 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 -28
- 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 +82 -87
- 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 +354 -350
- 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 -345
- 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/iService.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
+
var _file = require("@hapi/inert/lib/file");
|
|
8
9
|
var _setupAuth = _interopRequireDefault(require("./plugins/setupAuth"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
function
|
|
11
|
+
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 }; })(); }
|
|
12
|
+
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); }
|
|
11
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
14
|
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; }
|
|
13
15
|
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; }
|
|
@@ -21,22 +23,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
21
23
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
24
|
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); }
|
|
23
25
|
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); }); }; }
|
|
24
|
-
/*
|
|
25
|
-
* ------------------------------------------------------------------------------------
|
|
26
|
-
* * Copyright (c) SAS Institute Inc.
|
|
27
|
-
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
28
|
-
* * you may not use this file except in compliance with the License.
|
|
29
|
-
* * You may obtain a copy of the License at
|
|
30
|
-
* *
|
|
31
|
-
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
-
* *
|
|
33
|
-
* * Unless required by applicable law or agreed to in writing, software
|
|
34
|
-
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
35
|
-
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36
|
-
* * See the License for the specific language governing permissions and
|
|
37
|
-
* limitations under the License.
|
|
38
|
-
* ----------------------------------------------------------------------------------------
|
|
39
|
-
*
|
|
26
|
+
/*
|
|
27
|
+
* ------------------------------------------------------------------------------------
|
|
28
|
+
* * Copyright (c) SAS Institute Inc.
|
|
29
|
+
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
30
|
+
* * you may not use this file except in compliance with the License.
|
|
31
|
+
* * You may obtain a copy of the License at
|
|
32
|
+
* *
|
|
33
|
+
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
34
|
+
* *
|
|
35
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
36
|
+
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
37
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
38
|
+
* * See the License for the specific language governing permissions and
|
|
39
|
+
* limitations under the License.
|
|
40
|
+
* ----------------------------------------------------------------------------------------
|
|
41
|
+
*
|
|
40
42
|
*/
|
|
41
43
|
|
|
42
44
|
var fs = require('fs');
|
|
@@ -54,10 +56,10 @@ var os = require('os');
|
|
|
54
56
|
function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, userInfo) {
|
|
55
57
|
// process.env.APPHOST_ADDR = process.env.APPHOST;
|
|
56
58
|
var init = /*#__PURE__*/function () {
|
|
57
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
59
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
58
60
|
var defaultMaxBytes, maxBytes, isSameSite, isSecure, _process$env$SAMESITE, _process$env$SAMESITE2, s1, s2, sConfig, hapiServer, nodeCacheOptions, storeCache, visionOptions, options, swaggerOptions, override, allRoutes, hh, msg;
|
|
59
|
-
return
|
|
60
|
-
while (1) switch (_context.
|
|
61
|
+
return _regenerator().w(function (_context) {
|
|
62
|
+
while (1) switch (_context.n) {
|
|
61
63
|
case 0:
|
|
62
64
|
if (process.env.APPHOST === '*') {
|
|
63
65
|
process.env.APPHOST = os.hostname();
|
|
@@ -93,10 +95,10 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
93
95
|
origin: ['*'],
|
|
94
96
|
credentials: true,
|
|
95
97
|
"headers": ["Accept", "Authorization", "Content-Type", "If-None-Match", "Accept-language"]
|
|
96
|
-
/*
|
|
97
|
-
'Access-Control-Allow-Methods': ['GET', 'POST', 'OPTIONS'],
|
|
98
|
-
additionalHeaders : ['multipart/form-data', 'content-disposition'],
|
|
99
|
-
additionalExposedHeaders : ['location'],
|
|
98
|
+
/*
|
|
99
|
+
'Access-Control-Allow-Methods': ['GET', 'POST', 'OPTIONS'],
|
|
100
|
+
additionalHeaders : ['multipart/form-data', 'content-disposition'],
|
|
101
|
+
additionalExposedHeaders : ['location'],
|
|
100
102
|
*/
|
|
101
103
|
}
|
|
102
104
|
}
|
|
@@ -108,19 +110,19 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
108
110
|
}
|
|
109
111
|
debug(JSON.stringify(sConfig, null, 4));
|
|
110
112
|
if (!(process.env.HTTPS === 'true')) {
|
|
111
|
-
_context.
|
|
113
|
+
_context.n = 2;
|
|
112
114
|
break;
|
|
113
115
|
}
|
|
114
|
-
_context.
|
|
116
|
+
_context.n = 1;
|
|
115
117
|
return getCertificates();
|
|
116
|
-
case
|
|
117
|
-
sConfig.tls = _context.
|
|
118
|
+
case 1:
|
|
119
|
+
sConfig.tls = _context.v;
|
|
118
120
|
debug('Setup of SSL certificates completed');
|
|
119
|
-
_context.
|
|
121
|
+
_context.n = 3;
|
|
120
122
|
break;
|
|
121
|
-
case
|
|
123
|
+
case 2:
|
|
122
124
|
debug('Running with no SSL certificates');
|
|
123
|
-
case
|
|
125
|
+
case 3:
|
|
124
126
|
if (asset !== null) {
|
|
125
127
|
sConfig.routes.files = {
|
|
126
128
|
relativeTo: asset
|
|
@@ -128,9 +130,9 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
128
130
|
}
|
|
129
131
|
debug2("Application information: \n\t\tAPPLOC : ".concat(process.env.APPLOC, "\n\t\tAPPENTRY: ").concat(process.env.APPENTRY, "\n"));
|
|
130
132
|
hapiServer = Hapi.server(sConfig);
|
|
131
|
-
/*
|
|
132
|
-
const cache = hapiServer.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 });
|
|
133
|
-
hapiServer.app.cache = cache;
|
|
133
|
+
/*
|
|
134
|
+
const cache = hapiServer.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 });
|
|
135
|
+
hapiServer.app.cache = cache;
|
|
134
136
|
*/
|
|
135
137
|
nodeCacheOptions = {
|
|
136
138
|
stdTTL: 24 * 60 * 60 * 1000,
|
|
@@ -150,34 +152,34 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
150
152
|
relativeTo: __dirname,
|
|
151
153
|
path: '.'
|
|
152
154
|
};
|
|
153
|
-
_context.
|
|
155
|
+
_context.n = 4;
|
|
154
156
|
return hapiServer.register(Vision);
|
|
155
|
-
case
|
|
157
|
+
case 4:
|
|
156
158
|
hapiServer.views(visionOptions);
|
|
157
|
-
_context.
|
|
159
|
+
_context.n = 5;
|
|
158
160
|
return hapiServer.register(inert);
|
|
159
|
-
case
|
|
161
|
+
case 5:
|
|
160
162
|
if (!(process.env.HTTPS === 'true')) {
|
|
161
|
-
_context.
|
|
163
|
+
_context.n = 6;
|
|
162
164
|
break;
|
|
163
165
|
}
|
|
164
|
-
_context.
|
|
166
|
+
_context.n = 6;
|
|
165
167
|
return hapiServer.register({
|
|
166
168
|
plugin: require('hapi-require-https'),
|
|
167
169
|
options: {}
|
|
168
170
|
});
|
|
169
|
-
case
|
|
170
|
-
_context.
|
|
171
|
+
case 6:
|
|
172
|
+
_context.n = 7;
|
|
171
173
|
return hapiServer.register(H202);
|
|
172
|
-
case
|
|
173
|
-
/*
|
|
174
|
-
await hapiServer.register({
|
|
175
|
-
plugin : require('hapi-pino'),
|
|
176
|
-
options: {
|
|
177
|
-
prettyPrint: process.env.NODE_ENV !== 'production',
|
|
178
|
-
level : process.env.LOGLEVEL == null ? 'silent' : process.env.LOGLEVEL,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
174
|
+
case 7:
|
|
175
|
+
/*
|
|
176
|
+
await hapiServer.register({
|
|
177
|
+
plugin : require('hapi-pino'),
|
|
178
|
+
options: {
|
|
179
|
+
prettyPrint: process.env.NODE_ENV !== 'production',
|
|
180
|
+
level : process.env.LOGLEVEL == null ? 'silent' : process.env.LOGLEVEL,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
181
183
|
*/
|
|
182
184
|
// setup authentication related plugins
|
|
183
185
|
options = {
|
|
@@ -208,12 +210,12 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
208
210
|
};
|
|
209
211
|
debug2('Options', options);
|
|
210
212
|
if (!(process.env.AUTHFLOW != null)) {
|
|
211
|
-
_context.
|
|
213
|
+
_context.n = 9;
|
|
212
214
|
break;
|
|
213
215
|
}
|
|
214
|
-
_context.
|
|
216
|
+
_context.n = 8;
|
|
215
217
|
return (0, _setupAuth["default"])(hapiServer, options);
|
|
216
|
-
case
|
|
218
|
+
case 8:
|
|
217
219
|
if (process.env.PREAUTH === 'YES') {
|
|
218
220
|
console.log('Preauth enabled');
|
|
219
221
|
hapiServer.ext('onPreAuth', function (request, h) {
|
|
@@ -229,10 +231,10 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
229
231
|
return h["continue"];
|
|
230
232
|
});
|
|
231
233
|
}
|
|
232
|
-
case
|
|
234
|
+
case 9:
|
|
233
235
|
console.log('Plugin', process.env.PLUGIN);
|
|
234
236
|
if (!(process.env.PLUGIN === 'hapi-swagger' && serverMode === 'api')) {
|
|
235
|
-
_context.
|
|
237
|
+
_context.n = 11;
|
|
236
238
|
break;
|
|
237
239
|
}
|
|
238
240
|
swaggerOptions = {
|
|
@@ -257,27 +259,27 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
257
259
|
swaggerOptions = _objectSpread(_objectSpread({}, swaggerOptions), override);
|
|
258
260
|
}
|
|
259
261
|
debug('Swagger Options:', swaggerOptions);
|
|
260
|
-
_context.
|
|
262
|
+
_context.n = 10;
|
|
261
263
|
return hapiServer.register({
|
|
262
264
|
plugin: serverMode,
|
|
263
265
|
options: swaggerOptions
|
|
264
266
|
});
|
|
265
|
-
case
|
|
266
|
-
_context.
|
|
267
|
+
case 10:
|
|
268
|
+
_context.n = 12;
|
|
267
269
|
break;
|
|
268
|
-
case
|
|
270
|
+
case 11:
|
|
269
271
|
if (process.env.PLUGIN == 'hapi-openapi' && serverMode === 'api') {
|
|
270
272
|
console.log('hapi-openapi', 'coming soon');
|
|
271
273
|
}
|
|
272
|
-
case
|
|
274
|
+
case 12:
|
|
273
275
|
//
|
|
274
276
|
// Start server
|
|
275
277
|
//
|
|
276
278
|
// eslint-disable-next-line no-unused-vars
|
|
277
279
|
allRoutes = hapiServer.table();
|
|
278
|
-
_context.
|
|
280
|
+
_context.n = 13;
|
|
279
281
|
return hapiServer.start();
|
|
280
|
-
case
|
|
282
|
+
case 13:
|
|
281
283
|
hh = hapiServer.info.uri;
|
|
282
284
|
hh = hh.replace(/0.0.0.0/, 'localhost');
|
|
283
285
|
console.log('====================================================================================');
|
|
@@ -288,9 +290,8 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
|
|
|
288
290
|
process.env.APPSERVER = "".concat(hh, "/").concat(process.env.APPNAME);
|
|
289
291
|
process.env.HEALTH = 'true';
|
|
290
292
|
console.log('====================================================================================');
|
|
291
|
-
case
|
|
292
|
-
|
|
293
|
-
return _context.stop();
|
|
293
|
+
case 14:
|
|
294
|
+
return _context.a(2);
|
|
294
295
|
}
|
|
295
296
|
}, _callee);
|
|
296
297
|
}));
|
|
@@ -308,15 +309,15 @@ function getCertificates() {
|
|
|
308
309
|
return _getCertificates.apply(this, arguments);
|
|
309
310
|
}
|
|
310
311
|
function _getCertificates() {
|
|
311
|
-
_getCertificates = _asyncToGenerator(/*#__PURE__*/
|
|
312
|
+
_getCertificates = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
312
313
|
var options, tlsdir;
|
|
313
|
-
return
|
|
314
|
-
while (1) switch (_context2.
|
|
314
|
+
return _regenerator().w(function (_context2) {
|
|
315
|
+
while (1) switch (_context2.n) {
|
|
315
316
|
case 0:
|
|
316
317
|
options = null;
|
|
317
318
|
tlsdir = process.env.SSLCERT;
|
|
318
319
|
if (!(tlsdir != null && tlsdir.trim().length > 0)) {
|
|
319
|
-
_context2.
|
|
320
|
+
_context2.n = 1;
|
|
320
321
|
break;
|
|
321
322
|
}
|
|
322
323
|
console.log('ssl CERTIFICATES', tlsdir);
|
|
@@ -335,20 +336,17 @@ function _getCertificates() {
|
|
|
335
336
|
}
|
|
336
337
|
options.rejectUnauthorized = true;
|
|
337
338
|
}
|
|
338
|
-
_context2.
|
|
339
|
+
_context2.n = 3;
|
|
339
340
|
break;
|
|
340
|
-
case
|
|
341
|
+
case 1:
|
|
341
342
|
console.log('No SSL certificates found, generating self-signed certificates');
|
|
342
|
-
_context2.
|
|
343
|
+
_context2.n = 2;
|
|
343
344
|
return getTls();
|
|
344
|
-
case
|
|
345
|
-
options = _context2.
|
|
345
|
+
case 2:
|
|
346
|
+
options = _context2.v;
|
|
346
347
|
options.rejectUnauthorized = false;
|
|
347
|
-
case
|
|
348
|
-
return _context2.
|
|
349
|
-
case 13:
|
|
350
|
-
case "end":
|
|
351
|
-
return _context2.stop();
|
|
348
|
+
case 3:
|
|
349
|
+
return _context2.a(2, options);
|
|
352
350
|
}
|
|
353
351
|
}, _callee2);
|
|
354
352
|
}));
|
|
@@ -358,10 +356,10 @@ function getTls() {
|
|
|
358
356
|
return _getTls.apply(this, arguments);
|
|
359
357
|
}
|
|
360
358
|
function _getTls() {
|
|
361
|
-
_getTls = _asyncToGenerator(/*#__PURE__*/
|
|
359
|
+
_getTls = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
362
360
|
var options, subjt, subj, d, attr, pems, tls;
|
|
363
|
-
return
|
|
364
|
-
while (1) switch (_context3.
|
|
361
|
+
return _regenerator().w(function (_context3) {
|
|
362
|
+
while (1) switch (_context3.n) {
|
|
365
363
|
case 0:
|
|
366
364
|
options = {
|
|
367
365
|
keySize: 2048,
|
|
@@ -428,10 +426,7 @@ function _getTls() {
|
|
|
428
426
|
cert: pems.cert,
|
|
429
427
|
key: pems["private"]
|
|
430
428
|
};
|
|
431
|
-
return _context3.
|
|
432
|
-
case 11:
|
|
433
|
-
case "end":
|
|
434
|
-
return _context3.stop();
|
|
429
|
+
return _context3.a(2, tls);
|
|
435
430
|
}
|
|
436
431
|
}, _callee3);
|
|
437
432
|
}));
|
package/lib/index.js
CHANGED
|
@@ -5,28 +5,30 @@ require("regenerator-runtime/runtime");
|
|
|
5
5
|
var _fs = _interopRequireDefault(require("fs"));
|
|
6
6
|
var _iService = _interopRequireDefault(require("./iService"));
|
|
7
7
|
var _config = _interopRequireDefault(require("./config"));
|
|
8
|
+
var _yargs = _interopRequireDefault(require("yargs"));
|
|
9
|
+
var _helpers = require("yargs/helpers");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
-
/*
|
|
10
|
-
* ------------------------------------------------------------------------------------
|
|
11
|
-
* * Copyright (c) SAS Institute Inc.
|
|
12
|
-
* * Licensed under the Apache License, Version 2.0 (the 'License');
|
|
13
|
-
* * you may not use this file except in compliance with the License.
|
|
14
|
-
* * You may obtain a copy of the License at
|
|
15
|
-
* *
|
|
16
|
-
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
* *
|
|
18
|
-
* * Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* * distributed under the License is distributed on an 'AS IS' BASIS,
|
|
20
|
-
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* * See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
* ----------------------------------------------------------------------------------------
|
|
24
|
-
*
|
|
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
|
+
*
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
29
|
var debug = require("debug")("startup");
|
|
28
30
|
module.exports = function core(uTable, useDefault, serverMode, customize, swaggerfcn) {
|
|
29
|
-
var argv =
|
|
31
|
+
var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).argv;
|
|
30
32
|
var env = argv.env == null ? null : argv.env;
|
|
31
33
|
var appenv = argv.appenv == null ? null : argv.appenv;
|
|
32
34
|
var docker = argv.docker == null ? null : argv.docker;
|
|
@@ -94,10 +96,10 @@ function getAllEnv(userData) {
|
|
|
94
96
|
host = null;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
/*
|
|
98
|
-
if (process.env.AUTHTYPE != null) {
|
|
99
|
-
process.env.AUTHFLOW = process.env.AUTHTYPE;
|
|
100
|
-
}
|
|
99
|
+
/*
|
|
100
|
+
if (process.env.AUTHTYPE != null) {
|
|
101
|
+
process.env.AUTHFLOW = process.env.AUTHTYPE;
|
|
102
|
+
}
|
|
101
103
|
*/
|
|
102
104
|
|
|
103
105
|
var authflow = trimit("AUTHFLOW");
|
package/lib/parseDocker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
6
6
|
|
package/lib/plugins/SASauth.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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
|
-
/*
|
|
8
|
-
* ------------------------------------------------------------------------------------
|
|
9
|
-
* * Copyright (c) SAS Institute Inc.
|
|
10
|
-
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* * you may not use this file except in compliance with the License.
|
|
12
|
-
* * You may obtain a copy of the License at
|
|
13
|
-
* *
|
|
14
|
-
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
* *
|
|
16
|
-
* * Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* * See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
* ----------------------------------------------------------------------------------------
|
|
22
|
-
*
|
|
7
|
+
/*
|
|
8
|
+
* ------------------------------------------------------------------------------------
|
|
9
|
+
* * Copyright (c) SAS Institute Inc.
|
|
10
|
+
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* * you may not use this file except in compliance with the License.
|
|
12
|
+
* * You may obtain a copy of the License at
|
|
13
|
+
* *
|
|
14
|
+
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
* *
|
|
16
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* * See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
* ----------------------------------------------------------------------------------------
|
|
22
|
+
*
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
var bell = require('@hapi/bell');
|
|
@@ -34,10 +34,10 @@ function iSASauth(_x, _x2) {
|
|
|
34
34
|
return _iSASauth.apply(this, arguments);
|
|
35
35
|
}
|
|
36
36
|
function _iSASauth() {
|
|
37
|
-
_iSASauth = _asyncToGenerator(/*#__PURE__*/
|
|
37
|
+
_iSASauth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(server, options) {
|
|
38
38
|
var bellAuthOptions, provider, host;
|
|
39
|
-
return
|
|
40
|
-
while (1) switch (_context2.
|
|
39
|
+
return _regenerator().w(function (_context2) {
|
|
40
|
+
while (1) switch (_context2.n) {
|
|
41
41
|
case 0:
|
|
42
42
|
debug('in iSASauth');
|
|
43
43
|
debug('options', options);
|
|
@@ -58,15 +58,14 @@ function _iSASauth() {
|
|
|
58
58
|
token: host + '/oauth/token',
|
|
59
59
|
profileMethod: 'get',
|
|
60
60
|
profile: function () {
|
|
61
|
-
var _profile = _asyncToGenerator(/*#__PURE__*/
|
|
62
|
-
return
|
|
63
|
-
while (1) switch (_context.
|
|
61
|
+
var _profile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(credentials, params, get) {
|
|
62
|
+
return _regenerator().w(function (_context) {
|
|
63
|
+
while (1) switch (_context.n) {
|
|
64
64
|
case 0:
|
|
65
65
|
server.log('SASAuth profile', credentials);
|
|
66
66
|
debug('credentials', credentials);
|
|
67
|
-
case
|
|
68
|
-
|
|
69
|
-
return _context.stop();
|
|
67
|
+
case 1:
|
|
68
|
+
return _context.a(2);
|
|
70
69
|
}
|
|
71
70
|
}, _callee);
|
|
72
71
|
}));
|
|
@@ -87,13 +86,12 @@ function _iSASauth() {
|
|
|
87
86
|
// console.log('SASAuth options', bellAuthOptions);
|
|
88
87
|
debug('belloptions', bellAuthOptions);
|
|
89
88
|
server.log('SASAuth', bellAuthOptions);
|
|
90
|
-
_context2.
|
|
89
|
+
_context2.n = 1;
|
|
91
90
|
return server.register(bell);
|
|
92
|
-
case
|
|
91
|
+
case 1:
|
|
93
92
|
server.auth.strategy('sas', 'bell', bellAuthOptions);
|
|
94
|
-
case
|
|
95
|
-
|
|
96
|
-
return _context2.stop();
|
|
93
|
+
case 2:
|
|
94
|
+
return _context2.a(2);
|
|
97
95
|
}
|
|
98
96
|
}, _callee2);
|
|
99
97
|
}));
|