cti-dealer-auth-middleware

3.5.0 • Public • Published

cti-dealer-auth-middleware

Middleware to embed auth object, which implements permissions' checks, into the request

Usage

const dealerAuthMiddleware = require( 'cti-dealer-auth-middleware' );
const restify = require( 'restify' );
 
const server = restify.createServer();
 
// Note: authentication meadleware must come first
server.use( dealerAuthMiddleware );

Testing code that uses this library

I haven't found a great way to do this, so for now I've provided nocker, which is a tool that sets up nock to mock out the calls that this library will make. E.g.:

const nock = require( 'nock' );
const nocker = require( 'cti-dealer-auth-middleware/nocker' );
 
nocker.userDealerScopes( 'some-user', 'some-dealer', [ 'some-scope', 'other-scope'] );
 
// Run your test

Package Sidebar

Install

npm i cti-dealer-auth-middleware

Weekly Downloads

3

Version

3.5.0

License

MIT

Last publish

Collaborators

  • cantireinnovations