Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-api-auth-policy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-api-auth-policy

Typescript implementation of AWS API Gateway Lambda Authorizer policy creator

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
decreased by-0.48%
Maintainers
1
Weekly downloads
 
Created
Source

aws-api-auth-policy

Typescript implementation of AWS API Gateway Lambda Authorizer policy creator

Install

$ npm install aws-api-auth-policy

Input

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/*/*"
        ]
      }
    ]
  }
}

Keywords

FAQs

Package last updated on 02 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc