Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
3cd9bfde
Commit
3cd9bfde
authored
Sep 16, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add on delivery and signRole function
parent
914f4fdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
authhook/index.js
+12
-8
No files found.
authhook/index.js
View file @
3cd9bfde
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment