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

(api-gateway): StepFunctionsIntegration doesnt pass Cognito claims with authorizer:true #30144

Closed
gmborisov opened this issue May 10, 2024 · 2 comments
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@gmborisov
Copy link

gmborisov commented May 10, 2024

Current StepfunctionIntegreation vtl script for integration request mapping doesnt support Cognito claims in authorization context.
#if ($includeAuthorizer) #set($inputString = "$inputString, @@authorizer@@:{") #foreach($paramName in $context.authorizer.keySet()) #set($inputString = "$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.get($paramName))@@") #if($foreach.hasNext) #set($inputString = "$inputString,") #end #end #set($inputString = "$inputString }") #end

If I specify just the 'claims' in the forloop, then I will get all details:
#if ($includeAuthorizer) #set($inputString = "$inputString, @@authorizer@@:{") #foreach($paramName in $context.authorizer.claims.keySet()) #set($inputString = "$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.claims.get($paramName))@@") #if($foreach.hasNext) #set($inputString = "$inputString,") #end #end #set($inputString = "$inputString }") #end

Expected Behavior

Stepfunction input contains all Cognito claims inside 'authorizer' object
image

Current Behavior

The authorizer.claims object is empty:
image

Reproduction Steps

  1. Create Cognito user pool
  2. Create RestApi with StepFunctionsIntegration for a resource method
  3. Specify authorizerType = Cognito and provide a link to the created pool
  4. specify authorizer: true

Possible Solution

iterate over claims separately.

Additional Information/Context

No response

CDK CLI Version

2.102.0 (build 2abc59a)

Framework Version

No response

Node.js Version

20.5.1

OS

Windows 11 Pro

Language

TypeScript

Language Version

No response

Other information

No response

@gmborisov gmborisov added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 10, 2024
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label May 10, 2024
@ashishdhingra
Copy link
Contributor

@gmborisov Good morning. Thanks for opening the issue. Could you please elaborate the issue by providing the minimal reproducible CDK code, which confirms that this is the issue with CDK?

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 13, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants