1.0.1 • Published 4 years ago

vincesoftware-module-resource-auth v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Vincesoftware module resource auth

This modules enables to define access control based on predefined rules. Using these rules the module also authorizes requests. TenantUser's permissions are fetched from tenantManagementTable and checked against provides access control rules;

Usage

const tenantId = 'TENANT-22';
const userId = 'USER-11';
const stage = 'dev';
const region = 'eu-central-1';
const authorizer = new ResourceAuthorizer(tenantId, userId, stage, region)
authorizer.addValidPermission({resourceId: 'workflow-23', operation: 'READ', type: 'WORKFLOW'});

try {
   async authorizer.preAuthorize();
} catch (e) {
   // catch unauthorized error
}
1.0.1

4 years ago