exodus-framework 2.0.768 → 2.0.770
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/middlewares/access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,WAAW,UAAW,YAAY,EAAE,KAAG,cAAc,CAWnD;IAEF,SAAS,EAAE,cAAc,
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/middlewares/access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,WAAW,UAAW,YAAY,EAAE,KAAG,cAAc,CAWnD;IAEF,SAAS,EAAE,cAAc,CAwEvB;CACH;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -27,6 +27,7 @@ class AccessMiddleware extends _controller.default {
|
|
27
27
|
const account = req.auth?.account;
|
28
28
|
const tenantId = req.header('X-Exodus-Tenant-ID');
|
29
29
|
const applicationId = req.header('X-Exodus-Application-ID');
|
30
|
+
let isApplication = false;
|
30
31
|
const requestor = {
|
31
32
|
database: '',
|
32
33
|
id: account?.uuid,
|
@@ -38,6 +39,7 @@ class AccessMiddleware extends _controller.default {
|
|
38
39
|
|
39
40
|
/* Aplicações */
|
40
41
|
if (applicationId) {
|
42
|
+
isApplication = true;
|
41
43
|
const application = await _models.Application.findOne({
|
42
44
|
where: {
|
43
45
|
token: applicationId
|
@@ -85,6 +87,7 @@ class AccessMiddleware extends _controller.default {
|
|
85
87
|
id: envUuid || _app.Core.settings.getDatabase().service.database
|
86
88
|
};
|
87
89
|
req.requestor = requestor;
|
90
|
+
req.isApplication = isApplication;
|
88
91
|
next();
|
89
92
|
};
|
90
93
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { RequestHandler } from 'express';
|
2
2
|
import HttpController from '../app/controller';
|
3
3
|
declare class AuthenticationMiddleware extends HttpController {
|
4
|
-
decryptToken: RequestHandler;
|
4
|
+
decryptToken(required?: boolean): RequestHandler;
|
5
5
|
}
|
6
6
|
export default AuthenticationMiddleware;
|
7
7
|
//# sourceMappingURL=authentication.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,wBAAyB,SAAQ,cAAc;IACnD,YAAY,
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,wBAAyB,SAAQ,cAAc;IACnD,YAAY,CAAC,QAAQ,GAAE,OAAc,GAAG,cAAc;CAUvD;AAED,eAAe,wBAAwB,CAAC"}
|
@@ -10,12 +10,15 @@ var _controller = _interopRequireDefault(require("../app/controller"));
|
|
10
10
|
var _security = _interopRequireDefault(require("../services/security"));
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
12
|
class AuthenticationMiddleware extends _controller.default {
|
13
|
-
decryptToken =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
decryptToken(required = true) {
|
14
|
+
return (0, _expressJwt.expressjwt)({
|
15
|
+
secret: async () => {
|
16
|
+
return _security.default.singleton().getServicePublicKey().toPEM(false);
|
17
|
+
},
|
18
|
+
issuer: _app.Core.settings.getAuthentication().serviceIssuer,
|
19
|
+
algorithms: ['RS256'],
|
20
|
+
credentialsRequired: required // Controla se o token é obrigatório
|
21
|
+
});
|
22
|
+
}
|
20
23
|
}
|
21
24
|
var _default = exports.default = AuthenticationMiddleware;
|