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

feat(apigatewayv2): http api - jwt and cognito user pool authorizers #10972

Merged
merged 60 commits into from
Feb 10, 2021
Merged

feat(apigatewayv2): http api - jwt and cognito user pool authorizers #10972

merged 60 commits into from
Feb 10, 2021

Conversation

iRoachie
Copy link
Contributor

@iRoachie iRoachie commented Oct 20, 2020

Part 1 of the work needed to make #10534 happen.

  • Also not sure if a partial L2 is possible as I didn't implement all the properties.
  • Also not sure if I should rename it to just Authorizer (wasn't sure if it clashed with v1 authorizers)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Part 1 of the work needed to make #10534 happen.
@gitpod-io
Copy link

gitpod-io bot commented Oct 20, 2020

@iRoachie
Copy link
Contributor Author

@shivlaks Can you take a look at this?

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR! Please find my first round of comments below -

Also not sure if a partial L2 is possible as I didn't implement all the properties.

It's not necessary to implement all properties. We're ok with taking in PRs that don't implement all functionality.

However, it should be possible to set a very minimal authorizer up. It seems in your case, customers won't be able to set the authorizer up since they can't yet connect the authorizer to the route. This is necessary in this PR.

Also not sure if I should rename it to just Authorizer (wasn't sure if it clashed with v1 authorizers)

They're in separate modules. No collision.

packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts Outdated Show resolved Hide resolved
@nija-at nija-at changed the title feat(apigatewayv2): Authorizer L2 Support feat(apigatewayv2): http api - jwt authorizer Oct 21, 2020
@mergify mergify bot dismissed nija-at’s stale review October 21, 2020 14:09

Pull request has been modified.

@iRoachie
Copy link
Contributor Author

iRoachie commented Oct 21, 2020

@nija-at authorizerType is needed by CfnRouteProps. What's the best way to make this available?

I was thinking to expose authorizerType on IAuthorizer, but unsure how to change my Import class in fromAuthorizerId to accommodate this. Would I have to use fromAattributes here instead?

@ayush987goyal
Copy link
Contributor

@iRoachie Thanks for this! Will it be possible for you to add an integration test for this?

@iRoachie
Copy link
Contributor Author

iRoachie commented Oct 21, 2020

Just for reference, this is PR has in more changes now

  • Adds L2 support for CfnAuthorizer
  • Allows adding authorizer, authorizationScopes to Route
  • Allows adding authorizer, authorizationScopes to Route through HttpApi.addRoutes

@iRoachie
Copy link
Contributor Author

@ayush987goyal Sureeeee as soon as I find out how to do so

@iRoachie
Copy link
Contributor Author

How would I go about doing this? First time having to do an integration test

@ayush987goyal
Copy link
Contributor

You can take a look to the v1 authorizer integration test here. Also read the contribution guide around integration tests.

@nija-at
Copy link
Contributor

nija-at commented Oct 21, 2020

@nija-at authorizerType is needed by CfnRouteProps. What's the best way to make this available?

You can define this within each type of authorizer and access it within the HttpRoute class. The Authorizer will be passed a property to HttpRouteProps.

@iRoachie
Copy link
Contributor Author

@ayush987goyal I made and ran the integration test. Let me know if I need to change anything

@iRoachie
Copy link
Contributor Author

@nija-at Lemme know if everything is good after regarding your review

@iRoachie
Copy link
Contributor Author

Okay outside of tests and docs, let me know if there's anything in the implementation that needs changing.

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Thanks for picking this back up. Took a quick scan through the code.

yarn.lock Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2-authorizers/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
Remove fromHttpJwtAuthorizerId from HttpJwtAuthorizer and implement on the base HttpAuthorizer class
@mergify mergify bot dismissed nija-at’s stale review February 5, 2021 06:18

Pull request has been modified.

@iRoachie
Copy link
Contributor Author

iRoachie commented Feb 5, 2021

@nija-at changes made

nija-at
nija-at previously requested changes Feb 9, 2021
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

@iRoachie - the build is failing. can you take a look?

Besides that, just small updates to the README. Otherwise, looks good.

@nija-at nija-at changed the title feat(apigatewayv2): http api - jwt authorizer feat(apigatewayv2): http api - jwt and cognito user pool authorizers Feb 9, 2021
@github-actions github-actions bot added the @aws-cdk/aws-apigatewayv2 Related to Amazon API Gateway v2 label Feb 9, 2021
Co-authored-by: Niranjan Jayakar <nija@amazon.com>
@mergify mergify bot dismissed nija-at’s stale review February 10, 2021 00:33

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 9a46843
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@iRoachie
Copy link
Contributor Author

iRoachie commented Feb 10, 2021

Finally green 😅 needed to add the Authorizer package to monocdk, decdk and aws-cdk-lib.

@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit dd90e54 into aws:master Feb 10, 2021
@iRoachie iRoachie deleted the authorizer branch February 10, 2021 13:21
NovakGu pushed a commit to NovakGu/aws-cdk that referenced this pull request Feb 18, 2021
…ws#10972)

Part 1 of the work needed to make aws#10534 happen.

- Also not sure if a partial L2 is possible as I didn't implement all the properties.
- Also not sure if I should rename it to just `Authorizer` (wasn't sure if it clashed with v1 authorizers)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigatewayv2 Related to Amazon API Gateway v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants