Draft
Conversation
Allow rpk to authenticate with Kafka brokers using the OAUTHBEARER SASL mechanism. This enables OIDC-based authentication workflows where users pass an OAuth token via --sasl-password (with optional "token:" prefix). The token is used as an OAuth bearer token for Kafka connections, admin API requests, and schema registry access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
Test the oauthBearerToken helper (token: prefix stripping, raw tokens, empty inputs) and GetAuth with OAUTHBEARER profiles (bearer token construction, case-insensitivity, error paths). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
david-yu
added a commit
to david-yu/redpanda-operator-mtls-oidc-listeners
that referenced
this pull request
Apr 15, 2026
Key finding: sasl_mechanisms_overrides works through the CRD bootstrap
config passthrough when using the correct Redpanda list-of-objects format:
- listener: oidc
sasl_mechanisms:
- OAUTHBEARER
The previous map format ({oidc: [OAUTHBEARER]}) was the wrong format
for this Redpanda property. No chart/operator code change needed.
Updated:
- manifests/redpanda-cr.yaml: correct list-of-objects format, removed
the "must set post-deploy via rpk" comment
- README: CRD listener config snippets, rpk OAUTHBEARER tracking PR
(redpanda-data/redpanda#30169), corrected test results showing
overrides work via CRD, removed workaround instructions
- scripts/oidc-test-pod.yaml: cleaned up test script
Validated end-to-end on Kind:
- sasl_mechanisms_overrides correctly applied via CRD bootstrap config
- OIDC token acquisition from Dex: PASS
- SASL/OAUTHBEARER authentication: PASS
- mTLS create/produce/consume: PASS
twmb
reviewed
Apr 15, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The sasl.mechanism help in both -X help and -X list was missing PLAIN and OAUTHBEARER. Update to list all four supported mechanisms and document the token: password prefix for OAUTHBEARER. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test that NewFranzClient returns the correct errors for OAUTHBEARER with empty token, token:-only prefix, and unknown SASL mechanisms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
--password(supports both raw token andtoken:<TOKEN>format)-X help/-X listand profile docs to document all four SASL mechanismsRef: https://docs.redpanda.com/current/manage/security/authentication/#oidc
Ref: https://github.com/david-yu/redpanda-operator-mtls-oidc-listeners
Usage Examples
Obtain an OIDC token
Topic operations
Consumer group operations
Cluster operations
ACL operations
Using a profile (avoids repeating flags)
Test plan
Unit tests (all passing)
oauthBearerTokenhelper — token prefix stripping, raw tokens, empty inputs, case sensitivityGetAuthwith OAUTHBEARER — bearer token construction, case-insensitivity, empty token error, token:-only errorGetAuthregression — SCRAM-SHA-256 still returns BasicAuth, no-SASL still returns NopAuthNewFranzClienterror paths — OAUTHBEARER with empty token, token:-only prefix, unknown mechanismE2E tested locally on Kind + Dex OIDC provider
Tested with a local rpk build against a Kind cluster running Redpanda with Dex as the OIDC provider
(setup).
Redpanda configured with
oidc_discovery_url,oidc_token_audience,oidc_principal_mapping,and an OIDC listener with
sasl_mechanisms_overrides: [OAUTHBEARER]on NodePort 31094.rpk topic list_schemas,mtls-test)rpk topic create oidc-rpk-testrpk topic produce oidc-rpk-testrpk topic consume oidc-rpk-test --num 1rpk topic describe oidc-rpk-testrpk group listrpk cluster inforpk topic delete oidc-rpk-testtoken:prefix)token:prefix🤖 Generated with Claude Code