[chore][extension/basicauth] Extract shared basic auth logic into internal package#48414
Open
lazureykis wants to merge 4 commits into
Open
Conversation
…ackage Move reusable basic auth primitives (header parsing, credential validation, HTTP RoundTripper, gRPC PerRPCCredentials) into extension/internal/basicauth so that other extensions needing basic auth can share them without duplicating code. Assisted-by: Claude Opus 4.6
Remove AuthDataUsername(), AuthDataPassword(), and EncodeGRPCMetadata() which had no production callers. Keep the API surface minimal. Assisted-by: Claude Opus 4.5
frzifus
reviewed
May 15, 2026
Member
frzifus
left a comment
There was a problem hiding this comment.
thanks @lazureykis ! Looks already quite good to me. Let me complete the review tomorrow morning!
Comment on lines
+25
to
+29
| // CredentialProvider supplies username and password for client-side basic auth. | ||
| type CredentialProvider interface { | ||
| Username() string | ||
| Password() string | ||
| } |
Member
There was a problem hiding this comment.
Would that be sufficient for all kinds of vaults?
Contributor
Author
There was a problem hiding this comment.
I think so. It's basic auth, no matter where data comes from, we only need username + password.
Member
There was a problem hiding this comment.
I was thinking we could even align that and reuse some logic from the bearer token authentication.
axw
approved these changes
May 17, 2026
frzifus
approved these changes
May 18, 2026
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.
Description
Extracts the core basic auth primitives from
basicauthextensioninto a newextension/internal/basicauthpackage so they can be reused by a standalone AWS Secrets Manager auth extension (see #48277, #48406) without duplicating logic or pulling the AWS SDK into basicauthextension.The new internal package provides:
Authenticate()— server-side header extraction, parsing, and credential validationCredentialProviderinterface — abstraction for username/password sourcingNewRoundTripper()— HTTP transport with basic auth injectionNewPerRPCCredentials()— gRPC per-RPC credentials with basic authThe existing
basicauthextensionis updated to delegate to the internal package. No user-facing behavior changes.Link to tracking issue
Related to #48277
Testing
extension/internal/basicauth/basicauth_test.gocovering header extraction, parsing, authentication, round-tripper, and per-RPC credentialsbasicauthextensiontests pass unchangedDocumentation
No user-facing changes — internal refactoring only.