Package Exports
- aws-api-auth-policy
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aws-api-auth-policy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
aws-api-auth-policy
Typescript implementation of AWS API Gateway Lambda Authorizer policy creator
Install
$ npm install aws-api-auth-policyInput
import {ApiOptions, AuthPolicy} from "aws-api-auth-policy";
const userId = "12345";
const awsAccountId = "6789";
const apiOptions: ApiOptions = {};
apiOptions.region = "us-east-1";
apiOptions.restApiId = "restApiId";
apiOptions.stage = "stage";
var authPolicy = new AuthPolicy(userId, awsAccountId, apiOptions);
authPolicy.allowAllMethods();
var generated = authPolicy.build();
var policyJson = JSON.stringify(generated);
console.log(policyJson);Output
{
"principalId": "12345",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Effect": "Allow",
"Resource": [
"arn:aws:execute-api:us-east-1:6789:restApiId/stage/*/*"
]
}
]
}
}