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

refactor(oauth2): prepare for API key auth #14780

Merged

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Oct 10, 2024

Part of the work for #14759

Move AuthorizationHeader(...) from a standalone function into the oauth2_internal::Credentials class. This will allow us to return the x-goog-api-key: ... header in the case of API key credentials.

Also generalize the name to AuthenticationHeader, now that we are not exclusively setting the Authorization: ... header.

Note that we cannot change any public interfaces in google::cloud::storage::oauth2. These are sorta-kinda public.


This change is Reviewable

@dbolduc dbolduc marked this pull request as ready for review October 10, 2024 21:48
@dbolduc dbolduc requested review from a team as code owners October 10, 2024 21:48
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.27%. Comparing base (67b10ea) to head (088f5a8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...cloud/storage/oauth2/authorized_user_credentials.h 50.00% 1 Missing ⚠️
...cloud/storage/oauth2/service_account_credentials.h 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14780      +/-   ##
==========================================
- Coverage   93.27%   93.27%   -0.01%     
==========================================
  Files        2317     2317              
  Lines      208171   208168       -3     
==========================================
- Hits       194176   194168       -8     
- Misses      13995    14000       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 14 files reviewed, 1 unresolved discussion (waiting on @dbolduc)


google/cloud/internal/oauth2_credentials.h line 123 at r1 (raw file):

   * HTTP requests.
   */
  virtual StatusOr<std::pair<std::string, std::string>> AuthenticationHeader(

Does this need to be virtual?

@dbolduc
Copy link
Member Author

dbolduc commented Oct 11, 2024

Does this need to be virtual?

I plan to override it in a new oauth2_internal::ApiKeyCredentials class

Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 14 of 14 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dbolduc)

@dbolduc dbolduc merged commit b6e899a into googleapis:main Oct 11, 2024
74 of 75 checks passed
@dbolduc dbolduc deleted the refactor-oauth2-auth-header-prepare branch October 11, 2024 18:23
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.

2 participants