body-validator-middleware
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Smarthalo AUTH middy Middleware

The auth middy middleware used @smarthalo for microservices.

How to install

Latest: npm install ssh://git@bitbucket.org/smart_halo/auth-middleware.git#master

Or a specific version: npm install ssh://git@bitbucket.org/smart_halo/auth-middleware.git#1.1.0

Basic usage

import { accessTokenValidationMiddleware } from '@smarthalo/auth-middleware';
import middy from '@middy/core';

const dfuHandler = (event, context, callback) => {
  // do stuff with user that have the dfu_allow_write priviledges
  // ...

  return callback(null, { result: 'success', message: 'Succeed', code: 200})
}

export const myHandler = middy(dfuHandler)
  .use(accessTokenValidationMiddleware({
    // the ACLs (called scopes) here
    accessTokenScopes: ['dfu_allow_write'],
  }));

Contribute

Clone and install the repo

npm install

test

npm test

Publish

npx tsc -p ./ tag and push to the remote

Package Sidebar

Install

npm i body-validator-middleware

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

7.88 kB

Total Files

9

Last publish

Collaborators

  • smarthalo