Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/seneca-mosca-auth
Authentication and Authorization for Mosca using Seneca and Seneca User
https://github.com/mcollina/seneca-mosca-auth
Last synced: 13 days ago
JSON representation
Authentication and Authorization for Mosca using Seneca and Seneca User
- Host: GitHub
- URL: https://github.com/mcollina/seneca-mosca-auth
- Owner: mcollina
- License: mit
- Created: 2016-03-02T10:13:27.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T16:49:58.000Z (almost 9 years ago)
- Last Synced: 2024-12-17T15:43:20.798Z (23 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# seneca-mosca-auth
[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]Authentication and Authorization for [Mosca](http://npm.im/mosca) using [Seneca](http://npm.im/seneca) and [Seneca User](http://npm.im/seneca-user).
This is a specialization of [Seneca User](http://npm.im/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
```js
'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: '[email protected]',
password: 'mypassword',
publishPatterns: ['hello', 'a/#', 'b/+'],
subscribePatterns: ['hello', 'a/#', 'b/+']
})
```This project was kindly sponsored by [nearForm](http://nearform.com).
## License
MIT
[npm-badge]: https://badge.fury.io/js/seneca-mosca-auth.svg
[npm-url]: https://badge.fury.io/js/seneca-mosca-auth
[travis-badge]: https://api.travis-ci.org/mcollina/seneca-mosca-auth.svg
[travis-url]: https://travis-ci.org/mcollina/seneca-mosca-auth