3 var env = require('gitter-web-env');
4 var winston = env.logger;
5 var logoutDestroyTokens = require('./logout-destroy-tokens');
6 var userScopes = require('gitter-web-identity/lib/user-scopes');
8 module.exports = function(req, res, next) {
10 if (user && userScopes.isMissingTokens(user)) {
11 winston.warn('tokenless-user-middleware: authenticated user has no tokens, rejecting.', {
12 username: user.username,
16 return logoutDestroyTokens(req, res, next);