c2-http 1.0.150 → 1.0.152
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.
|
@@ -31,6 +31,7 @@ const http_status_1 = require("http-status");
|
|
|
31
31
|
const jwt = __importStar(require("jsonwebtoken"));
|
|
32
32
|
const __1 = require("../..");
|
|
33
33
|
const GetTokenFlowItem_1 = __importDefault(require("./item/GetTokenFlowItem"));
|
|
34
|
+
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
34
35
|
class MiddlewareCheckTokenFlow {
|
|
35
36
|
async execute() {
|
|
36
37
|
return async (request, response, next) => {
|
|
@@ -91,6 +92,18 @@ class MiddlewareCheckTokenFlow {
|
|
|
91
92
|
(0, c2_util_1.log)("LOG_CHECK_TOKEN_TOKEN", token);
|
|
92
93
|
const decoded = jwt.decode(token, { complete: false });
|
|
93
94
|
(0, c2_util_1.log)("LOG_CHECK_TOKEN_DECODED", decoded);
|
|
95
|
+
const verify = jwt.verify(token, process.env.JWT_SECRET ?? "");
|
|
96
|
+
(0, c2_util_1.log)("LOG_CHECK_TOKEN_VERIFY", verify);
|
|
97
|
+
express_http_context_1.default.set("token", token);
|
|
98
|
+
// httpContext.set("userId", decode.sub)
|
|
99
|
+
// httpContext.set("userProfileId", decode.subProfile)
|
|
100
|
+
// httpContext.set("userIsAdmin", decode.subIsAdmin)
|
|
101
|
+
// httpContext.set("userEmail", decode.subEmail)
|
|
102
|
+
// httpContext.set("userName", decode.subName)
|
|
103
|
+
// httpContext.set("accountId", decode.account)
|
|
104
|
+
// httpContext.set("accountBlockDate", decode.accountBlockDate)
|
|
105
|
+
// httpContext.set("accountExpireDate", decode.accountExpireDate)
|
|
106
|
+
// httpContext.set("scopes", decode.scopes)
|
|
94
107
|
// const tokenDecoded = await ValidateTokenFlowItem.exec(token)
|
|
95
108
|
// AddInContextFlowItem.exec(tokenDecoded, token)
|
|
96
109
|
// const tokenDecoded = jwt.verify(token, process.env.JWT_SECRET ?? "") as unknown as IJWTPayload//await ValidateTokenFlowItem.exec(token)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.152",
|
|
4
4
|
"description": "Biblioteca Typescript para API NodeJS",
|
|
5
5
|
"repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
|
|
6
6
|
"author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",
|