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
9c233f79
Commit
9c233f79
authored
Dec 01, 2018
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix vernemq error when authhook reject client
parent
8ac40526
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
16 deletions
+17
-16
authhook/.gitignore
+1
-0
authhook/auth_on_publish.js
+3
-3
authhook/auth_on_register.js
+7
-7
authhook/auth_on_subscribe.js
+3
-3
authhook/on_unsubscribe.js
+3
-3
authhook/package-lock.json
+0
-0
No files found.
authhook/.gitignore
View file @
9c233f79
.DS_Store
.DS_Store
node_modules/
node_modules/
config/*.json
config/*.json
*.rdb
authhook/auth_on_publish.js
View file @
9c233f79
...
@@ -34,7 +34,7 @@ module.exports = function (options = {}) {
...
@@ -34,7 +34,7 @@ module.exports = function (options = {}) {
if
(
decoded
)
{
if
(
decoded
)
{
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
();
next
();
}
}
...
@@ -65,7 +65,7 @@ module.exports = function (options = {}) {
...
@@ -65,7 +65,7 @@ module.exports = function (options = {}) {
next
();
next
();
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
});
});
...
@@ -75,7 +75,7 @@ module.exports = function (options = {}) {
...
@@ -75,7 +75,7 @@ module.exports = function (options = {}) {
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
}
}
...
...
authhook/auth_on_register.js
View file @
9c233f79
...
@@ -109,17 +109,17 @@ module.exports = function (options = {}) {
...
@@ -109,17 +109,17 @@ module.exports = function (options = {}) {
console
.
log
(
'redis:status: '
+
status
)
console
.
log
(
'redis:status: '
+
status
)
if
(
status
)
{
if
(
status
)
{
res
.
send
({
res
.
send
({
"result"
:
"ok"
result
:
'ok'
});
});
}
else
{
}
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
{
error
:
'not allowed'
}
});
});
}
}
})
})
}
else
{
}
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
{
error
:
'not allowed'
}
});
});
}
}
// const util = require('util')
// const util = require('util')
...
@@ -132,17 +132,17 @@ module.exports = function (options = {}) {
...
@@ -132,17 +132,17 @@ module.exports = function (options = {}) {
console
.
log
(
'redis:status: '
+
status
)
console
.
log
(
'redis:status: '
+
status
)
if
(
status
)
{
if
(
status
)
{
res
.
send
({
res
.
send
({
"result"
:
"ok"
result
:
'ok'
});
});
}
else
{
}
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
{
error
:
'not allowed'
}
});
});
}
}
})
})
}
else
{
}
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
{
error
:
'not allowed'
}
});
});
}
}
}
}
...
@@ -150,7 +150,7 @@ module.exports = function (options = {}) {
...
@@ -150,7 +150,7 @@ module.exports = function (options = {}) {
}
}
else
{
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
'no'
});
});
next
();
next
();
}
}
...
...
authhook/auth_on_subscribe.js
View file @
9c233f79
...
@@ -29,7 +29,7 @@ module.exports = function (options = {}) {
...
@@ -29,7 +29,7 @@ module.exports = function (options = {}) {
if
(
decoded
)
{
if
(
decoded
)
{
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
();
next
();
}
}
...
@@ -56,14 +56,14 @@ module.exports = function (options = {}) {
...
@@ -56,14 +56,14 @@ module.exports = function (options = {}) {
next
();
next
();
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
});
});
}
}
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
}
}
...
...
authhook/on_unsubscribe.js
View file @
9c233f79
...
@@ -11,9 +11,9 @@ module.exports = function(options = {}) {
...
@@ -11,9 +11,9 @@ module.exports = function(options = {}) {
if
(
decoded
)
{
if
(
decoded
)
{
if
(
decoded
.
role
===
'realtimedb'
)
{
if
(
decoded
.
role
===
'realtimedb'
)
{
response
=
{
'result'
:
'ok'
}
response
=
{
result
:
'ok'
}
}
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
()
next
()
}
}
...
@@ -28,7 +28,7 @@ module.exports = function(options = {}) {
...
@@ -28,7 +28,7 @@ module.exports = function(options = {}) {
"topics"
:
[
_ftopic
]
"topics"
:
[
_ftopic
]
}
}
}
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
if
(
options
.
debug
)
{
if
(
options
.
debug
)
{
console
.
log
(
'on_unsubscribe-------------'
);
console
.
log
(
'on_unsubscribe-------------'
);
...
...
authhook/package-lock.json
View file @
9c233f79
This diff is collapsed.
Click to expand it.
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