applay-utils 1.2.13 → 1.2.14
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/package.json +1 -1
- package/utils/jwt.js +1 -9
package/package.json
CHANGED
package/utils/jwt.js
CHANGED
|
@@ -13,15 +13,7 @@ var utils = {
|
|
|
13
13
|
if (!key) return res.status(401).json({ auth: false, message: 'Sem key definida.' });
|
|
14
14
|
jwt.verify(token, key, (err, decoded) => {
|
|
15
15
|
if (err) return res.status(401).json({ auth: false, message: 'Falha na autenticação do token.' });
|
|
16
|
-
req.
|
|
17
|
-
var cfgSystem = cfg.systems[req.hostname];
|
|
18
|
-
if (!cfgSystem) {
|
|
19
|
-
console.log('req.hostname', req.hostname);
|
|
20
|
-
return res.status(404).send({ msg: 'Hostname não encontrado', status: false, code: 404 });
|
|
21
|
-
}
|
|
22
|
-
if (cfgSystem.alias != decoded.id.split('#')[1]) {
|
|
23
|
-
return res.status(401).json({ auth: false, message: 'Alias diferente do token.' });
|
|
24
|
-
}
|
|
16
|
+
req.tokenId = decoded.id;
|
|
25
17
|
next();
|
|
26
18
|
});
|
|
27
19
|
},
|