-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add credentials for bearer token authentication #60048
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@brianquinlan – thoughts? |
@richirisu We can't look at the code before CLA is signed - could you sign it? |
Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at: https://dart-review.googlesource.com/c/sdk/+/408241 Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly. Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR). |
CLA was signed; https://dart-review.googlesource.com/c/sdk/+/408241 has been assigned to Brian |
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
1 similar comment
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
1 similar comment
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
1 similar comment
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
1 similar comment
https://dart-review.googlesource.com/c/sdk/+/408241 has been updated with the latest commits from this pull request. |
I recently needed bearer authentication for a proxy, however, the current HTTP implementation only offered credentials for basic and digest authentication.
It applies to the Authorization and Proxy-Authorization headers.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes
Implementation Details
The token provided to the HttpClientBearerCredentials is checked for valid characters according to RFC 6750.
It is possible to provide any string as token by applying base64Encode in conjunction with utf8.encode first. I was considering making a factory method that automates this, but then I felt it would just complicate things, as bearer tokens are most often randomly generated anyway.
Tests
Sorry, but I didn't provide any tests here.