cti-dealer-auth-middleware
v3.5.0
Published
Middleware to embed auth object, which implements permissions' checks, into the request
Downloads
11
Maintainers
Readme
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