Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Adding form_post support #509
feat: Adding form_post support #509
Changes from 5 commits
27ea33c
54a9d50
d359581
ec3e000
0ebd04d
f6dea63
ded62be
c3c5ea7
e92ec55
56234b4
10b2f25
d7c0743
b8db770
9ee157e
9ed9df8
8676b8b
eee5473
69b2208
4b29d15
fefcdeb
a8be9f2
da08c73
3e6a1bd
6b741ef
b812014
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Just for completeness (Because other encoding methods like query and fragment supports that), can you loop here over the value (which is a slice) and repeat
<input
with samekey
multiple times? This should never happen. But you never know if somebody directly modifiesParameters
to add that (given that you defined it asurl.Values
which allows repeated values for same field).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.
Also, HTML-escape key and value here.
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.
And add test for that.
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.
html/template
escapes all variables unless told otherwise.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.
Now the template supports adding multiple values. Also added test case for illegal character encoding.
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 think the error should at least be logged somehow. Maybe return it and log it in the caller?
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.
The caller of this method is WriteAuthorizeError and WriteAuthorizeResponse. None of them return an error or have log. Any idea how this error can be handled? Maybe panicking from here?
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.
This validation function should also respect security considerations from here:
Also see description of combinations.
Based on that it is not really true that all combinations are possible. For example, if default uses fragment, then query cannot be used. Moreover, for errors, it seems that you can use always whichever the client requested.
So this is really that if by default query string is used, you can request that fragment is used. But not the opposite.
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.
Given that for error any mode can be used, then maybe checking for valid combinations cannot be done here but in write handler?
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.
Nice catch @mitar - so we should check for
response_type
andresponse_mode
to define the output. It is also true that for errors, this check has to be disabled. But I also think that this has to be handled in the writer, because we first need to execute the "adapters" to figure out the default response mode and only then should we make assumptions about the default state.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.
Added the check for using
query
while the default mode isfragment
and returns an error in theautheorize_response_writer.go
.