1.0.9 • Published 1 year ago

modern-pep v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

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')'
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago