crab-role-based-acl
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

crab-role-based-acl

NPM version npm download

Install

crab-role-based-acl

npm install --save crab-role-based-acl

Features

- Init JWT authentication
- Role base access authorization support
- Express middleware support

Install

  • Install crab-role-based-acl
npm install crab-role-based-acl

How it work

Middlewares

import { roleBasedAuthorization, validAuthentication, validSupportOrigin } from "crab-role-based-acl";

1. validAuthentication

Using json web token to basic authentication.

valid request:

headers:
    {
        "Authorization": {jwtToken}
    }

2. validSupportOrigin

Using json web token to fitlering token support request origin.

valid token:

token payload: {
    'allowed-origins': [listSupportOrigin]
}

3. roleBasedAuthorization

Using role-based access to authorization

used:

roleBasedAuthorization(allowRolesString)

valid allow roles string:

  • role name with sso sever defines
  • multiple role names with ","
  • allow all roles with allowRolesString = "*"

LICENSE

MIT

Package Sidebar

Install

npm i crab-role-based-acl

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

24.8 kB

Total Files

38

Last publish

Collaborators

  • luonguit