New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sswahn/authorizer

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

@sswahn/authorizer

An AWS Cognito authorizer for APIGateway that uses HTTP Cookies.

1.0.0-beta.0
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Authorizer

An AWS Cognito authorizer for APIGateway that uses HTTP Cookies.

Overview

Designed for use with AWS Lambda as a custom authorizer for AWS API Gateway to authenticate and authorize users against an AWS Cognito User Pool.

Requirements

Before deploying, make sure to configure the following:

  • AWS Cognito User Pool: Set up an AWS Cognito User Pool and configure it with appropriate security settings.

  • AWS API Gateway: Create an AWS API Gateway and configure the Lambda authorizer to use the Lambda function implementing this authorizer.

  • IAM Permissions: Ensure that the IAM role associated with this Lambda function has the necessary permissions to interact with AWS Cognito. Specifically, the Lambda function should have permissions to execute the GetUserCommand and any other relevant AWS SDK operations. Sample IAM policy:

   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "cognito-idp:GetUser",
         ],
         "Resource": [
           "arn:aws:cognito-idp:YOUR_REGION:YOUR_ACCOUNT_ID:userpool/YOUR_USER_POOL_ID"
         ]
       }
     ]
   }

Usage

import authorizer from '@sswahn/authorizer'

export const handler = async (event, context, callback) => {
  authorizer('cookieName', event, callback)
}

License

Authorizer is MIT Licensed

Keywords

authorizer

FAQs

Package last updated on 06 Nov 2023

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