-
Notifications
You must be signed in to change notification settings - Fork 57
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1720 +/- ##
==========================================
+ Coverage 89.90% 89.91% +0.01%
==========================================
Files 393 393
Lines 37479 37512 +33
Branches 4221 4227 +6
==========================================
+ Hits 33694 33730 +36
+ Misses 2482 2480 -2
+ Partials 1303 1302 -1 ☔ View full report in Codecov by Sentry. |
Note: The suggestions is to use a raw string literal for a string with 3 |
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.
A first round of reviews.
Conformance check passed ✅No test result changes. |
Quality Gate passedIssues Measures |
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 two very minor suggestions.
tokenFromAuthorizationHeader != tokenFromParameter) { | ||
throw std::runtime_error( | ||
"Access token is specified both in the `Authorization` Header and the " | ||
"parameters, but they aren't the same."); |
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 first part is gread, maybe make the second part "and the access-token
parameter, then really everybody knows how to fix this.
@@ -1128,8 +1140,7 @@ bool Server::checkAccessToken( | |||
if (!accessToken) { | |||
return false; | |||
} | |||
auto accessTokenProvidedMsg = absl::StrCat( | |||
"Access token \"access-token=", accessToken.value(), "\" provided"); | |||
auto accessTokenProvidedMsg = absl::StrCat("Access token was provided"); |
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 StrCat
is absolutely redundant and should be removedd.
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