Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding jwt cognito pattern for websocket api using lambda authorizer #2384

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

srajaw
Copy link
Contributor

@srajaw srajaw commented Jul 15, 2024

Issue #, if available:

*Description of changes: So basically websocket api doesn't have JWT authorizer by default. This patterns creates a lambda authorizer which verifies the JWT token for cognito and sends a policy back to the websocket api based on valid or invalid token.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@julianwood julianwood self-assigned this Jul 15, 2024
jwt_authorizer_websocket_api_lambda_authorizer/README.md Outdated Show resolved Hide resolved
jwt_authorizer_websocket_api_lambda_authorizer/README.md Outdated Show resolved Hide resolved
jwt_authorizer_websocket_api_lambda_authorizer/README.md Outdated Show resolved Hide resolved
jwt_authorizer_websocket_api_lambda_authorizer/README.md Outdated Show resolved Hide resolved
jwt_authorizer_websocket_api_lambda_authorizer/README.md Outdated Show resolved Hide resolved
1. Note the outputs from the deployment process. It contain the full url link which can be used for testing.

## Testing
1. Get the Authorization token for your user pool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide informations on how to get the token. Cmd line or GUI click path

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use AWS SAM globals section whenever possible (e.g. Lambda Function definitions, Permission, ...)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove not needed properties to ease reading and simplify the SAM template, e.g.:

  • AWS::Serverless::Function
    • Architectures (not required, defaults to x86_64)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way to include the code that is not a zip file?
This would count for all zip files. AWS SAM CLI should zip when using sam deploy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sam only has two options, i.e., either provide s3 bucket uri or a local file, so local file has to be zipped before hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants