Commit 3cd9bfde by zCaesar

add on delivery and signRole function

parent 914f4fdf
...@@ -7,14 +7,16 @@ var auth_on_subscribe_debug = process.env["AUTH_ON_SUBSCRIBE_DEBUG"] || false; ...@@ -7,14 +7,16 @@ var auth_on_subscribe_debug = process.env["AUTH_ON_SUBSCRIBE_DEBUG"] || false;
var on_publish_debug = process.env["ON_PUBLISH_DEBUG"] || false; var on_publish_debug = process.env["ON_PUBLISH_DEBUG"] || false;
var restify = require('restify'); var restify = require('restify');
var auth_on_register = require('./auth_on_register')({debug: auth_on_register_debug}); var auth_on_register = require('./auth_on_register')({ debug: auth_on_register_debug });
var auth_on_publish = require('./auth_on_publish')({debug: auth_on_publish_debug}); var auth_on_publish = require('./auth_on_publish')({ debug: auth_on_publish_debug });
var auth_on_subscribe = require('./auth_on_subscribe')({debug: auth_on_subscribe_debug}); var auth_on_subscribe = require('./auth_on_subscribe')({ debug: auth_on_subscribe_debug });
var on_publish = require('./on_publish')({debug: on_publish_debug}); var on_publish = require('./on_publish')({ debug: on_publish_debug });
var on_delivery = require('./on_delivery').on_delivery
var signRole = require('./checkClientRole').signRole
const server = restify.createServer({ const server = restify.createServer({
name: 'authhook', name: 'authhook',
version: '1.0.1', version: '1.0.1',
}); });
const port = 40000; const port = 40000;
...@@ -22,7 +24,7 @@ server.use(restify.plugins.bodyParser()); ...@@ -22,7 +24,7 @@ server.use(restify.plugins.bodyParser());
// for testing // for testing
function authByUserPasswd(client_id, username, password) { function authByUserPasswd(client_id, username, password) {
if (!client_id || !username || !password) return false; if (!client_id || !username || !password) return false;
else return true; else return true;
} }
...@@ -33,7 +35,9 @@ server.get('/about', function (req, res, next) { ...@@ -33,7 +35,9 @@ server.get('/about', function (req, res, next) {
server.post('/authreg', auth_on_register); server.post('/authreg', auth_on_register);
server.post('/authpub', auth_on_publish); server.post('/authpub', auth_on_publish);
server.post('/authsub', auth_on_subscribe); server.post('/authsub', auth_on_subscribe);
server.post('/onpub', on_publish); server.post('/ondelivery', on_delivery)
server.post('/onpub', on_publish)
server.post('/signRole', signRole)
server.listen(port, function () { server.listen(port, function () {
console.log('%s listening at %s', server.name, server.url); console.log('%s listening at %s', server.name, server.url);
......
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