-
Notifications
You must be signed in to change notification settings - Fork 56
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
Accept access token from Authorization
header
#1720
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.
Some initial comments. Mostly waiting for another PR to be merged, to avoid excessive conflicts.
parse( | ||
MakePostRequest("/", URLENCODED, "update=DELETE+%2A+WHERE%20%7B%7D")), | ||
ParsedRequestIs("/", std::nullopt, {}, Update{"DELETE * WHERE {}"})); | ||
// TODO<qup42>: there could be some more here, but i'll wait until #1668 |
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.
TODO
auto parsedUrl = parseRequestTarget(request.target()); | ||
return Server::extractAccessToken(request, parsedUrl.parameters_); | ||
}; | ||
// TODO<qup42>: replace once #1668 is merged |
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.
TODO
throw std::runtime_error(absl::StrCat( | ||
"Authorization header must start with \"Bearer \". Got: \"", | ||
authorization, "\".")); |
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 dislike responding with the access token, but did it to stay consistent with the rest of the code. Sensitive data should imo not be echoed.
Conformance check passed ✅No test result changes. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1720 +/- ##
=======================================
Coverage 89.86% 89.86%
=======================================
Files 389 389
Lines 37308 37334 +26
Branches 4204 4207 +3
=======================================
+ Hits 33527 33552 +25
+ Misses 2485 2483 -2
- Partials 1296 1299 +3 ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
Note: The suggestions is to use a raw string literal for a string with 3 |
The access token could previously only be passed as a parameter (field in the data for
application/x-www-form-urlencoded
and query parameter otherwise). With this PR the access token is also read from the Authorization header in the formatBearer <access token>
. TheAuthorization
header (if present) takes precedence over the parameter.Resolves #1691