exodus-framework 2.0.804 → 2.0.805
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.
@@ -37,14 +37,14 @@ class SocketAuthenticationMiddleware extends _controller.SocketController {
|
|
37
37
|
if (!token) {
|
38
38
|
const error = new Error('Token ausente');
|
39
39
|
res.statusCode = 401;
|
40
|
-
return
|
40
|
+
return next(error);
|
41
41
|
// return next(error);
|
42
42
|
}
|
43
43
|
const data = await _security.default.getService().verifySignature(token, _security.default.singleton().getServicePublicKey());
|
44
44
|
if (!data) {
|
45
45
|
const error = new Error('Token inválido');
|
46
46
|
res.statusCode = 401;
|
47
|
-
return
|
47
|
+
return next(error);
|
48
48
|
}
|
49
49
|
const account = data['account'];
|
50
50
|
req.auth = {
|
@@ -72,22 +72,22 @@ class SocketAuthenticationMiddleware extends _controller.SocketController {
|
|
72
72
|
if (!application) {
|
73
73
|
const error = new Error('Token de aplicação inválido');
|
74
74
|
res.statusCode = 401;
|
75
|
-
return
|
75
|
+
return next(error);
|
76
76
|
} else if (!application.active) {
|
77
77
|
const error = new Error('Token de aplicação desativado');
|
78
78
|
res.statusCode = 403;
|
79
|
-
return
|
79
|
+
return next(error);
|
80
80
|
} else if ((0, _dateFns.isBefore)(application.expiresAt, new Date())) {
|
81
81
|
const error = new Error('Token de aplicação expirado');
|
82
82
|
res.statusCode = 403;
|
83
|
-
return
|
83
|
+
return next(error);
|
84
84
|
} else {
|
85
85
|
//valido
|
86
86
|
const data = await _security.default.singleton().verifySignature(applicationId, _security.default.singleton().getServicePublicKey());
|
87
87
|
if (!data) {
|
88
88
|
const error = new Error('Token de aplicação sem autênticidade');
|
89
89
|
res.statusCode = 401;
|
90
|
-
return
|
90
|
+
return next(error);
|
91
91
|
}
|
92
92
|
requestor.database = data.payload.database;
|
93
93
|
requestor.environmentId = data.payload.envUuid;
|
@@ -111,7 +111,7 @@ class SocketAuthenticationMiddleware extends _controller.SocketController {
|
|
111
111
|
next();
|
112
112
|
} catch (error) {
|
113
113
|
res.statusCode = 500;
|
114
|
-
return
|
114
|
+
return next(error);
|
115
115
|
}
|
116
116
|
};
|
117
117
|
}
|