Skip to main content

cdk-lambda-token-authorizer-jwt

Project description

GitHub GitHub release (latest SemVer) npm (scoped) PyPI GitHub Workflow Status (branch) Maintainability codecov Gitpod ready-to-code

CDK Lambda TokenAuthorizer JWT

Add a lambda function to your project which can be used as a apigateway token authorizer

Install

TypeScript

npm install @cloudy-with-a-chance-of-meatballs/cdk-lambda-token-authorizer-jwt
yarn add @cloudy-with-a-chance-of-meatballs/cdk-lambda-token-authorizer-jwt

Python

pip install cloudy-with-a-chance-of-meatballs.cdk-lambda-token-authorizer-jwt

Usage

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';

//### EXAMPLE: import the function
import { TokenAuthorizerJwtFunction } from "@cloudy-with-a-chance-of-meatballs/cdk-lambda-token-authorizer-jwt";
//### END

export class HelloworldStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const api = new apigateway.RestApi(this, 'ApiName', {});

    //### EXAMPLE: init the function
    const tokenAuthFunction = new TokenAuthorizerJwtFunction(this, 'lambdaFunctionName', {});
    //### END

    const tokenAuthorizer = new apigateway.TokenAuthorizer(this, 'tokenAuthorizerName', {
      //### EXAMPLE: use as handler
      handler: tokenAuthFunction
      //### END
    });

    // ...
    const someMethod = SOMEAPIRESOURCE.addMethod("GET", SOMETARGETINTEGRATION, { authorizer: tokenAuthorizer });
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file cloudy-with-a-chance-of-meatballs.cdk-lambda-token-authorizer-jwt-0.0.10.tar.gz.

File metadata

File hashes

Hashes for cloudy-with-a-chance-of-meatballs.cdk-lambda-token-authorizer-jwt-0.0.10.tar.gz
Algorithm Hash digest
SHA256 ea06253a746bc92d3c6dcfde3078f8bd0df371f9fce72d7f942d5b0416100a89
MD5 cb80568f793f01c70dc765487e291df9
BLAKE2b-256 8b834449a6535412e85c1b7cc4bc299a20e30942d7a6a074be05d000c3203714

See more details on using hashes here.

File details

Details for the file cloudy_with_a_chance_of_meatballs.cdk_lambda_token_authorizer_jwt-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudy_with_a_chance_of_meatballs.cdk_lambda_token_authorizer_jwt-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 c2c84918dd8370779ccc806e798532ee5c7c23fcad23dba5846d345192abcdad
MD5 d21ddfee5a957b1a39ebba7b1a32237f
BLAKE2b-256 a00d86a54dab99d530fa5f7e3b68670649d53bddff7c55e336f8905f4d1ea73a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page