@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.
Files changed (81) hide show
  1. package/.babelrc +6 -6
  2. package/.dockerignore +2 -2
  3. package/.env +29 -29
  4. package/.env.proxy +32 -32
  5. package/.env.server +30 -30
  6. package/.eslintignore +3 -3
  7. package/.eslintrc.json +42 -42
  8. package/Dockerfile +44 -44
  9. package/README.md +99 -99
  10. package/cli.js +9 -9
  11. package/lib/config.js +16 -16
  12. package/lib/handlers/appCallback.js +23 -24
  13. package/lib/handlers/codeAuth.js +17 -18
  14. package/lib/handlers/decodeJwt.js +3 -3
  15. package/lib/handlers/favicon.js +22 -25
  16. package/lib/handlers/getApp.js +20 -21
  17. package/lib/handlers/getApp2.js +22 -25
  18. package/lib/handlers/getUser.js +14 -17
  19. package/lib/handlers/index.js +3 -3
  20. package/lib/handlers/keepAlive.js +28 -31
  21. package/lib/handlers/keepAlive2.js +9 -12
  22. package/lib/handlers/logon.js +12 -15
  23. package/lib/handlers/logout.js +24 -28
  24. package/lib/handlers/proxyMapUri.js +6 -11
  25. package/lib/handlers/proxyOnResponse.js +6 -7
  26. package/lib/handlers/reactDev.js +22 -25
  27. package/lib/handlers/setCookies.js +52 -53
  28. package/lib/iService.js +106 -104
  29. package/lib/index.js +23 -21
  30. package/lib/parseDocker.js +3 -3
  31. package/lib/plugins/SASauth.js +30 -32
  32. package/lib/plugins/appCookie.js +36 -38
  33. package/lib/plugins/setContext.js +22 -25
  34. package/lib/plugins/setDefaultRoutes.js +61 -58
  35. package/lib/plugins/setupAuth.js +35 -38
  36. package/lib/plugins/setupUserRoutes.js +16 -16
  37. package/lib/plugins/token.js +9 -10
  38. package/lib/schemes/SASTokenScheme.js +24 -27
  39. package/package.json +85 -79
  40. package/public/data/Cluster_SDOH1.sas +181 -181
  41. package/public/data/Cluster_SDOH6.sas +179 -179
  42. package/public/data/NeuralNetwork_High_med.sas +2408 -2408
  43. package/public/data/NeuralNetwork_high_med1.sas +2408 -2408
  44. package/public/data/cars.csv +429 -429
  45. package/public/data/cmdList.txt +15 -15
  46. package/public/data/iris.csv +151 -151
  47. package/public/index.html +355 -360
  48. package/public/indexProxy.html +351 -351
  49. package/public/simplesubmit.html +233 -0
  50. package/server.js +362 -362
  51. package/src/config.js +90 -90
  52. package/src/handlers/appCallback.js +40 -40
  53. package/src/handlers/codeAuth.js +31 -31
  54. package/src/handlers/decodeJwt.js +10 -10
  55. package/src/handlers/favicon.js +23 -23
  56. package/src/handlers/getApp.js +52 -52
  57. package/src/handlers/getApp2.js +25 -25
  58. package/src/handlers/getUser.js +20 -20
  59. package/src/handlers/index.js +36 -36
  60. package/src/handlers/keepAlive.js +53 -53
  61. package/src/handlers/keepAlive2.js +12 -12
  62. package/src/handlers/logon.js +23 -23
  63. package/src/handlers/logout.js +42 -42
  64. package/src/handlers/proxyMapUri.js +25 -25
  65. package/src/handlers/proxyOnResponse.js +11 -11
  66. package/src/handlers/reactDev.js +29 -29
  67. package/src/handlers/setCookies.js +81 -79
  68. package/src/iService.js +346 -347
  69. package/src/index.js +251 -249
  70. package/src/parseDocker.js +32 -32
  71. package/src/plugins/SASauth.js +78 -78
  72. package/src/plugins/appCookie.js +51 -49
  73. package/src/plugins/setContext.js +33 -33
  74. package/src/plugins/setDefaultRoutes.js +256 -253
  75. package/src/plugins/setupAuth.js +49 -49
  76. package/src/plugins/setupUserRoutes.js +47 -47
  77. package/src/plugins/token.js +10 -10
  78. package/src/schemes/SASTokenScheme.js +43 -43
  79. package/src/visionIndex.html +23 -23
  80. package/start.sh +14 -14
  81. package/tls/viyatls.sh +2 -2
package/src/config.js CHANGED
@@ -1,90 +1,90 @@
1
- /*
2
- * ------------------------------------------------------------------------------------
3
- * * Copyright (c) SAS Institute Inc.
4
- * * Licensed under the Apache License, Version 2.0 (the "License");
5
- * * you may not use this file except in compliance with the License.
6
- * * You may obtain a copy of the License at
7
- * *
8
- * * http://www.apache.org/licenses/LICENSE-2.0
9
- * *
10
- * * Unless required by applicable law or agreed to in writing, software
11
- * * distributed under the License is distributed on an "AS IS" BASIS,
12
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- * ----------------------------------------------------------------------------------------
16
- *
17
- */
18
-
19
- 'use strict';
20
-
21
- let fs = require('fs');
22
- import parseDocker from './parseDocker';
23
- import debug from 'debug';
24
- let configDebug = debug('configserver');
25
-
26
- function config(appEnv, dockerFile) {
27
-
28
-
29
- if (dockerFile != null) {
30
- parseDocker(dockerFile);
31
- }
32
-
33
- if (appEnv != null) {
34
- iconfig(appEnv);
35
- }
36
-
37
-
38
- // Final patching
39
- if (process.env.APPPORT == null && process.env.EXPOSEDPORT != null) {
40
- process.env.APPPORT = process.env.EXPOSEDPORT;
41
- console.log(`APPPORT set to value of exposed port ${process.env.APPPORT}`);
42
- }
43
-
44
-
45
- if (process.env.PORT != null && process.env.APPPORT == null) {
46
- process.env.APPPORT = process.env.PORT;
47
- console.log(`APPPORT overriden by PORT ${process.env.PORT}`);
48
- }
49
- if (process.env.APPLOC == null) {
50
- process.env.APPLOC = './public';
51
- }
52
- if (process.env.APPENTRY == null) {
53
- process.env.APPENTRY = 'index.html';
54
- }
55
- // fixing usual user error of adding a space after the url
56
- let vserver = process.env.VIYA_SERVER;
57
-
58
- if (vserver == null || vserver === 'none') {
59
- console.log('Viya not required - assumming no authentication');
60
- }
61
- }
62
-
63
-
64
-
65
- function iconfig(appEnv) {
66
- try {
67
- let data = fs.readFileSync(appEnv, 'utf8');
68
- let d = data.split(/\r?\n/);
69
- d.forEach(l => {
70
- if (l.length > 0 && l.indexOf('#') === -1) {
71
- let la = l.split('=');
72
- let envName = la[0];
73
- if (la.length === 2 && la[1].length > 0) {
74
- let t = la[1].trim();
75
- process.env[envName] = t;
76
- }
77
- configDebug(la[1]);
78
- }
79
- });
80
-
81
- } catch (err) {
82
- console.log(err);
83
- process.exit(0);
84
- }
85
- }
86
-
87
-
88
-
89
-
90
- export default config;
1
+ /*
2
+ * ------------------------------------------------------------------------------------
3
+ * * Copyright (c) SAS Institute Inc.
4
+ * * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * * you may not use this file except in compliance with the License.
6
+ * * You may obtain a copy of the License at
7
+ * *
8
+ * * http://www.apache.org/licenses/LICENSE-2.0
9
+ * *
10
+ * * Unless required by applicable law or agreed to in writing, software
11
+ * * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ * ----------------------------------------------------------------------------------------
16
+ *
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ let fs = require('fs');
22
+ import parseDocker from './parseDocker';
23
+ import debug from 'debug';
24
+ let configDebug = debug('configserver');
25
+
26
+ function config(appEnv, dockerFile) {
27
+
28
+
29
+ if (dockerFile != null) {
30
+ parseDocker(dockerFile);
31
+ }
32
+
33
+ if (appEnv != null) {
34
+ iconfig(appEnv);
35
+ }
36
+
37
+
38
+ // Final patching
39
+ if (process.env.APPPORT == null && process.env.EXPOSEDPORT != null) {
40
+ process.env.APPPORT = process.env.EXPOSEDPORT;
41
+ console.log(`APPPORT set to value of exposed port ${process.env.APPPORT}`);
42
+ }
43
+
44
+
45
+ if (process.env.PORT != null && process.env.APPPORT == null) {
46
+ process.env.APPPORT = process.env.PORT;
47
+ console.log(`APPPORT overriden by PORT ${process.env.PORT}`);
48
+ }
49
+ if (process.env.APPLOC == null) {
50
+ process.env.APPLOC = './public';
51
+ }
52
+ if (process.env.APPENTRY == null) {
53
+ process.env.APPENTRY = 'index.html';
54
+ }
55
+ // fixing usual user error of adding a space after the url
56
+ let vserver = process.env.VIYA_SERVER;
57
+
58
+ if (vserver == null || vserver === 'none') {
59
+ console.log('Viya not required - assumming no authentication');
60
+ }
61
+ }
62
+
63
+
64
+
65
+ function iconfig(appEnv) {
66
+ try {
67
+ let data = fs.readFileSync(appEnv, 'utf8');
68
+ let d = data.split(/\r?\n/);
69
+ d.forEach(l => {
70
+ if (l.length > 0 && l.indexOf('#') === -1) {
71
+ let la = l.split('=');
72
+ let envName = la[0];
73
+ if (la.length === 2 && la[1].length > 0) {
74
+ let t = la[1].trim();
75
+ process.env[envName] = t;
76
+ }
77
+ configDebug(la[1]);
78
+ }
79
+ });
80
+
81
+ } catch (err) {
82
+ console.log(err);
83
+ process.exit(0);
84
+ }
85
+ }
86
+
87
+
88
+
89
+
90
+ export default config;
@@ -1,40 +1,40 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- "use strict";
6
-
7
- import codeAuth from "./codeAuth";
8
-
9
- // handle all callback
10
- let debug = require("debug")("callback");
11
-
12
- async function appCallback (req, h) {
13
- debug("in callback");
14
- debug(`AUTHFLOW: ${process.env.AUTHFLOW}`);
15
- if (process.env.AUTHFLOW === "server") {
16
- return codeAuth(req, h);
17
- } else {
18
- let indexHTML = "index.html";
19
- console.log(`REDIRECT_ENTRY: ${process.env.REDIRECT_ENTRY}`)
20
- if (process.env.REDIRECT_ENTRY != null) {
21
- indexHTML = process.env.REDIRECT_ENTRY;
22
- console.log(`----Redirecting to ${indexHTML}`);
23
-
24
- }
25
- /*
26
- if (process.entry != null) {
27
- indexHTML =
28
- process.entry.REDIRECT_ENTRY != null
29
- ? process.entry.REDIRECT_ENTRY
30
- : process.env.APPENTRY == null
31
- ? "index.html"
32
- : process.env.APPENTRY;
33
- }
34
- */
35
- console.log(`Redirecting to default ${indexHTML}`);
36
- return h.file(`${indexHTML}`);
37
- }
38
- }
39
-
40
- export default appCallback;
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ "use strict";
6
+
7
+ import codeAuth from "./codeAuth";
8
+
9
+ // handle all callback
10
+ let debug = require("debug")("callback");
11
+
12
+ async function appCallback (req, h) {
13
+ debug("in callback");
14
+ debug(`AUTHFLOW: ${process.env.AUTHFLOW}`);
15
+ if (process.env.AUTHFLOW === "server") {
16
+ return codeAuth(req, h);
17
+ } else {
18
+ let indexHTML = "index.html";
19
+ console.log(`REDIRECT_ENTRY: ${process.env.REDIRECT_ENTRY}`)
20
+ if (process.env.REDIRECT_ENTRY != null) {
21
+ indexHTML = process.env.REDIRECT_ENTRY;
22
+ console.log(`----Redirecting to ${indexHTML}`);
23
+
24
+ }
25
+ /*
26
+ if (process.entry != null) {
27
+ indexHTML =
28
+ process.entry.REDIRECT_ENTRY != null
29
+ ? process.entry.REDIRECT_ENTRY
30
+ : process.env.APPENTRY == null
31
+ ? "index.html"
32
+ : process.env.APPENTRY;
33
+ }
34
+ */
35
+ console.log(`Redirecting to default ${indexHTML}`);
36
+ return h.file(`${indexHTML}`);
37
+ }
38
+ }
39
+
40
+ export default appCallback;
@@ -1,31 +1,31 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- 'use strict';
6
-
7
- import setCookies from './setCookies';
8
- let debug = require('debug')('codeauth');
9
- async function codeAuth (req, h, options) {
10
- debug('in codeauth');
11
- await setCookies(req, h, options);
12
- debug(options);
13
- let indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
14
- if (process.env.REDIRECT != null) {
15
- debug('using REDIRECT env variable', process.env.REDIRECT);
16
- indexHTML = process.env.REDIRECT;
17
- }
18
- debug('..................', indexHTML);
19
- if (indexHTML.indexOf('/') === 0) {
20
- // added to support create-react-restaf-viya-app cli
21
- if (indexHTML !== '/develop') {
22
- indexHTML = `/${process.env.APPNAME}${indexHTML}`;
23
- }
24
- console.log(`Redirecting to ${indexHTML}`);
25
- return h.redirect(indexHTML);
26
- } else {
27
- console.log(`Visiting ${indexHTML}`);
28
- return h.file(indexHTML);
29
- };
30
- }
31
- export default codeAuth;
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ 'use strict';
6
+
7
+ import setCookies from './setCookies';
8
+ let debug = require('debug')('codeauth');
9
+ async function codeAuth (req, h, options) {
10
+ debug('in codeauth');
11
+ await setCookies(req, h, options);
12
+ debug(options);
13
+ let indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
14
+ if (process.env.REDIRECT != null) {
15
+ debug('using REDIRECT env variable', process.env.REDIRECT);
16
+ indexHTML = process.env.REDIRECT;
17
+ }
18
+ debug('..................', indexHTML);
19
+ if (indexHTML.indexOf('/') === 0) {
20
+ // added to support create-react-restaf-viya-app cli
21
+ if (indexHTML !== '/develop') {
22
+ indexHTML = `/${process.env.APPNAME}${indexHTML}`;
23
+ }
24
+ console.log(`Redirecting to ${indexHTML}`);
25
+ return h.redirect(indexHTML);
26
+ } else {
27
+ console.log(`Visiting ${indexHTML}`);
28
+ return h.file(indexHTML);
29
+ };
30
+ }
31
+ export default codeAuth;
@@ -1,11 +1,11 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- import jwtDecode from 'jwt-decode';
7
- function decodeJwt (token) {
8
- let jwt = jwtDecode(token);
9
- return jwt;
10
- }
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ import jwtDecode from 'jwt-decode';
7
+ function decodeJwt (token) {
8
+ let jwt = jwtDecode(token);
9
+ return jwt;
10
+ }
11
11
  export default decodeJwt;
@@ -1,24 +1,24 @@
1
- /*
2
- * ------------------------------------------------------------------------------------
3
- * Copyright (c) SAS Institute Inc.
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- * ---------------------------------------------------------------------------------------
16
- *
17
- */
18
- 'use strict';
19
-
20
- async function favicon (req, h) {
21
- return h.file(`favicon.ico`);
22
- }
23
-
1
+ /*
2
+ * ------------------------------------------------------------------------------------
3
+ * Copyright (c) SAS Institute Inc.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ * ---------------------------------------------------------------------------------------
16
+ *
17
+ */
18
+ 'use strict';
19
+
20
+ async function favicon (req, h) {
21
+ return h.file(`favicon.ico`);
22
+ }
23
+
24
24
  export default favicon;
@@ -1,52 +1,52 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import codeAuth from './codeAuth';
6
-
7
- let debug = require('debug')('getapp');
8
-
9
- async function getApp (options, req, h) {
10
- if (process.env.AUTHFLOW === 'implicit') {
11
- let x = `${process.env.VIYA_SERVER}/SASLogon/oauth/authorize?response_type=token&client_id=${process.env.CLIENTID}`;
12
- let redirect = `${process.env.APPNAME}/callback`;
13
- let redirectUri;
14
- if (process.env.REDIRECT != null) {
15
- redirect = process.env.REDIRECT.trim();
16
- if (redirect.indexOf('http') === -1) {
17
- redirect = `${process.env.APPNAME}/${redirect}`;
18
- let protocol = process.env.HTTPS === 'true' ? 'https://' : 'http://';
19
- redirectUri = `${protocol}${process.env.APPHOST}:${process.env.APPPORT}/${redirect}?host=${process.env.VIYA_SERVER}`;
20
- } else {
21
- redirectUri = `${redirect}?host=${process.env.VIYA_SERVER}`;
22
- }
23
- }
24
- debug(process.env.REDIRECT);
25
- let url = `${x}&redirect_uri=${redirectUri}`;
26
- debug(url);
27
- return h.redirect(url);
28
- } else if (process.env.AUTHFLOW === 'server') {
29
-
30
- debug('calling codeauth');
31
- return codeAuth(req, h, options);
32
-
33
- } else {
34
- debug('default processing in getapp');
35
- console.log('Processing non authenticated use case');
36
-
37
- let indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
38
- if (process.env.REDIRECT != null) {
39
- indexHTML = process.env.REDIRECT;
40
- }
41
- console.log('redirecting to ', indexHTML);
42
- if (indexHTML.startsWith('/')) {
43
- indexHTML = `/${process.env.APPNAME}${indexHTML}`;
44
- return h.redirect(indexHTML);
45
- } else {
46
- return h.file(indexHTML);
47
- }
48
-
49
- }
50
-
51
- }
52
- export default getApp;
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import codeAuth from './codeAuth';
6
+
7
+ let debug = require('debug')('getapp');
8
+
9
+ async function getApp (options, req, h) {
10
+ if (process.env.AUTHFLOW === 'implicit') {
11
+ let x = `${process.env.VIYA_SERVER}/SASLogon/oauth/authorize?response_type=token&client_id=${process.env.CLIENTID}`;
12
+ let redirect = `${process.env.APPNAME}/callback`;
13
+ let redirectUri;
14
+ if (process.env.REDIRECT != null) {
15
+ redirect = process.env.REDIRECT.trim();
16
+ if (redirect.indexOf('http') === -1) {
17
+ redirect = `${process.env.APPNAME}/${redirect}`;
18
+ let protocol = process.env.HTTPS === 'true' ? 'https://' : 'http://';
19
+ redirectUri = `${protocol}${process.env.APPHOST}:${process.env.APPPORT}/${redirect}?host=${process.env.VIYA_SERVER}`;
20
+ } else {
21
+ redirectUri = `${redirect}?host=${process.env.VIYA_SERVER}`;
22
+ }
23
+ }
24
+ debug(process.env.REDIRECT);
25
+ let url = `${x}&redirect_uri=${redirectUri}`;
26
+ debug(url);
27
+ return h.redirect(url);
28
+ } else if (process.env.AUTHFLOW === 'server') {
29
+
30
+ debug('calling codeauth');
31
+ return codeAuth(req, h, options);
32
+
33
+ } else {
34
+ debug('default processing in getapp');
35
+ console.log('Processing non authenticated use case');
36
+
37
+ let indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
38
+ if (process.env.REDIRECT != null) {
39
+ indexHTML = process.env.REDIRECT;
40
+ }
41
+ console.log('redirecting to ', indexHTML);
42
+ if (indexHTML.startsWith('/')) {
43
+ indexHTML = `/${process.env.APPNAME}${indexHTML}`;
44
+ return h.redirect(indexHTML);
45
+ } else {
46
+ return h.file(indexHTML);
47
+ }
48
+
49
+ }
50
+
51
+ }
52
+ export default getApp;
@@ -1,26 +1,26 @@
1
- /*
2
- * ------------------------------------------------------------------------------------
3
- * Copyright (c) SAS Institute Inc.
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- * ---------------------------------------------------------------------------------------
16
- *
17
- */
18
- 'use strict';
19
- let debug = require('debug')('getapp2');
20
- async function getApp2 (req, h) {
21
- debug('in getApp2');
22
- debug(req.params);
23
- return h.file(`${req.params.param}`);
24
- }
25
-
1
+ /*
2
+ * ------------------------------------------------------------------------------------
3
+ * Copyright (c) SAS Institute Inc.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ * ---------------------------------------------------------------------------------------
16
+ *
17
+ */
18
+ 'use strict';
19
+ let debug = require('debug')('getapp2');
20
+ async function getApp2 (req, h) {
21
+ debug('in getApp2');
22
+ debug(req.params);
23
+ return h.file(`${req.params.param}`);
24
+ }
25
+
26
26
  export default getApp2;
