-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Feature/issue 1475 #1500
Feature/issue 1475 #1500
Conversation
thank you @vidueirof ! could you add your tests to the tests of this project? let me know if you have any questions or need any pointers. |
@dnalborczyk I added some tests, let me know what you think. Thanks |
authorizer: | ||
type: request | ||
functionName: authorizer | ||
enableSimpleResponses: true |
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 don't see enableSimpleResponses
anywhere in the current code being used nor in your PR. the tests pass with or without this property being set. is that intentional? I must admit I currently don't know much about the topic.
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.
Yes, that's right. I'm checking if the response is in simple response format.
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.
what I mean is that I don't see any usage of enableSimpleResponses
, e.g. in a condition anywhere in your code.
also your tests pass as well if I comment out enableSimpleResponses: true
authorizer:
type: request
functionName: authorizer
# enableSimpleResponses: true
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.
Yes, I understand your point. I'm not using it because I'm checking if the response is in simple response format without caring enableSimpleResponses flag. That's why if you set to false but your response is in simple format test will pass. I don't think we need to force to use enableSimpleResponses to true, just using a valid format is enough. But if you think is better to check enableSimpleResponses try to do it (no idea how :p but I'll work it out).
thanks for adding the tests @vidueirof just added one question, otherwise looks good. could you also merge (or rebase) with master? should be just an import fix as far as I can tell: |
d5ea86d
to
22fd667
Compare
fdd1699
to
51a30e9
Compare
Hi @dnalborczyk @vidueirof . I've implemented this on #1600, where we accept payloadFormat 1.0, 2.0 and 2.0 + simpleResponses. There are also some checks done where enableSimpleResponses HAS to be used along with payloadFormat 2.0, as well as a set of tests with httpApi with payloadFormat 1.0, 2.0 and simple responses. Please feel free to take a look at it and see if that PR fixes the needs of this PR. |
@vidueirof could you have a look at v11.3.0 if that covers your PR? thank you again for putting in the work! much appreciated! closing in the meantime for good housekeeping. |
Yes, it's looks fine. I'm sorry I couldn't fix this PR on time. |
No worries man, I was also looking for support for PayloadFormat 2.0. Glad I could help out. |
Description
Support simple lambda authorizer response by checking if function result has
isAuthorized
flag and prevent running policy document validations.Motivation and Context
To add support for simple response in authorizer function result.
Fixes: #1475 and #1341
How Has This Been Tested?
Simple lambda authorizer.
authorizer.js
serverless.yml
Using correct and wrong token