Commit f1ffcccf by zCaesar

can check different token

parent 74b7fd7f
var config = require('config');
var verify = require('./verifyToken').verifyToken
var checkRealDB = require('./checkClientRole').checkRealDB
var getRole = require('./checkClientRole').getRole
// https://github.com/isaacs/node-lru-cache
var LRU = require("lru-cache"),
......@@ -15,16 +16,23 @@ var debug = false;
// for testing
function authCheck(client_id, token, password, callback) {
verify(token, (err, decoded) => {
checkRealDB(token, (err, decoded) => {
/*
* decode.scope
* decode.iat
* decode.exp
*/
if (err) {
getRole(token, (role) => {
if (role === false) {
callback(false)
}
else callback(true)
})
}
else {
callback(true)
}
// authclient.act({role:'auth',cmd:'token',action:'info',token: token}, function(err, res) {
// if (debug) {
......@@ -48,8 +56,6 @@ function authCheck(client_id, token, password, callback) {
// callback(false);
// }
// });
callback(true)
}
})
}
......
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