@@ -1,20 +1,20 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- 'use strict';
6
- let debug = require('debug')('user');
7
- async function getUser (req, h) {
8
-
9
- debug(req.state);
10
- let name = 'SAS User';
11
- if (req.state.ocookie != null) {
12
- let sid = req.state.ocookie.sid;
13
- debug(sid);
14
- let credentials = await req.server.app.cache.get(sid);
15
- name = credentials.user_name;
16
- }
17
- debug(name);
18
- return `let USER_NAME='${name}'`;
19
- }
20
- export default getUser;
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ 'use strict';
6
+ let debug = require('debug')('user');
7
+ async function getUser (req, h) {
8
+
9
+ debug(req.state);
10
+ let name = 'SAS User';
11
+ if (req.state.ocookie != null) {
12
+ let sid = req.state.ocookie.sid;
13
+ debug(sid);
14
+ let credentials = await req.server.app.cache.get(sid);
15
+ name = credentials.user_name;
16
+ }
17
+ debug(name);
18
+ return `let USER_NAME='${name}'`;
19
+ }
20
+ export default getUser;
@@ -1,36 +1,36 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- 'use strict';
6
- import getApp from './getApp';
7
- import getApp2 from './getApp2';
8
- import favicon from './favicon';
9
- import appCallback from './appCallback';
10
- import logon from './logon';
11
- import keepAlive from './keepAlive';
12
- import keepAlive2 from './keepAlive2';
13
- import logout from './logout';
14
- import getUser from './getUser';
15
- import setupUserRoutes from '../plugins/setupUserRoutes';
16
- import reactDev from './reactDev';
17
- import proxyMapUri from './proxyMapUri';
18
- import proxyOnResponse from './proxyOnResponse';
19
-
20
- export {
21
- getApp,
22
- getApp2,
23
- favicon,
24
- keepAlive,
25
- keepAlive2,
26
- appCallback,
27
- logon,
28
- logout,
29
- getUser,
30
- setupUserRoutes,
31
- reactDev,
32
- proxyMapUri,
33
- proxyOnResponse
34
- };
35
-
36
-
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ 'use strict';
6
+ import getApp from './getApp';
7
+ import getApp2 from './getApp2';
8
+ import favicon from './favicon';
9
+ import appCallback from './appCallback';
10
+ import logon from './logon';
11
+ import keepAlive from './keepAlive';
12
+ import keepAlive2 from './keepAlive2';
13
+ import logout from './logout';
14
+ import getUser from './getUser';
15
+ import setupUserRoutes from '../plugins/setupUserRoutes';
16
+ import reactDev from './reactDev';
17
+ import proxyMapUri from './proxyMapUri';
18
+ import proxyOnResponse from './proxyOnResponse';
19
+
20
+ export {
21
+ getApp,
22
+ getApp2,
23
+ favicon,
24
+ keepAlive,
25
+ keepAlive2,
26
+ appCallback,
27
+ logon,
28
+ logout,
29
+ getUser,
30
+ setupUserRoutes,
31
+ reactDev,
32
+ proxyMapUri,
33
+ proxyOnResponse
34
+ };
35
+
36
+