This repository is a library that contains 2 main functionalities. First, a Policy Builder that get data from request and payload in order to build the policy structure, then it can check permissions mapping policy structure against resources list.
Second, a decorator. The decorator is able to use it into an api gateway as a generic check or less specific test. Also, this decorator could be used inside a microservice such as a authorizer decorator with more specificity.
##Example
####Generic by resources:
@authorizer()
####Specific by tenant:
@authorizer({tenantIdField: 'tenantId'})
####Specific by bidi:
@authorizer({bidiIdField: 'tenantId'})
####Specific by both
@authorizer({ tenantIdField: 'tenantId', bidiIdField: 'tenantId' })