Support HTTP Basic auth for OpenAPI tools#5535
Open
Oppong08 wants to merge 2 commits intogoogle:mainfrom
Open
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. |
Collaborator
|
Response from ADK Triaging Agent Hello @Oppong08, thank you for creating this PR! It looks like you haven't signed the Contributor License Agreement (CLA) yet. Please visit https://cla.developers.google.com/ to sign it. Once the CLA is signed, the reviewers will be able to proceed with reviewing your PR. Thanks! |
a8fade8 to
3e8a603
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
N/A
Problem:
OpenAPI tools currently do not support HTTP Basic authentication. When an OpenAPI auth credential contains HTTP username/password credentials, ADK raises
NotImplementedError("Basic Authentication is not supported.")instead of generating a standard Basic authAuthorizationheader.Solution:
Add HTTP Basic auth support in
credential_to_paramby mirroring the existing bearer-token handling pattern. When HTTP credentials contain a username and/or password, the helper now encodesusername:passwordwith base64 and returns an internalAuthorizationheader in the formatBasic <base64(username:password)>. This keeps the change small, localized, and consistent with the current auth helper design.Testing Plan
Unit Tests:
Passed locally:
pytest tests/unittests/tools/openapi_tool/auth/test_auth_helper.pyManual End-to-End (E2E) Tests:
Manual verification performed by exercising the auth helper path locally and confirming that HTTP Basic auth credentials now produce an internal
Authorizationheader parameter and kwargs instead of raisingNotImplementedError.Relevant behavior verified:
Authorization: Basic <base64(username:password)>Additional commands run:
pre-commit run --all-filesChecklist
Additional context
This change is intentionally minimal:
base64importsrc/google/adk/tools/openapi_tool/auth/auth_helpers.pytests/unittests/tools/openapi_tool/auth/test_auth_helper.pyThe implementation preserves existing behavior for non-Basic auth paths.
Add any other context or screenshots about the feature request here.