Skip to content

Commit a0e90cd

Browse files
committed
DOC-1347 Document principalMapping configuration for Redpanda Console OIDC auth (#1158)
1 parent bf25768 commit a0e90cd

File tree

7 files changed

+86
-29
lines changed

7 files changed

+86
-29
lines changed

modules/console/pages/config/connect-to-redpanda.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Configure a Connection to a Redpanda Cluster
1+
= Configure Redpanda Console to Connect to a Redpanda Cluster
22
:description: This topic provides instructions on configuring Redpanda Console to connect to a Redpanda cluster. The configuration ensures that Redpanda Console can communicate with your Redpanda brokers.
33

44
Redpanda Console connects to your Redpanda cluster using dedicated configuration blocks for the Kafka API, Schema Registry API, and Admin API. Each connection serves a different purpose:

modules/console/pages/config/http-path-rewrites.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= HTTP Path Rewrites
1+
= HTTP Path Rewrites in Redpanda Console
22
:description: Learn how to configure Redpanda Console to work seamlessly with your URL path rewrites, particularly when hosted under a subpath.
33
:page-aliases: console:features/http-path-rewrites.adoc, manage:console/http-path-rewrites.adoc
44

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

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Authentication
1+
= Authentication in Redpanda Console
22
:description: Authentication in Redpanda Console enables users to log in and optionally forward their credentials to the connected Redpanda cluster, ensuring all API requests are executed under the user's identity.
33
:page-aliases: console:single-sign-on/authentication.adoc, manage:security/console/authentication.adoc, console:config/security/plain.adoc, console:config/security/okta.adoc, console:config/security/generic-oidc.adoc, console:config/security/keycloak.adoc, console:config/security/github.adoc, console:config/security/google.adoc, console:config/security/azure-ad.adoc
44
:page-categories: Security, Management, Redpanda Console
@@ -36,7 +36,7 @@ image::console:login.png[]
3636
Redpanda Console can authenticate to Redpanda APIs in two ways:
3737

3838
* *User impersonation:* Uses the same credentials you log in with to authenticate API requests. This ensures accurate audit logs and unified identity enforcement.
39-
* *Static service account credentials:* Uses preconfigured credentials defined in the Redpanda Console configuration file. Useful when impersonation is disabled or RBAC needs to be separated from Redpanda identities.
39+
* *Static service account credentials:* Uses preconfigured credentials defined in the Redpanda Console configuration file. Useful when impersonation is disabled or glossterm:RBAC[] needs to be separated from Redpanda identities.
4040

4141
Upon login, Redpanda Console generates a secure session with a JSON Web Token (JWT), signed by the `authentication.jwtSigningKey`. The JWT can be stored as a secure cookie and is used to authenticate API requests.
4242

@@ -115,19 +115,21 @@ authentication:
115115
redirectUrl: "http://localhost:8080/auth/callbacks/oidc" # <9>
116116
accessType: "offline" # <10>
117117
prompt: "consent" # <11>
118+
principalMapping: "$.sub" # <12>
118119
----
119120

120-
<1> Required. Secret key for signing JWTs. Must be at least 32 characters. Store securely. You can also use the `AUTHENTICATION_JWTSIGNINGKEY`environment variable.
121+
<1> Required. Secret key for signing JWTs. Must be at least 32 characters. Store securely. You can also use the `AUTHENTICATION_JWTSIGNINGKEY` environment variable.
121122
<2> Recommended in production. Marks cookies as secure.
122123
<3> Required. Enables OIDC authentication.
123124
<4> Required. URL of the OIDC identity provider (IdP).
124125
<5> Required. The client ID from your IdP.
125126
<6> Required. The client secret from your IdP. You can also use the `AUTHENTICATION_OIDC_CLIENTSECRET` environment variable.
126127
<7> Requested scopes. Some IdPs such as Azure Entra ID require additional scopes to request OAuth 2.0-compliant tokens.
127-
<8> Optional. TLS configuration for secure connections to the IdP. Configure TLS only if you require mTLS or if you use a self-signed certificate for your identity provider.
128-
<9> Optional. Redirect URI registered with the IdP. This URL must be registered with your IdP and must point to the `/auth/callbacks/oidc` path in Redpanda Console. If this URL is not configured, Redpanda Console constructs the URL by using the base URL from the request and adding the `/auth/callbacks/oidc` path. You may want to configure this URL if you use xref:console:config/http-path-rewrites.adoc[HTTP path rewrites].
129-
<10> Optional. Controls whether a refresh token is requested. A value of `offline` (default) requests a refresh token for long-lived sessions. Set it to `online` if you don't want a refresh token.
130-
<11> Optional. Determines how the authorization prompt is displayed. Use `consent` (default) to force the consent screen to appear even if the user has previously authorized the application. Alternatives include `none` (no prompt) or `select_account` to allow the user to choose an account. Some IdPs require `consent` to issue a refresh token.
128+
<8> Optional. TLS configuration for secure connections to the IdP. Configure TLS only if you require mTLS or use a self-signed certificate.
129+
<9> Optional. Redirect URI registered with the IdP. This URI must point to the `/auth/callbacks/oidc` path in Redpanda Console. If not set, Console constructs the URL from the request. Configure this option explicitly if you're using xref:console:config/http-path-rewrites.adoc[HTTP path rewrites].
130+
<10> Optional. Controls whether a refresh token is requested. `offline` (default) requests a refresh token. Set to `online` to disable refresh token requests.
131+
<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.
132+
<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].
131133

132134
==== Enable static token mode
133135

@@ -404,20 +406,6 @@ authorization:
404406
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.
405407
====
406408

407-
== Authorization overview
408-
409-
Authentication allows users to log in, but authorization determines what they can do once authenticated.
410-
411-
Redpanda Console supports role-based access control (RBAC) through two modes:
412-
413-
- **User impersonation enabled**: Redpanda enforces authorization using its internal ACL and RBAC rules. The identity of the logged-in user is forwarded to the Kafka API, Admin API, and Schema Registry.
414-
- **User impersonation disabled**: Redpanda Console enforces access using `roleBindings` in the Redpanda Console configuration file. All API requests are made using a static service account.
415-
416-
[IMPORTANT]
417-
====
418-
Even with a valid login, users must still be granted permissions in Redpanda or in `roleBindings` to access resources. A Redpanda Console role (such as Admin) does not automatically grant permissions in Redpanda.
419-
====
420-
421409
== Next steps
422410

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

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

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Authorization
1+
= Authorization in Redpanda Console
22
:description: Redpanda Console supports role-based access control (RBAC) to restrict system access to authorized users. This page is intended for cluster administrators who manage Redpanda Console access and need to configure UI-based authorization.
33
:page-aliases: console:single-sign-on/authorization.adoc, manage:security/console/authorization.adoc, console:features/role-bindings.adoc, console:reference/role-bindings.adoc, reference:console/role-bindings.adoc
44
:page-categories: Security, Management, Redpanda Console
@@ -8,7 +8,7 @@
88
include::shared:partial$enterprise-and-console.adoc[]
99
====
1010

11-
{description}
11+
Authentication allows users to log in, but authorization determines what they can do once authenticated.
1212

1313
Redpanda Console supports two authorization modes, depending on whether *user impersonation* is enabled in the authentication configuration:
1414

@@ -20,7 +20,7 @@ Redpanda Console supports two authorization modes, depending on whether *user im
2020
| Redpanda Console evaluates permissions using role bindings defined in its configuration. Redpanda sees all requests as coming from a static service account.
2121

2222
| Impersonation enabled (`impersonateUser: true`)
23-
| Redpanda evaluates permissions using its internal RBAC and ACLs. Any role bindings in the Redpanda Console configuration are ignored.
23+
| Redpanda evaluates permissions using its internal glossterm:RBAC[] and ACLs. Any role bindings in the Redpanda Console configuration are ignored.
2424
|===
2525

2626
For more information about authentication options, see the xref:console:config/security/authentication.adoc[Redpanda Console authentication].
@@ -76,6 +76,8 @@ Use this mode to allow users to log in, while still having all API calls execute
7676
authentication:
7777
basic:
7878
enabled: true
79+
oidc:
80+
enabled: true
7981
8082
kafka:
8183
sasl:
@@ -101,7 +103,7 @@ Roles in Redpanda Console determine which UI features users can access. These ro
101103
.Do you have user impersonation enabled?
102104
[%collapsible]
103105
====
104-
Redpanda Console roles are not used when user impersonation is enabled for an API. When impersonation is enabled, the user's identity is forwarded to Redpanda, which then authorizes access based on RBAC and ACL rules.
106+
Redpanda Console roles are not used when user impersonation is enabled for an API. When impersonation is enabled, the user's identity is forwarded to Redpanda, which then authorizes access based on RBAC and ACL rules.
105107
106108
To successfully log in and access the UI, users must have valid Redpanda credentials and ACLs that permit access to the Kafka API.
107109
@@ -229,6 +231,67 @@ authorization:
229231

230232
All APIs must be accessible using a superuser principal. If the service account lacks superuser status, Redpanda Console may not be able to fetch cluster status, access the Admin API, or interact with the Schema Registry.
231233

234+
=== Transform identities with principal mappings
235+
236+
If you use OIDC login, the identity in the JWT token is extracted using a JSONPath expression. By default, this expression is `$.sub`, which means the value of the `sub` claim is used as the username. You can override this expression using the `principalMapping` option to transform or extract a different claim to match the `name` values in your `roleBindings` configuration.
237+
238+
To keep authorization consistent between Console and Redpanda, set `principalMapping` to match Redpanda's cluster configuration value for xref:reference:properties/cluster-properties.adoc#oidc_principal_mapping[`oidc_principal_mapping`].
239+
240+
.Example: Map email to local username
241+
[,yaml,lines=9]
242+
----
243+
authentication:
244+
oidc:
245+
enabled: true
246+
issuerUrl: https://auth.dev.cloud.redpanda.com/
247+
clientId: R1iX7Pls9UMXiUoYBOn4NcIUTbaGX4JG
248+
clientSecret: redacted
249+
redirectUrl: http://localhost:9090/auth/callbacks/oidc
250+
successfulLoginRedirectUrl: http://localhost:3000
251+
principalMapping: $.email/([^@]+)@example.com/$1/L
252+
----
253+
254+
This example:
255+
256+
* Extracts the `email` field from the OIDC token
257+
* Uses a regular expression to capture the username part
258+
* Replaces the value with the captured group `$1`
259+
* Converts the result to lowercase (`L` modifier)
260+
261+
As a result, the user identity becomes `matt` when the email is `matt@example.com`.
262+
263+
You can then define role bindings like this:
264+
265+
[,yaml]
266+
----
267+
authorization:
268+
roleBindings:
269+
- roleName: admin
270+
users:
271+
- loginType: oidc
272+
name: matt
273+
----
274+
275+
==== Match syntax and modifiers
276+
277+
The `principalMapping` syntax uses this format:
278+
279+
----
280+
<jsonpath>/<regex>/<replacement>/<modifiers>
281+
----
282+
283+
* `jsonpath`: Path to the claim field in the token (such as `$.email`)
284+
* `regex`: A regular expression to extract part of the claim
285+
* `replacement`: A replacement string using a captured group (such as `$1`)
286+
* `modifiers`: Optional flags, such as:
287+
- `L` — convert to lowercase
288+
- `U` — convert to uppercase
289+
290+
[NOTE]
291+
====
292+
If `principalMapping` is not set, Redpanda Console defaults to using the `sub` claim as the user identity.
293+
====
294+
232295
== Multiple roles and duplicate bindings
233296

234297
You can assign multiple roles to the same user through role bindings. In this case, the user receives the union of all permissions associated with those roles.

modules/console/pages/config/security/tls-termination.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= TLS Termination
1+
= TLS Termination in Redpanda Console
22
:page-aliases: manage:security/console/tls-termination.adoc
33
:description: To secure Redpanda Console using TLS, you can let Redpanda Console handle TLS termination or you can offload it to an upstream component, such as a reverse proxy or a Cloud HTTPS LoadBalancer.
44
:page-categories: Management, Security, Redpanda Console

modules/console/pages/config/topic-documentation.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Enable Topic Documentation
1+
= Enable Topic Documentation in Redpanda Console
22
:description: Embed your Kafka topic documentation into the Redpanda Console UI by linking a Git repository that contains the topic documentation files.
33
:page-aliases: console:features/topic-documentation.adoc, manage:console/topic-documentation.adoc
44

modules/reference/pages/properties/cluster-properties.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4110,6 +4110,12 @@ Rule for mapping JWT payload claim to a Redpanda user principal.
41104110

41114111
ifndef::env-cloud[]
41124112
*Default:* `$.sub`
4113+
4114+
*Related topics*:
4115+
4116+
* xref:manage:security/authentication.adoc#oidc[OpenID Connect authentication]
4117+
* xref:manage:kubernetes/security/authentication/k-authentication.adoc[OpenID Connect authentication in Kubernetes]
4118+
41134119
endif::[]
41144120

41154121
---

0 commit comments

Comments
 (0)