@sassoftware/viya-serverjs 0.6.1-1 → 0.6.1-2

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.
@@ -36,9 +36,18 @@ module.exports = function setDefaultRoutes(server, options) {
36
36
  var authDefault = false;
37
37
  var authLogon = false;
38
38
  if (options.authFlow === "server") {
39
- authDefault = options.serverMode === "app" ? false : {
40
- strategies: ["token", "session"],
41
- mode: "required"
39
+ /*
40
+ authDefault =
41
+ options.serverMode === "app"
42
+ ? false
43
+ : {
44
+ strategies: ["token", "session"],
45
+ mode: "required",
46
+ };
47
+ */
48
+ authDefault = {
49
+ strategy: "session",
50
+ mode: "try"
42
51
  };
43
52
  authLogon = {
44
53
  mode: "required",
@@ -95,34 +104,6 @@ module.exports = function setDefaultRoutes(server, options) {
95
104
  auth: process.env.USELOGON === 'YES' ? null : options.serverMode === "app" ? authLogon : authDefault,
96
105
  handler: getAppb
97
106
  }
98
- }, {
99
- method: ["GET"],
100
- path: "".concat(appName, "/api"),
101
- options: {
102
- auth: authDefault,
103
- handler: function () {
104
- var _handler2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(req, h) {
105
- return _regenerator().w(function (_context2) {
106
- while (1) switch (_context2.n) {
107
- case 0:
108
- return _context2.a(2, h.redirect("".concat(appName, "/documentation")));
109
- }
110
- }, _callee2);
111
- }));
112
- function handler(_x3, _x4) {
113
- return _handler2.apply(this, arguments);
114
- }
115
- return handler;
116
- }()
117
- }
118
- }, {
119
- method: ["GET"],
120
- path: "/develop",
121
- options: {
122
- auth: false,
123
- cors: true,
124
- handler: _handlers.reactDev
125
- }
126
107
  }, {
127
108
  method: ["GET"],
128
109
  path: "".concat(appName, "/callback"),
@@ -150,10 +131,10 @@ module.exports = function setDefaultRoutes(server, options) {
150
131
  options: {
151
132
  auth: /*authDefault*/false,
152
133
  handler: function () {
153
- var _handler3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(req, h) {
134
+ var _handler2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(req, h) {
154
135
  var allAppEnv, uappenv, s;
155
- return _regenerator().w(function (_context3) {
156
- while (1) switch (_context3.n) {
136
+ return _regenerator().w(function (_context2) {
137
+ while (1) switch (_context2.n) {
157
138
  case 0:
158
139
  allAppEnv = options.allAppEnv;
159
140
  if (options.userInfo != null) {
@@ -168,12 +149,12 @@ module.exports = function setDefaultRoutes(server, options) {
168
149
  console.log(s);
169
150
  }
170
151
  debug(s);
171
- return _context3.a(2, s);
152
+ return _context2.a(2, s);
172
153
  }
173
- }, _callee3);
154
+ }, _callee2);
174
155
  }));
175
- function handler(_x5, _x6) {
176
- return _handler3.apply(this, arguments);
156
+ function handler(_x3, _x4) {
157
+ return _handler2.apply(this, arguments);
177
158
  }
178
159
  return handler;
179
160
  }()
@@ -184,10 +165,10 @@ module.exports = function setDefaultRoutes(server, options) {
184
165
  options: {
185
166
  auth: /*authDefault*/false,
186
167
  handler: function () {
187
- var _handler4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(req, h) {
168
+ var _handler3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(req, h) {
188
169
  var allAppEnv, uappenv, s;
189
- return _regenerator().w(function (_context4) {
190
- while (1) switch (_context4.n) {
170
+ return _regenerator().w(function (_context3) {
171
+ while (1) switch (_context3.n) {
191
172
  case 0:
192
173
  allAppEnv = options.allAppEnv;
193
174
  if (options.userInfo != null) {
@@ -202,12 +183,12 @@ module.exports = function setDefaultRoutes(server, options) {
202
183
  debug(options.allAppEnv);
203
184
  }
204
185
  debug(s);
205
- return _context4.a(2, s);
186
+ return _context3.a(2, s);
206
187
  }
207
- }, _callee4);
188
+ }, _callee3);
208
189
  }));
209
- function handler(_x7, _x8) {
210
- return _handler4.apply(this, arguments);
190
+ function handler(_x5, _x6) {
191
+ return _handler3.apply(this, arguments);
211
192
  }
212
193
  return handler;
213
194
  }()
@@ -41,12 +41,11 @@ function setupAuth(_x, _x2) {
41
41
  }
42
42
  function _setupAuth() {
43
43
  _setupAuth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(server, options) {
44
- var def;
45
44
  return _regenerator().w(function (_context) {
46
45
  while (1) switch (_context.n) {
47
46
  case 0:
48
47
  if (!(options.authFlow === 'server')) {
49
- _context.n = 5;
48
+ _context.n = 2;
50
49
  break;
51
50
  }
52
51
  _context.n = 1;
@@ -58,22 +57,6 @@ function _setupAuth() {
58
57
  _context.n = 2;
59
58
  return appCookie(server, options);
60
59
  case 2:
61
- def = 'session';
62
- if (!(options.serverMode === 'api')) {
63
- _context.n = 4;
64
- break;
65
- }
66
- _context.n = 3;
67
- return server.register({
68
- plugin: token
69
- });
70
- case 3:
71
- def = 'token';
72
- case 4:
73
- log('***********************Default auth', def);
74
- server.auth["default"](def);
75
- // console.log(server.registerations);
76
- case 5:
77
60
  setDefaultRoutes(server, options);
78
61
  return _context.a(2, true);
79
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/viya-serverjs",
3
- "version": "0.6.1-1",
3
+ "version": "0.6.1-2",
4
4
  "description": "Easy to use app server for SAS Viya applications",
5
5
  "author": "Deva Kumaraswamy <deva.kumar@sas.com>",
6
6
  "license": "Apache-2.0",
package/server.js CHANGED
@@ -44,6 +44,10 @@ function getCustomHandler() {
44
44
  console.log(req.pre.context);
45
45
  return h.file('index.html');
46
46
  },
47
+ auth: {
48
+ strategy: 'session',
49
+ mode: 'optional'
50
+ },
47
51
  description: "Create new application",
48
52
  notes: "Index file created from env data",
49
53
  tags: ["app"],
@@ -37,6 +37,7 @@ module.exports = function setDefaultRoutes(server, options) {
37
37
  let authDefault = false;
38
38
  let authLogon = false;
39
39
  if (options.authFlow === "server") {
40
+ /*
40
41
  authDefault =
41
42
  options.serverMode === "app"
42
43
  ? false
@@ -44,7 +45,11 @@ module.exports = function setDefaultRoutes(server, options) {
44
45
  strategies: ["token", "session"],
45
46
  mode: "required",
46
47
  };
47
-
48
+ */
49
+ authDefault = {
50
+ strategy: "session",
51
+ mode: "try",
52
+ };
48
53
  authLogon = {
49
54
  mode: "required",
50
55
  strategy: "sas",
@@ -96,26 +101,6 @@ module.exports = function setDefaultRoutes(server, options) {
96
101
  },
97
102
  },
98
103
 
99
- {
100
- method: ["GET"],
101
- path: `${appName}/api`,
102
- options: {
103
- auth: authDefault,
104
- handler: async (req, h) => {
105
- return h.redirect(`${appName}/documentation`);
106
- },
107
- },
108
- },
109
- {
110
- method: ["GET"],
111
- path: `/develop`,
112
- options: {
113
- auth: false,
114
- cors: true,
115
- handler: reactDev,
116
- },
117
- },
118
-
119
104
  {
120
105
  method: ["GET"],
121
106
  path: `${appName}/callback`,
@@ -33,7 +33,7 @@ async function setupAuth (server, options){
33
33
  await server.register({plugin: SASauth, options: options});
34
34
  // await server.register({plugin: appCookie, options: options});
35
35
  await appCookie(server,options);
36
-
36
+ /*
37
37
  let def = 'session';
38
38
  if (options.serverMode === 'api') {
39
39
  await server.register({ plugin: token });
@@ -41,6 +41,7 @@ async function setupAuth (server, options){
41
41
  }
42
42
  log('***********************Default auth', def);
43
43
  server.auth.default(def);
44
+ */
44
45
  // console.log(server.registerations);
45
46
  }
46
47
  setDefaultRoutes(server, options);