modern-pep

1.0.9 • Public • Published

What is this repository for?

  • Quick summary Using this library we can apply policy enforcement point (PEP) in an application. A policy enforcement point (PEP) is responsible for receiving authorization requests that are sent to the policy decision point (PDP) for evaluation. A PEP can be anywhere in an application where data and resources must be protected, or where authorization logic is applied.

  • Version : 1.0.5

How do I get set up?

npm install modern-pep

To configuration

const { Authorizer } = require("modern-pep");

const authz = new Authorizer(atomsList, heimdallBaseUrl); 

Note:

  1. atomsList will be array of object. For example:-
[
  {
    "id": "create-user-ui",
    "description": "create a user in the operation ui",
    "predicate": "create",
    "tags": [
        "dataos:type:user"
    ]
}
]
  1. heimdallBaseUrl will get from .env file and pass as argument.

If you want to authorize multiple atoms id then use authorizeBatch methode. For this we need to pass two params one is array of atomsId and token of user.

authz.authorizeBatch(atomsId, token);

To perform CRUD opration on yaml file, some methods also available.

const {
  createYamlFile,
  getAtoms,
  addAtom,
  updateAtom,
  removeAtom,
} = require("modern-pep");

We can also perform CRUD operation from command line.

// To create pep-spec.yaml file
node -e 'require("modern-pep").createYamlFile()'

// To get all the list of atoms from file
node -e 'require("modern-pep").getAtoms()' 

// To add new atom
node -e 'require("modern-pep").addAtom({  
    "id": "operations-app-create-user-ui-test",
    "description": "create a user in the operation ui",
    "predicate": "create",
    "tags": [
        "dataos:type:user"
    ]
})'

// To update existing atom
node -e 'require("modern-pep").updateAtom({                                     
    "id": "operations-app-create-user-ui-test",
    "description": "test create a user in the operation ui",
    "predicate": "create",
    "tags": [
        "dataos:type:user"
    ]
})'

// To remove atom from the file
node -e 'require("modern-pep").removeAtom('operations-app-create-user-ui-test')'

Readme

Keywords

Package Sidebar

Install

npm i modern-pep

Weekly Downloads

82

Version

1.0.9

License

ISC

Unpacked Size

9.85 kB

Total Files

5

Last publish

Collaborators

  • the-modern-data-company