Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof newValue === "undefined") {
// Keep oldValue.
} else {
node[field] = newValue;
}
} else if (typeof oldValue === "object") {
this.genericVisit(oldValue);
}
}
return node;
}
});
require("depd")('require("recast").Visitor').property(
Visitor, "extend",
'Please use require("recast").visit instead of require("recast").Visitor'
);
import depd from 'depd';
const deprecate = depd('node-global-identity');
export default function isAuthenticated(globalIdentity) {
deprecate('isAuthenticated(gi): Use gi.isAuthenticated() instead');
return (req, res, next) => {
if (!req.headers.authorization) {
return res.status(401).json({ error: { message: 'Invalid token' } });
}
const [authType, token] = req.headers.authorization.split(' ');
if (!authType || !token) {
return res.status(401).json({ error: { message: 'Invalid token' } });
}
return globalIdentity.validateToken(token).then((result) => {