-
Notifications
You must be signed in to change notification settings - Fork 476
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
Added FromCustomAuthorizerAttribute and tests. #1466
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool PR!
Can you fix the whitespaces changes to the LambdaFunctionTemplate.tt
file? The whole file is looks different.
Who should we handle the other type of authorizer properties. For example on the APIGatewayHttpApiV2ProxyRequest
besides the Lambda
property there is also Jwt
and IAM
properties. Should we make the string accessing the authorizer field have the prefix of the property.
Wiil do my best with the withspace. |
don't seem to be able to fix the whitespace issue to save my life :( Tried setting EOL to LF and CR, both cause problems with the generated file. The correct one seems to be CRLF . Please feel free to edit. |
Would be really nice to get this avail;able. I will gladly fix the conflicts if this can be looked at again. |
I can see you did a major refactoring in the dev branch will push again once released. If i might be so bold, I looked at what you did. Just a thought. |
@kabaluk I suspect adding new attributes would be done in separate files. For example if we added SQS or S3 I would put them in separate TT. One of my goals with the refactor was to make it easier to add new attributes as the previous monolithic tt file was really hard to reconcile with. Another goal I had was I wanted to generate the exact same code including whitespaces to make the PR review easier and then later I could do more specific refactoring. Otherwise the PR review would have been every line is different and that is hard to review. But going forward I could see putting each of the |
I was talking specifically of the FromXXX attributes. Apologies, I should have been more explicit. Sounds like a great change and it would make it a lot easier to add and test more FromXXX attributes. Looking forward to have that in main so i can re add the FromCustomAuthorizer attribute. |
…les per section being generated.
Readded CustomAuthorizerAttribute.. Hope you like it :) |
Any possibility of having this looked at again, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did an initial scan and it looks good. I had one comment so far. I need to test the experience end to end next. I'll try and find time to do that soon.
var <#= parameter.Name #> = default(<#= parameter.Type.FullName #>); | ||
if (__request__.RequestContext?.Authorizer == null) | ||
{ | ||
validationErrors.Add("Could not find Authorizer data for request"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if there is missing data from the authorizer if we should be returning back 401
unauthorized instead of a bad parameter status code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It should return 401.
I am away from pc for 2 weeks, feel free to change or i will once back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to have a look at Norm's comments?
Description of changes:
Added FromCustomAuthorizerAttribute and tests.
This will allow to retrieve values from CustomAuthorizer context without having to receive the full APIGatewayProxyRequest or APIGatewayHttpApiV2ProxyRequest..
Both REST and HttpApi supported
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.