Repository navigation
feat: propagate sasl.jaas.config and sasl.login.callback.handler.class from auth secret for OAUTHBEARER - #4789
Conversation
|
Welcome @dmetzler! It looks like this is your first PR to knative-extensions/eventing-kafka-broker 🎉 |
|
Hi @dmetzler. Thanks for your PR. I'm waiting for a knative-extensions member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
dede445 to
3b25f7c
Compare
3b25f7c to
2f79c36
Compare
|
/ok-to-test |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4789 +/- ##
============================================
+ Coverage 29.19% 36.49% +7.30%
- Complexity 0 919 +919
============================================
Files 294 406 +112
Lines 16241 20154 +3913
Branches 0 352 +352
============================================
+ Hits 4741 7355 +2614
- Misses 11036 12141 +1105
- Partials 464 658 +194
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/test channel-integration-tests-ssl |
|
@dmetzler mind filling out the CLA? |
I already did a couple of times with my 2 different Github bound adresses.... but it doesn't seem to update the status |
…BEARER When sasl.mechanism=OAUTHBEARER, the data plane now propagates sasl.jaas.config and sasl.login.callback.handler.class from the auth secret to the Kafka client properties, enabling vendor-neutral OAUTHBEARER authentication (Azure Event Hubs via Managed Identity, Keycloak, Confluent OIDC, etc.). When neither key is present, behaviour is unchanged — preserving the existing AWS MSK IAM path which relies on its own classpath-provided login module. No new runtime dependencies. No vendor-specific code. Signed-off-by: Damien Metzler <dmetzler@gmail.com>
…pers Adds unit tests for the previously uncovered patch lines flagged by Codecov: - KubernetesCredentials SASLJaasConfig/SASLLoginCallbackHandlerClass (decode, absent, null secret, null data) - Credentials default methods returning null via a minimal implementation - Go HasTokenProvider (common.go) and UnsupportedTokenProvider/errorTokenProvider (token_provider.go)
65c6719 to
d20e5d8
Compare
|
/test reconciler-tests_eventing-kafka-broker_main |
1 similar comment
|
/test reconciler-tests_eventing-kafka-broker_main |
|
LGTM Waiting on a maintainer approval |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr, dmetzler The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #4759
Summary
When
sasl.mechanism=OAUTHBEARER,KafkaClientsAuth.javacurrently returns early without settingsasl.jaas.configorsasl.login.callback.handler.class. The Kafka client is left with the defaultOAuthBearerLoginModule, which has no way to obtain a token — so the only working OAUTHBEARER path today is AWS MSK IAM, whose IAMLoginModule is bundled on the classpath.This PR adds a vendor-neutral passthrough: when those two keys are present in the auth secret, they are propagated verbatim to the Kafka client. This unblocks standard OAUTHBEARER providers (Azure Event Hubs via Entra ID / Workload Identity, Keycloak, etc.) without adding any vendor dependency to the project. When the keys are absent, behaviour is unchanged.
Changes
Data plane (Java)
SASLJaasConfig()andSASLLoginCallbackHandlerClass()(both return null by default — no behaviour change for existing implementations).KubernetesCredentials: resolve the two new optional secret keys (sasl.jaas.config, sasl.login.callback.handler.class), base64-decoded and lazily cached.
Control plane (Go)
secret.go: tolerate OAUTHBEARER secrets without tokenProvider. The new keys are consumed by the Java data plane only; the Go side ignores them without error.Docs
New "Azure Event Hubs with Managed Identity" guide (derived data-plane image, secret format, Workload Identity setup) plus secret-based auth notes.
What this does NOT do
No vendor code or dependencies added — the callback handler jar (e.g. the Conduktor Azure handler) must be supplied by the operator on the data-plane classpath via a derived image.
The Go control plane cannot use a Java callback handler; when tokenProvider is absent it enables SASL/OAUTHBEARER without a Go-native token provider. This is acceptable — the control plane only manages configuration; the data plane handles all Kafka traffic.
Testing
Added KafkaClientsAuthTest cases covering:
both keys set → both propagated;
neither key set → identical to prior behaviour (MSK IAM regression guard);
only handler class set → only handler propagated;
handler class on a SCRAM mechanism → ignored (+ warning), normal SCRAM config intact.
Java + Go tests pass on the branch.
Backward compatibility
Fully backward compatible. The new secret keys are optional; absent them, both planes behave exactly as before (verified by the MSK IAM regression test).