fix(kafka-connect): call .get() on basicAuth Supplier fields in KafkaConnectApiFactory#760
Merged
fhussonnois merged 2 commits intostreamthoughts:mainfrom Apr 15, 2026
Conversation
…ConnectApiFactory `KafkaConnectClientConfig.basicAuthUser()` and `basicAuthPassword()` return `Supplier<String>`, not `String`. Concatenating them without `.get()` embeds the lambda `toString()` into the Authorization header, producing an invalid Basic token and HTTP 401 on every request. Adds `KafkaConnectApiFactoryTest` that verifies the header encodes the actual credentials. Fixes streamthoughts#758. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…FactoryTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tasks
Member
|
Look good to me! Thank you very much for this contribution. |
fhussonnois
approved these changes
Apr 15, 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.
Summary
KafkaConnectClientConfig.basicAuthUser()andbasicAuthPassword()returnSupplier<String>— the record accessor returns the supplier object, not the resolved string. Concatenating them without.get()embeds the lambdatoString()into theAuthorizationheader:Decoded, that's something like:
The Connect REST API rejects this with
HTTP 401 Unauthorized.Fix: call
.get()on both suppliers ingetAuthorizationHeader().This is the same class of bug fixed for the Schema Registry provider in 0b5c775.
Changes
KafkaConnectApiFactory.java: add.get()onconfig.basicAuthUser()andconfig.basicAuthPassword()KafkaConnectApiFactoryTest.java: new test that starts aMockWebServer, makes a real HTTP request, and asserts theAuthorizationheader encodes the actual credentialspom.xml: addmockwebservertest dependency (same pattern asjikkou-provider-schema-registry)Test plan
KafkaConnectApiFactoryTest#shouldBuildBasicAuthHeaderFromActualCredentialspasses with the fixtoString()rather thanalice:secretFixes #758.
🤖 Generated with Claude Code