Skip to content

Commit 846d8f5

Browse files
david-yuclaudeFeediver1coderabbitai[bot]kbatuigas
authored
Add docs for rpk OIDC (OAUTHBEARER) client authentication (#1696)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Joyce Fee <102751339+Feediver1@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Kat Batuigas <36839689+kbatuigas@users.noreply.github.com>
1 parent 6671daa commit 846d8f5

3 files changed

Lines changed: 64 additions & 2 deletions

File tree

modules/get-started/pages/release-notes/redpanda.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ xref:manage:schema-reg/schema-reg-overview.adoc#metadata-properties[Schema Regis
8989

9090
You can set metadata when registering a schema using the `POST /subjects/{subject}/versions` endpoint or with the xref:reference:rpk/rpk-registry/rpk-registry-schema-create.adoc[`--metadata-properties`] flag in `rpk registry schema create`. Metadata is returned in `GET /subjects/{subject}/versions/{version}` and `GET /schemas/ids/{id}` responses, and viewable with `rpk registry schema get --print-metadata`. New schema versions automatically inherit metadata from the most recent version of the subject unless you register with an explicit empty `metadata` object.
9191

92+
== OIDC authentication with rpk
93+
94+
Starting in v26.1.7, `rpk` supports the `OAUTHBEARER` SASL mechanism, so you can authenticate `rpk` to the Kafka API with an OIDC access token issued by your identity provider (IdP) instead of a SASL/SCRAM username and password. Pass the token through xref:reference:rpk/rpk-x-options.adoc#sasl-mechanism[`-X sasl.mechanism=OAUTHBEARER`] and xref:reference:rpk/rpk-x-options.adoc#pass[`-X pass="token:<TOKEN>"`].
95+
96+
For end-to-end steps and prerequisites, see xref:manage:security/authentication.adoc#oidc-rpk[Connect to Redpanda with OIDC using rpk].
97+
9298
== New configuration properties
9399

94100
**Storage mode:**

modules/manage/partials/authentication.adoc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,60 @@ rpk cluster config set oidc_keys_refresh_interval 3600
11341134
----
11351135
endif::[]
11361136

1137+
[[oidc-rpk]]
1138+
===== Connect to Redpanda with OIDC using rpk
1139+
1140+
Starting with `rpk` v26.1.7 (also available in v25.3.x and v25.2.x patches), `rpk` supports the `OAUTHBEARER` SASL mechanism for Kafka API authentication. After you enable OIDC on a Kafka listener, you can authenticate `rpk` to Kafka with an OIDC access token issued by your IdP instead of a SASL/SCRAM username and password.
1141+
1142+
NOTE: Confirm your `rpk` version with `rpk version`. Earlier versions reject `-X sasl.mechanism=OAUTHBEARER` as an unknown mechanism.
1143+
1144+
Before you connect, make sure that:
1145+
1146+
* `OAUTHBEARER` is in xref:reference:properties/cluster-properties.adoc#sasl_mechanisms[`sasl_mechanisms`], or is set on the target listener through xref:reference:properties/cluster-properties.adoc#sasl_mechanisms_overrides[`sasl_mechanisms_overrides`].
1147+
* You have an access token from your IdP whose claims satisfy `oidc_token_audience`, `oidc_discovery_url`, and `oidc_principal_mapping`. For the claims that Redpanda validates, see <<oidc-credentials-flow-and-access-token-validation, OIDC credentials flow and access token validation>>.
1148+
* xref:manage:security/authorization/index.adoc#acls[ACLs] (or xref:manage:security/authorization/gbac.adoc[GBAC]) grant the principal extracted from the token the operations you intend to run.
1149+
1150+
[[oidc-rpk-token]]
1151+
Pass the token using xref:reference:rpk/rpk-x-options.adoc[`-X` options]. Set `sasl.mechanism=OAUTHBEARER` and supply the token through `pass`, either as a raw value or in `token:<TOKEN>` form:
1152+
1153+
[,bash]
1154+
----
1155+
export OIDC_TOKEN="<access-token>"
1156+
1157+
rpk topic list \
1158+
-X brokers=<broker-host>:<oidc-listener-port> \
1159+
-X tls.enabled=true \
1160+
-X tls.ca=<path-to-ca-cert> \
1161+
-X sasl.mechanism=OAUTHBEARER \
1162+
-X pass="token:$OIDC_TOKEN"
1163+
----
1164+
1165+
The same `-X sasl.mechanism` and `-X pass` options work for any `rpk` command that talks to the Kafka API (for example, `rpk topic create`, `rpk topic produce`, `rpk topic consume`, `rpk group list`, `rpk cluster info`, and `rpk security acl list`).
1166+
1167+
To avoid repeating connection flags, store them in an xref:reference:rpk/rpk-profile/rpk-profile-create.adoc[`rpk profile`]:
1168+
1169+
[,bash]
1170+
----
1171+
rpk profile create oidc \
1172+
--set kafka_api.brokers=<broker-host>:<oidc-listener-port> \
1173+
--set kafka_api.tls.ca_file=<path-to-ca-cert> \
1174+
--set kafka_api.sasl.mechanism=OAUTHBEARER \
1175+
--set kafka_api.sasl.password="token:$OIDC_TOKEN"
1176+
1177+
rpk topic list
1178+
----
1179+
1180+
If `rpk` returns `OAUTHBEARER requires a token`, the password is empty or contains only the `token:` prefix with no value.
1181+
1182+
If the broker rejects the token, verify that:
1183+
1184+
* The `aud` claim matches `oidc_token_audience`
1185+
* The `iss` claim matches the issuer at `oidc_discovery_url`
1186+
* `exp` is in the future within `oidc_clock_skew_tolerance`
1187+
* The signature is valid against the JWK set published at the discovery URL
1188+
1189+
See <<oidc-credentials-flow-and-access-token-validation, OIDC credentials flow and access token validation>> for the full list of validated claims.
1190+
11371191
ifndef::env-kubernetes[]
11381192
[[kerberos]]
11391193
==== GSSAPI (Kerberos)

modules/reference/pages/rpk/rpk-x-options.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,15 @@ The SASL mechanism to use for authentication.
238238

239239
*Default*: ""
240240

241-
*Acceptable values*: `SCRAM-SHA-256`, `SCRAM-SHA-512`, `PLAIN`
241+
*Acceptable values*: `SCRAM-SHA-256`, `SCRAM-SHA-512`, `PLAIN`, `OAUTHBEARER`
242242

243243
NOTE: With Redpanda, the Admin API can be configured to require basic authentication with your Kafka API SASL credentials. This defaults to `SCRAM-SHA-256` if no mechanism is specified.
244244

245+
For `OAUTHBEARER`, set `pass` to an OIDC access token (raw value, or prefixed with `token:`) instead of a SASL password, and leave `user` unset. Support for `OAUTHBEARER` was added in rpk v26.1.7 (also backported to v25.3.x and v25.2.x). For end-to-end steps, see xref:manage:security/authentication.adoc#oidc-rpk[Connect to Redpanda with OIDC using rpk].
246+
245247
*Example*: `sasl.mechanism=SCRAM-SHA-256`
246248

247-
*Usage*:
249+
*Usage*:
248250
```
249251
rpk topic list -X sasl.mechanism=<mechanism>
250252
```

0 commit comments

Comments
 (0)