text: const passport = require('passport')
  const { User, UserRole } = require('../models')
  
  const JwtStrategy = require('passport-jwt').Strategy
  const ExtractJwt = require('passport-jwt').ExtractJwt
  
  const config = require('../config/config')
  
  passport.use(
    new JwtStrategy({
      jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
      secretOrKey: config.authentication.jwtSecret
    }, async (jwtPayload, done) => {
      try {
        const user = await User.findOne({ 
  				where: {
            id: jwtPayload.id
          },
  				include: UserRole,
        })
        if (!user) {
          return done(new Error(), false)
        }
        return done(null, user)
      } catch (err) {
        return done(new Error(), false)
      }
    })
  )
  
  module.exports = null