hos-auth
Authentication of HoS calls.
Last updated 4 years ago by al_kh31 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hos-auth 
SYNC missed versions from official npm registry.

HoSAuth

Authentication module for HoS on air packages.

npm install hos-auth

requirement:

  • rabbitMQ

Example

HoSAuth = require('hos-auth')

authenticationService = new HoSAuth()
HoSService.connect()

In order to give the library access to the target rabbitMQ you can set following environmental variables:

  • AMQP_URL
  • AMQP_USERNAME
  • AMQP_PASSWORD

All messages going sent in HoS environmental needs to be verified by this service, you need to listen to message event and according to content reject or accept a message in order to deliver into the destination or get back to the sender:

@HoSAuth.on 'message', (msg)=>
    if msg.content.foo is 'bar'
        msg.accept()
    else
        msg.reject()

While rejecting a message it is possible to specify the reason msg.reject(reason, code) default values are reason = "fail to authenticat", code = 401

Running Tests

Run test by:

gulp test

requires local rabbitMQ or setting up AMQP_URL , AMQP_USERNAME and AMQP_PASSWORD

This software is licensed under the MIT License.

Current Tags

  • 0.2.4                                ...           latest (4 years ago)

5 Versions

  • 0.2.4                                ...           4 years ago
  • 0.2.3                                ...           4 years ago
  • 0.2.2                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |