Comparing version 5.6.16 to 5.6.17
@@ -231,28 +231,27 @@ let http = require('http') | ||
self.verifyJwtToken( token ) | ||
.then( (decoded) => { | ||
if ( self.config.server.jwt.decode ) | ||
decoded = self.config.server.jwt.decode( decoded ) | ||
try { | ||
let decoded = self.verifyJwtToken( token ) | ||
if ( self.config.server.jwt.decode ) | ||
decoded = self.config.server.jwt.decode( decoded ) | ||
if ( acquiring ) { | ||
if ( decoded.issueDate < Date.now() - self.config.server.jwt.timeout ) | ||
throw new Error( 'Session timed out' ) | ||
if ( acquiring ) { | ||
if ( decoded.issueDate < Date.now() - self.config.server.jwt.timeout ) | ||
throw new Error( 'Session timed out' ) | ||
return next() | ||
} | ||
return next() | ||
} | ||
req.user = decoded | ||
req.user = decoded | ||
if ( self.config.server.jwt.checkValidity ) | ||
self.config.server.jwt.checkValidity( req.url, decoded ) | ||
if ( self.config.server.jwt.checkValidity ) | ||
self.config.server.jwt.checkValidity( req.url, decoded ) | ||
next( ) | ||
} ) | ||
.catch( () => { | ||
for (let key in self.originHeaders) | ||
res.setHeader( key, self.originHeaders[key] ) | ||
res.setHeader( 'Content-type', 'text/plain' ) | ||
res.statusCode = 401 | ||
res.end( 'Invalid or missing token.' ) | ||
} ) | ||
next( ) | ||
} catch ( err ) { | ||
for (let key in self.originHeaders) | ||
res.setHeader( key, self.originHeaders[key] ) | ||
res.setHeader( 'Content-type', 'text/plain' ) | ||
res.statusCode = 401 | ||
res.end( 'Invalid or missing token.' ) | ||
} | ||
} ) | ||
@@ -259,0 +258,0 @@ |
{ | ||
"name": "floca", | ||
"version": "5.6.16", | ||
"version": "5.6.17", | ||
"description": "Enterprise-grade microservice solution for NodeJS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77358
804