1.3.2 • Published 6 years ago

security-route v1.3.2

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

Security Route

This microu module should be used if you need a micro access blocking to your routes. To use this service you will need to have some code to:

  • Use express in your project
  • Create your session validation service
  • Setup your project roles
  • Create a simple way to retreive your users

Basic usage

var Router = require('security-route').Router;

module.exports = function(){

    /* 
    * app -> Express App
    * roleList -> array
    * sessionValidationService -> object
    */

    Router = Router(app, roleList, sessionValidationService);

    Router.addRoute({
        verb: 'get',
        path: '/login',
        action: Controller.controllerAction,
        role: ['ROLE_ADMIN', 'ROLE_USER']
    });

//...

}

Role List example

module.exports = {
  default_role: "ANONYMOUS",
  roles: [
    'ANONYMOUS',
    'ROLE_USER',
    'ROLE_HR',
    'ROLE_CONSULTANT',
    'ROLE_ADMIN'
  ]
}
1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago