[v25.3.x] rpk: add OAUTHBEARER SASL mechanism support#30312
Conversation
Add OAUTHBEARER as a supported SASL mechanism in rpk, alongside the existing SCRAM-SHA-256 and SCRAM-SHA-512 mechanisms. - toSASLConfig and NewFranzClient now dispatch on OAUTHBEARER to set up kgo.SASL with the bearer token from the profile's sasl.password - toRpadminOptions similarly calls WithOAuthBearerAuthentication for the admin client - OAUTHBEARER is rejected early in remote debug bundle (follow-up issue referenced in the guard comment) - Update -X help text and profile docs to list all SASL mechanisms including PLAIN and OAUTHBEARER - Add unit tests for the SASL dispatch paths in adminapi, franz client, and schema registry client; fix $HOME-unset failures in those tests - Regenerate BUILD files for new test files (cherry picked from commits in PR #30169)
b461250 to
b4e4d78
Compare
Retry command for Build#83730please wait until all jobs are finished before running the slash command |
CI test resultstest results on build#83730
|
r-vasquez
left a comment
There was a problem hiding this comment.
All looks the same with the original branch except the profile_doc file which doesn't exists in this branch 👍
End-to-end test resultsTested the Environment
Method
ResultsmTLS listener (
|
| Operation | Status |
|---|---|
rpk topic list |
PASS |
rpk topic create mtls-test |
PASS |
rpk topic produce mtls-test |
PASS (offset 0) |
rpk topic consume mtls-test --num 1 |
PASS — round-trip OK |
OIDC listener (localhost:31094, SASL/OAUTHBEARER)
Invocation:
rpk topic <op> --brokers localhost:31094 \
-X tls.enabled=true -X tls.insecure_skip_verify=true -X tls.ca=certs/ca.crt \
-X sasl.mechanism=OAUTHBEARER -X user= -X "pass=token:${OIDC_TOKEN}"
| Operation | Status |
|---|---|
rpk topic list |
PASS — returns _schemas, mtls-test, oidc-test |
rpk topic create oidc-test |
PASS |
rpk topic produce oidc-test |
PASS (offset 0) |
rpk topic consume oidc-test --num 1 |
PASS — round-trip OK |
Negative / variant cases
| Case | Result |
|---|---|
OIDC listener + --sasl-mechanism SCRAM-SHA-256 |
UNSUPPORTED_SASL_MECHANISM: The broker does not support the requested SASL mechanism. ✅ (sasl_mechanisms_overrides fence holds) |
OIDC listener + invalid token (pass=token:not-a-real-jwt) |
SASL_AUTHENTICATION_FAILED: … security: Invalid credentials ✅ |
OIDC listener + raw-token form (no token: prefix) |
PASS ✅ — both pass=<jwt> and pass=token:<jwt> accepted, matching the updated params.go doc |
rpk topic list -X help reflects the new mechanism
sasl.mechanism=SCRAM-SHA-256
The SASL mechanism to use for authentication. This can be SCRAM-SHA-256,
SCRAM-SHA-512, PLAIN, or OAUTHBEARER. For OAUTHBEARER, pass the token via
the pass field (optionally prefixed with "token:"). …
Summary
OAUTHBEARER works end-to-end against a 25.3 operator + Redpanda v25.3.14 cluster. The franz-go client correctly dispatches on the OAUTHBEARER mechanism, the broker accepts the Dex JWT, the principal is extracted from the $.email claim, and per-listener sasl_mechanisms_overrides correctly rejects SCRAM on the OIDC listener. Both pass=<jwt> and pass=token:<jwt> forms are accepted. mTLS on the second listener still works alongside.
Summary
Backport of #30169 to v25.3.x.
toSASLConfigandNewFranzClientdispatch on OAUTHBEARER to set up bearer token authtoRpadminOptionscallsWithOAuthBearerAuthenticationfor the admin client-X helptext and profile docs to list all four SASL mechanismsConflicts resolved from original backport
profile_doc.go: deleted — file does not exist in v25.3.x; equivalentparams.godoc update auto-merged cleanlyschemaregistry/BUILD: droppedcontext_test.gofromgo_testsrcs (does not exist in v25.3.x)Release Notes
Features
🤖 Generated with Claude Code