Skip to content

Instantly share code, notes, and snippets.

@stream-jdibling
stream-jdibling / auth.go
Last active December 1, 2022 12:25 — forked from miguelmota/auth.go
Golang AWS Cognito Validate JWT token
/* This algorithm is based off of the AWESOME gist by miguelmota:
https://gist.github.com/miguelmota/06f563756448b0d4ce2ba508b3cbe6e2
However that code had two problems -
1) It used a deprecated jwt library (github.com/dgrijalva/jwt-go). The code below uses the current implementation at github.com/golang-jwt/jwt/v4
2) The KeyFunc closure passed to jwt.Parse() always used the second JWK, even if the KID in the JWT header pointed to a different JWK. The code below finds the JWK for the KID specified in the header and verifies against that.
*/
@dsandor
dsandor / template.yaml
Last active March 19, 2023 14:22
CloudFormation Template Example - Subscribe a Lambda to an SNS Topic
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
example-lambda-sns
Example CloudFormation template to subscribe a lambda to an SNS Topic.
Resources:
ExampleTopic:
Type: AWS::SNS::Topic
Properties: