Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

restify-basic-acl

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify-basic-acl

Utilize basic role-based HTTP method ACL as a Restify middleware.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

restify-basic-acl

Version Downloads

Enable basic role-based ACL on an HTTP-method basis. Great for small applications that manage one or two resources, such as micro-services.

Installation & Usage

After installing restify-basic-acl with npm i --save restify-basic-acl, add it as a Restify plugin:

let restify = require('restify');
let basicAcl = require('restify-basic-acl');

let roles = {
    user: [
        'get',
    ],
    admin: [
        'get',
        'post',
        'put',
        'delete',
    ],
};

let server = restify.createServer();

server
    .use(basicAcl.basicAclPlugin({
        // the header that the authenticated user's info is passed (JSON is auto-decoded)
        // it is then stored in req.user in any future middleware
        userHeader: 'X-User',
        // the header that the authenticated user's roles are passed (comma-separated)
        // they are then stored in req.roles in any future middleware
        rolesHeader: 'X-User-Roles',
        // pass in your permission data here, that one of the user's roles should match
        roles: roles,
        // optionally specify exact routes that should bypass ACL entirely
        unprotectedRoutes: [
            '/health',
        ],
    }, restify))
    .listen(3000);

Keywords

FAQs

Package last updated on 12 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc