Skip to content

Commit 5b31558

Browse files
JakeSCahillweecomicheleRP
committed
Document kafka.sasl.oauth.tokenFilepath (#1157)
Co-authored-by: Martin Schneppenheim <23424570+weeco@users.noreply.github.com> Co-authored-by: Michele Cyran <michele@redpanda.com>
1 parent a0e90cd commit 5b31558

File tree

3 files changed

+95
-58
lines changed

3 files changed

+95
-58
lines changed

modules/console/pages/config/configure-console.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Environment variables and YAML configurations can overwrite input that is set on
1414

1515
The recommended configuration source is a YAML file. You can specify the path to the configuration file by setting either
1616
the `-config.filepath` flag or the `CONFIG_FILEPATH` environment variable.
17-
A reference configuration file is provided under <<Example Redpanda Console configuration file>>.
17+
A reference configuration file is provided under <<Complete configuration file example>>.
1818

1919
In Linux package installations, this file is located in `/etc/redpanda/redpanda-console-config.yaml` by default and Redpanda Console is configured to read from this file path.
2020

modules/console/pages/config/security/authentication.adoc

Lines changed: 93 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,10 @@ Redpanda Console supports enabling both OIDC and basic authentication simultaneo
8181

8282
=== Enable OIDC authentication
8383

84-
To configure OIDC, choose one of two modes:
85-
86-
* *Runtime acquisition mode:* Redpanda Console obtains a token from the IdP.
87-
* *Static token mode:* You provide a pre-acquired OIDC token.
84+
When you enable OIDC authentication, Redpanda Console uses an external IdP to authenticate users. This allows for single sign-on (SSO) and centralized user management.
8885

8986
Redpanda and Redpanda Console require OAuth 2.0-compliant JWT tokens for user authentication. When using OIDC, your IdP must issue JWTs. Redpanda Console uses these tokens to authenticate to Redpanda APIs through SASL/OAUTHBEARER or Bearer headers.
9087

91-
include::manage:partial$security/oidc/limitations.adoc[leveloffset=+2]
92-
93-
IMPORTANT: For any secret values, xref:console:config/configure-console.adoc[use environment variables] instead of hardcoding them in the configuration file. For example, use `AUTHENTICATION_OIDC_CLIENTSECRET` for the client secret.
94-
95-
==== Enable runtime acquisition mode
96-
9788
[,yaml]
9889
----
9990
authentication:
@@ -131,26 +122,9 @@ authentication:
131122
<11> Optional. Determines how the authorization prompt appears. Use `consent` (default) to force re-consent. Other options include `none` and `select_account`. Some IdPs require `consent` to issue a refresh token.
132123
<12> Optional. Extracts and optionally transforms a claim from the OIDC token to use as the user's identity in Redpanda Console role bindings. The default is `"$.sub"`, which uses the `sub` (subject) claim from the token. This value is then compared to the `name` field in your `authorization.roleBindings` configuration. For full syntax and transformation examples, see xref:console:config/security/authorization.adoc#_transform_identities_with_principal_mappings[Transform identities with principal mappings].
133124

134-
==== Enable static token mode
135-
136-
[,yaml]
137-
----
138-
authentication:
139-
jwtSigningKey: "<secret-key>"
140-
useSecureCookies: true
141-
oidc:
142-
enabled: true
143-
issuerUrl: "https://accounts.google.com"
144-
token: "<static-token>" # <1>
145-
issuerTls:
146-
enabled: true
147-
caFilepath: "/path/to/ca.pem"
148-
redirectUrl: "http://localhost:8080/auth/callbacks/oidc"
149-
accessType: "offline"
150-
prompt: "consent"
151-
----
125+
IMPORTANT: For any secret values, xref:console:config/configure-console.adoc[use environment variables] instead of hardcoding them in the configuration file. For example, use `AUTHENTICATION_OIDC_CLIENTSECRET` for the client secret.
152126

153-
<1> A pre-acquired OIDC token. Keep this secure. You can also use the `AUTHENTICATION_OIDC_TOKEN` environment variable.
127+
include::manage:partial$security/oidc/limitations.adoc[leveloffset=+2]
154128

155129
==== Supported identity providers
156130

@@ -239,9 +213,19 @@ Choose one method per API:
239213

240214
TIP: Redpanda Data recommends user impersonation so that access control is fine-grained and centralized within Redpanda. This way, audit logs are also more accurate, as they reflect the actual user identity.
241215

216+
[NOTE]
217+
====
218+
When using OIDC with static credentials, Redpanda Console authenticates to Redpanda as the OIDC client itself (usually a service principal). In this case, Redpanda evaluates access based on the `sub` claim in the token. Ensure you grant ACLs for your principals. For help creating ACLs, see xref:manage:security/authorization/acl.adoc[].
219+
====
220+
242221
=== Kafka API examples
243222

244-
.User impersonation
223+
This section provides examples of how to configure authentication for communicating with the Kafka API from Redpanda Console. You can choose between user impersonation or static credentials.
224+
225+
==== User impersonation
226+
227+
This option is useful when you want to use the same login credentials to authenticate Kafka API requests in Redpanda. This ensures accurate audit logs and enforces unified identity.
228+
245229
[,yaml]
246230
----
247231
kafka:
@@ -251,7 +235,10 @@ kafka:
251235
impersonateUser: true
252236
----
253237

254-
.Static credentials with SCRAM
238+
==== Static credentials with SCRAM
239+
240+
This option is useful when you want to use basic authentication. Redpanda Console uses the provided credentials for authentication.
241+
255242
[,yaml]
256243
----
257244
kafka:
@@ -270,7 +257,10 @@ authorization:
270257
name: "matt"
271258
----
272259

273-
.Static credentials with OIDC
260+
==== Static credentials with OIDC (token acquired at runtime)
261+
262+
This option is useful when you want to use OIDC. This configuration instructs Redpanda Console to fetch an OAuth 2.0 access token at runtime using the client credentials grant flow.
263+
274264
[,yaml]
275265
----
276266
kafka:
@@ -280,26 +270,60 @@ kafka:
280270
impersonateUser: false
281271
mechanism: OAUTHBEARER
282272
oauth:
283-
clientId: "<oidc-client-id>"
284-
clientSecret: "<oidc-client-secret>"
285-
tokenEndpoint: "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token"
286-
scope: "api://<oidc-client-id>/.default"
287-
authorization:
288-
roleBindings:
289-
- roleName: viewer
290-
users:
291-
- loginType: oidc
292-
name: "<sub-from-token>" # such as "ae775e64-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
273+
clientId: "<oidc-client-id>" # <1>
274+
clientSecret: "<oidc-client-secret>" # <2>
275+
tokenEndpoint: "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token" # <3>
276+
scope: "api://<oidc-client-id>/.default" # <4>
293277
----
278+
<1> Client ID registered with the identity provider (IdP).
279+
<2> Client secret associated with the client ID. Store securely using an environment variable, such as `KAFKA_SASL_OAUTH_CLIENTSECRET`.
280+
<3> OAuth 2.0 token endpoint URL provided by the IdP.
281+
<4> Requested scope to authorize access. Required by some IdPs, such as Azure Entra ID.
294282

295-
[NOTE]
296-
====
297-
When using OIDC without impersonation, Redpanda Console authenticates to Redpanda as the OIDC client itself (usually a service principal). In this case, Redpanda evaluates access based on the `sub` claim in the token. Be sure to set `oidc_principal_mapping: "$.sub"` in your Redpanda configuration and grant ACLs for that value. For detailed steps to create ACLs, see xref:manage:security/authorization/acl.adoc[]
298-
====
283+
==== Static credentials with OIDC (pre-acquired token)
284+
285+
This option is suitable when a token is issued externally and injected into the environment (for example, through CI/CD, Vault, or other automation workflows). Redpanda Console does not attempt to refresh or renew the token.
286+
287+
[,yaml]
288+
----
289+
kafka:
290+
brokers: ["broker1:9092"]
291+
sasl:
292+
enabled: true
293+
impersonateUser: false
294+
mechanism: OAUTHBEARER
295+
oauth:
296+
token: "<static-jwt-token>" # <1>
297+
----
298+
<1> A valid OAuth 2.0 JWT. Redpanda Console uses this token when authenticating to Kafka. To avoid hardcoding sensitive data, provide this value using the `KAFKA_SASL_OAUTH_TOKEN` environment variable.
299+
300+
==== Static credentials with OIDC (token from file)
301+
302+
This option is useful when running Redpanda Console in Kubernetes, where a service account token is mounted to the Pod filesystem. Redpanda Console reads this token at startup and uses it for authentication.
303+
304+
Redpanda Console does not monitor the token file for changes after startup. To ensure the token is refreshed, restart the Console periodically or implement a sidecar that triggers restarts on token rotation.
305+
306+
[,yaml]
307+
----
308+
kafka:
309+
brokers: ["broker1:9092"]
310+
sasl:
311+
enabled: true
312+
impersonateUser: false
313+
mechanism: OAUTHBEARER
314+
oauth:
315+
tokenFilepath: "/var/run/secrets/kafka/serviceaccount/token" # <1>
316+
----
317+
<1> Path to a file containing a valid OAuth 2.0 JWT token. Redpanda Console reads this file at startup and uses its contents as the access token.
299318

300319
=== Schema Registry API examples
301320

302-
.User impersonation
321+
This section provides examples of how to configure authentication for communicating with the Schema Registry API from Redpanda Console. You can choose between user impersonation or static credentials.
322+
323+
==== User impersonation
324+
325+
This option is useful when you want to use the same login credentials to authenticate API requests in the Schema Registry. This ensures accurate audit logs and enforces unified identity.
326+
303327
[,yaml]
304328
----
305329
schemaRegistry:
@@ -309,7 +333,10 @@ schemaRegistry:
309333
impersonateUser: true
310334
----
311335

312-
.Static credentials with basic auth
336+
==== Static credentials with basic auth
337+
338+
This option is useful when you want to use basic authentication. Redpanda Console uses the provided credentials for authentication.
339+
313340
[,yaml]
314341
----
315342
schemaRegistry:
@@ -328,7 +355,10 @@ authorization:
328355
name: "matt"
329356
----
330357

331-
.Static credentials with OIDC bearer token
358+
==== Static credentials with OIDC bearer token
359+
360+
This option is useful when you want to use OIDC but do not want to implement a custom token refresh mechanism. Redpanda Console uses a pre-fetched token for authentication.
361+
332362
[,yaml]
333363
----
334364
schemaRegistry:
@@ -352,7 +382,12 @@ You can supply a static bearer token here, but this token must be refreshed manu
352382

353383
=== Admin API examples
354384

355-
.User impersonation
385+
This section provides examples of how to configure authentication for communicating with the Admin API from Redpanda Console. You can choose between user impersonation or static credentials.
386+
387+
==== User impersonation
388+
389+
This option is useful when you want to use the same login credentials to authenticate API requests in the Admin API. This ensures accurate audit logs and enforces unified identity.
390+
356391
[,yaml]
357392
----
358393
redpanda:
@@ -363,7 +398,10 @@ redpanda:
363398
impersonateUser: true
364399
----
365400

366-
.Static credentials with basic auth
401+
==== Static credentials with basic auth
402+
403+
This option is useful when you want to use basic authentication. Redpanda Console uses the provided credentials for authentication.
404+
367405
[,yaml]
368406
----
369407
redpanda:
@@ -383,7 +421,10 @@ authorization:
383421
name: "matt"
384422
----
385423

386-
.Static credentials with OIDC bearer token
424+
==== Static credentials with OIDC bearer token
425+
426+
This option is useful when you want to use OIDC but do not want to implement a custom token refresh mechanism. Redpanda Console uses a pre-fetched token for authentication.
427+
387428
[,yaml]
388429
----
389430
redpanda:
@@ -401,11 +442,6 @@ authorization:
401442
name: "<sub-from-token>"
402443
----
403444

404-
[NOTE]
405-
====
406-
When impersonation is disabled, Redpanda Console executes Admin API requests as the service identity represented in the token. This is typically the `sub` from the client credentials flow, and must match an ACL or RBAC binding.
407-
====
408-
409445
== Next steps
410446

411447
- xref:console:config/security/authorization.adoc[Configure role-based access control (RBAC) in Redpanda Console]

modules/shared/attachments/redpanda-console-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ kafka:
2727
# clientId: "example-client-id"
2828
# clientSecret: "example-client-secret"
2929
# tokenEndpoint: "https://accounts.google.com/token"
30+
# tokenFilepath: "/var/run/secrets/kafka/serviceaccount/token"
3031
# scope: "openid"
3132
# Example for basic authentication (uncomment to use):
3233
# username: "your-username"

0 commit comments

Comments
 (0)