Skip to content

Authentication and Authorization for Mosca using Seneca and Seneca User

License

Notifications You must be signed in to change notification settings

mcollina/seneca-mosca-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seneca-mosca-auth

npm version Build Status

Authentication and Authorization for Mosca using Seneca and Seneca User.

This is a specialization of Seneca User for this specific use case. Go there and have a look for the full docs. The default role is changed from 'user' to 'mosca-auth'.

Install

npm i mosca seneca-mosca-auth --save

Usage

'use strict'

const Mosca = require('mosca')
const Seneca = require('seneca')
const MoscaAuth = require('seneca-mosca-auth')

var seneca = Seneca()
seneca.use(MoscaAuth)
var server = new Mosca.Server()

// configures Mosca to authenticate via seneca
MoscaAuth.setup(seneca, server)

// register a user
seneca.act({
  role: 'mosca-auth',
  cmd: 'register',
  nick: 'mydevice',
  email: 'matteo.collina@nearform.com',
  password: 'mypassword',
  publishPatterns: ['hello', 'a/#', 'b/+'],
  subscribePatterns: ['hello', 'a/#', 'b/+']
})

Acknowledgements

This project was kindly sponsored by nearForm.

License

MIT

About

Authentication and Authorization for Mosca using Seneca and Seneca User

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published