Commit 4fbd30e5 authored by pdg16's avatar pdg16
Browse files

validate token

parent 85a068a4
Pipeline #21785 failed with stage
in 1 minute and 25 seconds
Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of simcaq-node.
simcaq-node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
simcaq-node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <>.
const express = require('express');
const validateToken = express.Router();
const libs = `${process.cwd()}/libs`;
const log = require(`${libs}/log`)(module);
const AccessToken = require(`${libs}/models/accessToken`);
const User = require(`${libs}/models/user`);
const passport = require('passport');
const mongoose = require('mongoose');
const ObjectId = mongoose.Types.ObjectId;
const checkOrigin = require(`${libs}/middlewares/authOrigin`);
validateToken.get('/', passport.authenticate('bearer', { session: false }), checkOrigin, (req, res) => {
return res.json({access: "Authorized", name:, email:, userId: req.user._id, origin: req.user.origin, adminSimcaqNode: req.user.adminSimcaqNode, adminLDE: req.user.adminLDE });
module.exports = validateToken;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment