Commit 8be1824e by zCaesar

can reg

parent 0a8a3a7c
...@@ -17,11 +17,14 @@ var debug = false; ...@@ -17,11 +17,14 @@ var debug = false;
function authCheck(client_id, token, password, callback) { function authCheck(client_id, token, password, callback) {
if (require('./checkClientRole').checkRealDB(token)) { // auth realtimedb by token if (require('jwt-verify').verify(token)) { // auth realtimedb by token
callback(true); callback(true);
} }
// if (require('./checkClientRole').checkRealDB(token)) { // auth realtimedb by token
// callback(true);
// }
else { else {
if (require('./checkClientRole').getRole(token)) callback(true) // auth client device by token if (require('jwt-verify').verify(token)) callback(true) // auth client device by token
else { else {
seneca.act('cmd:getAccessTokenInfo, tokencode:'+token, function(err,res) { seneca.act('cmd:getAccessTokenInfo, tokencode:'+token, function(err,res) {
if (!err && res) { if (!err && res) {
......
...@@ -25,7 +25,8 @@ module.exports = function (options = {}) { ...@@ -25,7 +25,8 @@ module.exports = function (options = {}) {
cache.set(cachekey, true); // cache missed cache.set(cachekey, true); // cache missed
} }
var response var response
var decoded = require('./checkClientRole').checkRealDB(req.body.username) var decoded = require('jwt-verify').verify(req.body.username)
// var decoded = require('./checkClientRole').checkRealDB(req.body.username)
if (decoded) { if (decoded) {
if (decoded.role === 'realtimedb') response = { 'result': 'ok' } if (decoded.role === 'realtimedb') response = { 'result': 'ok' }
......
...@@ -437,6 +437,24 @@ ...@@ -437,6 +437,24 @@
"safe-buffer": "^5.0.1" "safe-buffer": "^5.0.1"
} }
}, },
"jwt-verify": {
"version": "git+https://nexpienpm:CCqLQjg4ytvzN7QbssUV@dev.nexpie.com/npm/jwt-verify.git#62d6b0a4bd2996a3540e2b6e07a06103db6749dd",
"from": "git+https://nexpienpm:CCqLQjg4ytvzN7QbssUV@dev.nexpie.com/npm/jwt-verify.git#issuer",
"requires": {
"config": "^2.0.1",
"jsonwebtoken": "^8.3.0"
},
"dependencies": {
"config": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/config/-/config-2.0.1.tgz",
"integrity": "sha512-aTaviJnC8ZjQYx8kQf4u6tWqIxWolyQQ3LqXgnCLAsIb78JrUshHG0YuzIarzTaVVe1Pazms3TXImfYra8UsyQ==",
"requires": {
"json5": "^1.0.1"
}
}
}
},
"lodash": { "lodash": {
"version": "4.17.10", "version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"jsonwebtoken": "^8.3.0", "jsonwebtoken": "^8.3.0",
"lru-cache": "^4.1.3", "lru-cache": "^4.1.3",
"restify": "^7.1.1", "restify": "^7.1.1",
"seneca": "^3.6.0" "seneca": "^3.6.0",
"jwt-verify": "git+https://nexpienpm:CCqLQjg4ytvzN7QbssUV@dev.nexpie.com/npm/jwt-verify.git#issuer"
}, },
"devDependencies": { "devDependencies": {
"mocha": "^5.2.0" "mocha": "^5.2.0"
......
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