Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream error message and secure options for Auth0 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/ponte.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function Ponte(opts, done) {
}, function(err) {
if (done) {
done(err, that);
} else if(err) {
console.log("Ponte Server setting " + err );
}
});
}
Expand Down
16 changes: 16 additions & 0 deletions lib/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ module.exports = [{
service: "MQTT"
});
var server = new mosca.Server(opts, cb);
// example server opts for Auth0 and secure
// mqtt: {
// port: 6001, // tcp but overrided by secure port number following
// secure: {
// port: 8443, // override the default and non-secure port setting
// keyPath: SECURE_KEY, // TLS key path
// certPath: SECURE_CERT, // TLS Cert path
// authMethod: auth0, // sample of the auth0 functions from package auth0mosca
// },
// }
if( opts.secure ) {
if( opts.secure.authMethod.constructor.name === "Auth0Mosca" ) {
server.authenticate = opts.secure.authMethod.authenticateWithCredentials();
server.authorizePublish = opts.secure.authMethod.authorizePublish();
server.authorizeSubscribe = opts.secure.authMethod.authorizeSubscribe();
}
server.on('published', function moscaPonteEvent(packet) {
opts.ponte.emit('updated', packet.topic, packet.payload);
});
Expand Down