Skip to content

Commit

Permalink
authorize function
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmyk committed Apr 12, 2019
1 parent 9b4e37e commit 9814e75
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ publish('the.key', [ 'args' ], { kwArgs: false }, {
Take a look for more use cases at http://jeta.host/

## Changes:
2019-04-11
- authorize function supported for SUBSCRIBE & PUBLISH

2019-03-22
- WAMP registration option.concurrency supported.

Expand Down
1 change: 1 addition & 0 deletions lib/fox_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Session = require('./session')
const tools = require('./tools')

function FoxApi (realm) {
this.registerSession = () => {}
Session.call(this, this)
this.sessionId = tools.randomId()

Expand Down
5 changes: 4 additions & 1 deletion lib/mqtt/gate.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@ handlers.publish = function (ctx, session, message) {
data = { payload: message.payload }
}

let uri = mqttParse(message.topic)
this.checkAuthorize(ctx, 'publish', uri)

session.realm.doPush(session, {
mtype: 'publish',
uri: mqttParse(message.topic),
uri,
data,
opt
})
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fox-wamp",
"version": "0.6.1",
"version": "0.6.2",
"description": "Web Application Message Router/Server WAMP/MQTT",
"author": {
"name": "Anatoly Tsapkov",
Expand All @@ -22,11 +22,11 @@
"subscribe"
],
"dependencies": {
"commander": "^2.19.0",
"commander": "^2.20.0",
"jsonschema": "^1.2.4",
"mqtt-packet": "^6.1.1",
"node-statsd": "*",
"qlobber": "*",
"qlobber": "^3.1.0",
"ws": "^6.2.1"
},
"devDependencies": {
Expand Down

0 comments on commit 9814e75

Please sign in to comment.