Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.use((req, res, next) => {
if (req.user) {
const login = req.user.sub;
let client = mapFabricStarterClient[login];
if (client) {
logger.debug('cached client for', login);
req.fabricStarterClient = client;
} else {
throw (new jwt.UnauthorizedError("No client context", {message: 'User is not logged in.'}));
}
}
next();
});