Support HTTP Basic auth for OpenAPI tools#5535
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. |
|
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
|
Hi @Oppong08 , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix mypy-diff errors. |
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.