@sassoftware/viya-serverjs 0.5.2 → 0.5.3
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/lib/handlers/logon.js +2 -1
- package/lib/handlers/setCookies.js +11 -15
- package/lib/iService.js +1 -0
- package/package.json +1 -1
- package/src/handlers/logon.js +2 -1
- package/src/handlers/setCookies.js +6 -5
package/lib/handlers/logon.js
CHANGED
|
@@ -29,8 +29,9 @@ function _logon() {
|
|
|
29
29
|
return (0, _setCookies["default"])(req, h, null);
|
|
30
30
|
case 1:
|
|
31
31
|
r = _context.v;
|
|
32
|
+
console.log('logon setcookie result:', r);
|
|
32
33
|
debug(r.redirect);
|
|
33
|
-
|
|
34
|
+
console.log('in logon after setcookie', r.redirect);
|
|
34
35
|
return _context.a(2, h.redirect(r.redirect));
|
|
35
36
|
}
|
|
36
37
|
}, _callee);
|
|
@@ -25,30 +25,26 @@ function _setCookies() {
|
|
|
25
25
|
case 0:
|
|
26
26
|
debugger;
|
|
27
27
|
credentials = req.auth.credentials;
|
|
28
|
-
debug('setcookie', credentials);
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
debug('setcookie', credentials != null);
|
|
29
|
+
if (credentials != null && req.auth.error != null) {
|
|
30
|
+
console.log('setcookie credentials', credentials);
|
|
31
|
+
debug('setcookie error', req.auth.error);
|
|
32
|
+
console.log('Authentication error:', req.auth.error);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
// return { status: false, error: req.auth.error, redirect: '/error' };
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
debug('setcookie error', req.auth.error);
|
|
35
|
-
debug('logon failed');
|
|
36
|
-
return _context.a(2, {
|
|
37
|
-
status: false,
|
|
38
|
-
error: req.auth.error
|
|
39
|
-
});
|
|
40
|
-
case 1:
|
|
36
|
+
|
|
41
37
|
// create a cookie(sid) and save credentials in cache
|
|
42
38
|
sid = uuid.v4();
|
|
43
39
|
credentials.sid = sid;
|
|
44
40
|
if (options != null) {
|
|
45
41
|
options.allAppEnv.LOGONPAYLOAD.token = credentials.token;
|
|
46
42
|
options.allAppEnv.LOGONPAYLOAD.tokenType = 'bearer';
|
|
47
|
-
debug(options.allAppEnv.LOGONPAYLOAD);
|
|
43
|
+
// debug(options.allAppEnv.LOGONPAYLOAD);
|
|
48
44
|
}
|
|
49
|
-
_context.n =
|
|
45
|
+
_context.n = 1;
|
|
50
46
|
return req.server.app.cache.set(sid, credentials, 0);
|
|
51
|
-
case
|
|
47
|
+
case 1:
|
|
52
48
|
// Can we get away without setting cookie for this session?
|
|
53
49
|
// Need to also modify keepAlive
|
|
54
50
|
if (process.env.COOKIES !== 'NO') {
|
package/lib/iService.js
CHANGED
package/package.json
CHANGED
package/src/handlers/logon.js
CHANGED
|
@@ -11,8 +11,9 @@ async function logon (req, h) {
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
let r = await setCookies(req, h, null);
|
|
14
|
+
console.log('logon setcookie result:', r);
|
|
14
15
|
debug(r.redirect);
|
|
15
|
-
|
|
16
|
+
console.log('in logon after setcookie', r.redirect);
|
|
16
17
|
return h.redirect(r.redirect);
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -8,13 +8,14 @@ let debug = require('debug')('setcookies');
|
|
|
8
8
|
async function setCookies (req, h, options) {
|
|
9
9
|
debugger;
|
|
10
10
|
let credentials = req.auth.credentials;
|
|
11
|
-
debug('setcookie', credentials);
|
|
11
|
+
debug('setcookie', credentials != null);
|
|
12
12
|
|
|
13
13
|
if (credentials != null && req.auth.error != null) {
|
|
14
|
-
|
|
14
|
+
console.log('setcookie credentials', credentials);
|
|
15
15
|
debug('setcookie error', req.auth.error);
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
console.log('Authentication error:', req.auth.error);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
// return { status: false, error: req.auth.error, redirect: '/error' };
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// create a cookie(sid) and save credentials in cache
|
|
@@ -23,7 +24,7 @@ async function setCookies (req, h, options) {
|
|
|
23
24
|
if (options != null) {
|
|
24
25
|
options.allAppEnv.LOGONPAYLOAD.token = credentials.token;
|
|
25
26
|
options.allAppEnv.LOGONPAYLOAD.tokenType = 'bearer';
|
|
26
|
-
|
|
27
|
+
// debug(options.allAppEnv.LOGONPAYLOAD);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
|