Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

richirisu
Copy link

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.

Copy link

google-cla bot commented Feb 4, 2025

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.

@kevmoo
Copy link
Member

kevmoo commented Feb 5, 2025

@brianquinlan – thoughts?

@mraleph
Copy link
Member

mraleph commented Feb 6, 2025

@richirisu We can't look at the code before CLA is signed - could you sign it?

Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants