Skip to content

Commit f4bbf8b

Browse files
github-automation-metabaseMetabase Docs bot
andauthored
[auto] adding content to backport-56-34e884c47a295b17edc9272f19fdceee9c3f3245->release-x.56.x (#399)
Co-authored-by: Metabase Docs bot <metabase-bot@metabase.com>
1 parent 3ff5dde commit f4bbf8b

File tree

8 files changed

+95
-45
lines changed

8 files changed

+95
-45
lines changed

_docs/v0.56/embedding/interactive-embedding-quick-start-guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ You'll map this string in the `groups` key to a Metabase group, so that when the
176176

177177
In Metabase's admin section, go to **Settings** > **Authentication**. Scroll to the **JWT** card and click **Edit**.
178178

179-
In the **Group schema** section, toggle on **Synchronize group memberships**. For each group you want to sync, add a group mapping. When you click **New mapping**, enter "Customer-Acme", the string that you included in the `groups` array in your JWT payload. You can then associate that group name with the Metabase group "Customer Acme" that we created earlier.
179+
In the **Group schema** section, toggle on **Synchronize group memberships**. If the names of groups in the `groups` array match Metabase group names exactly (e.g. both are `"Customer Acme"`), then the groups will be mapped automatically.
180+
181+
If the JWT group names and Metabase group names don't match, then for each group you want to sync, add a group mapping. When you click **New mapping**, enter "Customer-Acme", the string that you included in the `groups` array in your JWT payload. You can then associate that group name with the Metabase group "Customer Acme" that we created earlier.
180182

181183
![Mapping user attributes to groups.](./images/sync-groups.png)
182184

_docs/v0.56/people-and-groups/authenticating-with-jwt.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,56 +29,73 @@ Assuming your site is localhost serving on port 3000:
2929
5. In the event of a successful sign-in, your authentication app should issue a GET request to your Metabase endpoint with the token and the "return to" URI: `http://localhost:3000/auth/sso?jwt=TOKEN_GOES_HERE&return_to=/question/1-superb-question`.
3030
6. Metabase verifies the JSON Web Token, logs the person in, then redirects the person to their original destination, `/question/1-superb-question`.
3131

32-
## Enabling JWT authentication
32+
## Set up JWT authentication
3333

34-
Navigate to the **Admin**>**Settings** section of the Admin area, then click on the **Authentication** tab. Click the **Configure** button in the JWT section of this page, and you'll see this form:
34+
Navigate to the **Admin**>**Settings** section of the Admin area, then click on the **Authentication > JWT** tab.
3535

3636
![JWT form](images/JWT-auth-form.png)
3737

3838
Here's a breakdown of each of the settings:
3939

40-
**JWT Identity Provider URI:** This is where Metabase will redirect login requests. That is, it's where your users go to log in through your identity provider.
40+
- **JWT Identity Provider URI**: This is where Metabase will redirect login requests. That is, it's where your users go to log in through your identity provider.
4141

42-
**String Used by the JWT Signing Key:** The string used to seed the private key used to validate JWT messages. Both Metabase and the authentication app should have the same JWT signing key.
42+
- **String Used by the JWT Signing Key**: The string used to seed the private key used to validate JWT messages. Both Metabase and the authentication app should have the same JWT signing key.
4343

4444
## User attribute configuration (optional)
4545

4646
These are additional settings you can fill in to pass user attributes to Metabase.
4747

4848
- **Email attribute:** the key to retrieve each JWT user's email address.
49-
- **First Name attribute:** the key to retrieve each JWT user's first name.
50-
- **Last Name attribute:** if you guessed that this is the key to retrieve each JWT user's last name, well then you have been paying attention.
49+
- **First name attribute:** the key to retrieve each JWT user's first name.
50+
- **Last name attribute:** if you guessed that this is the key to retrieve each JWT user's last name, well then you have been paying attention.
51+
- **Group assignment attribute:** the key to retrieve each JWT user's group assignments.
5152

5253
You can send additional user attributes to Metabase by adding the attributes as key/value pairs to your JWT. These attributes will be synced on every login.
5354

5455
## Configure group mappings
5556

56-
You can use your JWT to assign Metabase users to custom groups.
57+
You can use your JWT to assign Metabase users to custom Metabase [groups](./managing#groups) based on their attributes, e.g. automatically assign everyone with a certain JWT attribute to the `Sales` group in Metabase. This can be helpful for [permissions management](../permissions/introduction#key-points-regarding-permissions) at scale.
5758

58-
1. Add groups to your JWT: `groups: ["group_name"]`.
59-
1. In Metabase, go to the Admin panel and switch to **Setting > Authentication** tab.
60-
1. Click the **Configure** button under JWT.
61-
1. Under **Group Schema**, turn on the toggle **Synchronize Group Memberships**
62-
1. Click **New mapping** and add the name of a JWT group.
59+
You can configure JWT group assignments through Metabase's Admin interface, or by setting environment variables.
60+
61+
### Configure group mapping in Metabase
62+
63+
1. Add groups to your JWT: `groups: ["group_name"]`. The attribute key (e.g. `groups`) should match the **Group assignment attribute** in Metabase.
64+
1. In Metabase JWT settings, under **Group Sync**, toggle on **Synchronize Group Memberships**
65+
1. If the group names in your JWT match the Metabase group names, they will be synced automatically, and you don't need to set up mappings manually.
66+
67+
1. Otherwise, click **New mapping** and add the name of a JWT group.
6368
1. In the row that appears, click the dropdown to pick the Metabase group(s) that this should map to.
6469
![Metabase JWT group mappings](./images/jwt-groups.png)
6570
1. Repeat this for each of the groups you want to map.
6671

67-
Alternatively, you can define the mappings between JWT and Metabase groups using the [environment variable `MB_JWT_GROUP_MAPPINGS`](../configuring-metabase/environment-variables#mb_jwt_group_mappings). It accepts a JSON object where the keys are JWT groups and the values are lists of Metabase groups IDs. For example:
72+
### Configure group mapping through environment variables
73+
74+
You can use the following environment variables to configure JTW group mappings instead of configuring them in Metabase's Admin settings:
75+
76+
- [`MB_JWT_ATTRIBUTE_GROUPS`](../configuring-metabase/environment-variables#mb_jwt_attribute_groups) to specify the key to retrieve the JWT user’s groups;
77+
78+
- [`MB_JWT_GROUP_SYNC`](../configuring-metabase/environment-variables#mb_jwt_group_sync) to turn group sync on or off (sync is off by default).
79+
80+
```
81+
MB_JWT_GROUP_SYNC=true
82+
```
83+
84+
- [`MB_JWT_GROUP_MAPPINGS`](../configuring-metabase/environment-variables#mb_jwt_group_mappings) to configure group mapping. It accepts a JSON object where the keys are JWT groups and the values are lists of Metabase groups IDs. For example:
85+
86+
```
87+
MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
88+
```
6889

69-
```
70-
MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
71-
```
90+
where `extHR`, `extSales` are names of JWT groups and 3,4,7 are IDs of Metabase groups.
7291

73-
where `extHR`, `extSales` are names of JWT groups and 3,4,7 are IDs of Metabase groups.
92+
You can find Metabase Group ID in the URL for the group page, like `http://your-metabase-url/admin/people/groups/<ID>`. "All Users" group has ID 1 and "Administrators" group has ID 2.
7493

75-
You can find Metabase Group ID in the URL for the group page, like `http://your-metabase-url/admin/people/groups/<ID>`. "All Users" group has ID 1 and "Administrators" group has ID 2.
94+
### If group mappings are not specified, Metabase will match groups by name
7695

77-
You can also use the [environment variable `MB_JWT_GROUP_SYNC`](../configuring-metabase/environment-variables#mb_jwt_group_sync) to turn group sync on or off.
96+
If you don't specify any group mappings in Metabase's Admin settings or via `MB_JWT_GROUP_MAPPINGS` environment variables, then Metabase will try to assign Metabase groups to users based on the matching names. If the names of groups in the JWT group attribute array match Metabase group names exactly (e.g. both are `"Sales"`), then the groups will be mapped automatically.
7897

79-
```
80-
MB_JWT_GROUP_SYNC=true
81-
```
98+
If you add group mappings manually, Metabase will _not_ try to also match groups by names.
8299

83100
## Creating Metabase accounts with SSO
84101

7.63 KB
Loading
9.81 KB
Loading

_site/docs/v0.56/embedding/interactive-embedding-quick-start-guide.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5064,7 +5064,9 @@ <h3 id="synchronize-groups-between-metabase-and-your-app">Synchronize groups bet
50645064

50655065
<p>In Metabase’s admin section, go to <strong>Settings</strong> &gt; <strong>Authentication</strong>. Scroll to the <strong>JWT</strong> card and click <strong>Edit</strong>.</p>
50665066

5067-
<p>In the <strong>Group schema</strong> section, toggle on <strong>Synchronize group memberships</strong>. For each group you want to sync, add a group mapping. When you click <strong>New mapping</strong>, enter “Customer-Acme”, the string that you included in the <code class="language-plaintext highlighter-rouge">groups</code> array in your JWT payload. You can then associate that group name with the Metabase group “Customer Acme” that we created earlier.</p>
5067+
<p>In the <strong>Group schema</strong> section, toggle on <strong>Synchronize group memberships</strong>. If the names of groups in the <code class="language-plaintext highlighter-rouge">groups</code> array match Metabase group names exactly (e.g. both are <code class="language-plaintext highlighter-rouge">"Customer Acme"</code>), then the groups will be mapped automatically.</p>
5068+
5069+
<p>If the JWT group names and Metabase group names don’t match, then for each group you want to sync, add a group mapping. When you click <strong>New mapping</strong>, enter “Customer-Acme”, the string that you included in the <code class="language-plaintext highlighter-rouge">groups</code> array in your JWT payload. You can then associate that group name with the Metabase group “Customer Acme” that we created earlier.</p>
50685070

50695071
<p><img src="./images/sync-groups.png" alt="Mapping user attributes to groups."></p>
50705072

_site/docs/v0.56/people-and-groups/authenticating-with-jwt.html

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4876,58 +4876,87 @@ <h2 id="typical-flow-for-a-jwt-based-sso-interaction-with-metabase">Typical flow
48764876
<li>Metabase verifies the JSON Web Token, logs the person in, then redirects the person to their original destination, <code class="language-plaintext highlighter-rouge">/question/1-superb-question</code>.</li>
48774877
</ol>
48784878

4879-
<h2 id="enabling-jwt-authentication">Enabling JWT authentication</h2>
4879+
<h2 id="set-up-jwt-authentication">Set up JWT authentication</h2>
48804880

4881-
<p>Navigate to the <strong>Admin</strong>&gt;<strong>Settings</strong> section of the Admin area, then click on the <strong>Authentication</strong> tab. Click the <strong>Configure</strong> button in the JWT section of this page, and you’ll see this form:</p>
4881+
<p>Navigate to the <strong>Admin</strong>&gt;<strong>Settings</strong> section of the Admin area, then click on the <strong>Authentication &gt; JWT</strong> tab.</p>
48824882

48834883
<p><img src="images/JWT-auth-form.png" alt="JWT form"></p>
48844884

48854885
<p>Here’s a breakdown of each of the settings:</p>
48864886

4887-
<p><strong>JWT Identity Provider URI:</strong> This is where Metabase will redirect login requests. That is, it’s where your users go to log in through your identity provider.</p>
4888-
4889-
<p><strong>String Used by the JWT Signing Key:</strong> The string used to seed the private key used to validate JWT messages. Both Metabase and the authentication app should have the same JWT signing key.</p>
4887+
<ul>
4888+
<li>
4889+
<p><strong>JWT Identity Provider URI</strong>: This is where Metabase will redirect login requests. That is, it’s where your users go to log in through your identity provider.</p>
4890+
</li>
4891+
<li>
4892+
<p><strong>String Used by the JWT Signing Key</strong>: The string used to seed the private key used to validate JWT messages. Both Metabase and the authentication app should have the same JWT signing key.</p>
4893+
</li>
4894+
</ul>
48904895

48914896
<h2 id="user-attribute-configuration-optional">User attribute configuration (optional)</h2>
48924897

48934898
<p>These are additional settings you can fill in to pass user attributes to Metabase.</p>
48944899

48954900
<ul>
48964901
<li><strong>Email attribute:</strong> the key to retrieve each JWT user’s email address.</li>
4897-
<li><strong>First Name attribute:</strong> the key to retrieve each JWT user’s first name.</li>
4898-
<li><strong>Last Name attribute:</strong> if you guessed that this is the key to retrieve each JWT user’s last name, well then you have been paying attention.</li>
4902+
<li><strong>First name attribute:</strong> the key to retrieve each JWT user’s first name.</li>
4903+
<li><strong>Last name attribute:</strong> if you guessed that this is the key to retrieve each JWT user’s last name, well then you have been paying attention.</li>
4904+
<li><strong>Group assignment attribute:</strong> the key to retrieve each JWT user’s group assignments.</li>
48994905
</ul>
49004906

49014907
<p>You can send additional user attributes to Metabase by adding the attributes as key/value pairs to your JWT. These attributes will be synced on every login.</p>
49024908

49034909
<h2 id="configure-group-mappings">Configure group mappings</h2>
49044910

4905-
<p>You can use your JWT to assign Metabase users to custom groups.</p>
4911+
<p>You can use your JWT to assign Metabase users to custom Metabase <a href="./managing#groups">groups</a> based on their attributes, e.g. automatically assign everyone with a certain JWT attribute to the <code class="language-plaintext highlighter-rouge">Sales</code> group in Metabase. This can be helpful for <a href="../permissions/introduction#key-points-regarding-permissions">permissions management</a> at scale.</p>
4912+
4913+
<p>You can configure JWT group assignments through Metabase’s Admin interface, or by setting environment variables.</p>
4914+
4915+
<h3 id="configure-group-mapping-in-metabase">Configure group mapping in Metabase</h3>
49064916

49074917
<ol>
4908-
<li>Add groups to your JWT: <code class="language-plaintext highlighter-rouge">groups: ["group_name"]</code>.</li>
4909-
<li>In Metabase, go to the Admin panel and switch to <strong>Setting &gt; Authentication</strong> tab.</li>
4910-
<li>Click the <strong>Configure</strong> button under JWT.</li>
4911-
<li>Under <strong>Group Schema</strong>, turn on the toggle <strong>Synchronize Group Memberships</strong></li>
4912-
<li>Click <strong>New mapping</strong> and add the name of a JWT group.</li>
4918+
<li>Add groups to your JWT: <code class="language-plaintext highlighter-rouge">groups: ["group_name"]</code>. The attribute key (e.g. <code class="language-plaintext highlighter-rouge">groups</code>) should match the <strong>Group assignment attribute</strong> in Metabase.</li>
4919+
<li>In Metabase JWT settings, under <strong>Group Sync</strong>, toggle on <strong>Synchronize Group Memberships</strong></li>
4920+
<li>
4921+
<p>If the group names in your JWT match the Metabase group names, they will be synced automatically, and you don’t need to set up mappings manually.</p>
4922+
</li>
4923+
<li>Otherwise, click <strong>New mapping</strong> and add the name of a JWT group.</li>
49134924
<li>In the row that appears, click the dropdown to pick the Metabase group(s) that this should map to.
49144925
<img src="./images/jwt-groups.png" alt="Metabase JWT group mappings"></li>
49154926
<li>Repeat this for each of the groups you want to map.</li>
49164927
</ol>
49174928

4918-
<p>Alternatively, you can define the mappings between JWT and Metabase groups using the <a href="../configuring-metabase/environment-variables#mb_jwt_group_mappings">environment variable <code class="language-plaintext highlighter-rouge">MB_JWT_GROUP_MAPPINGS</code></a>. It accepts a JSON object where the keys are JWT groups and the values are lists of Metabase groups IDs. For example:</p>
4929+
<h3 id="configure-group-mapping-through-environment-variables">Configure group mapping through environment variables</h3>
49194930

4920-
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
4921-
</code></pre></div></div>
4931+
<p>You can use the following environment variables to configure JTW group mappings instead of configuring them in Metabase’s Admin settings:</p>
49224932

4923-
<p>where <code class="language-plaintext highlighter-rouge">extHR</code>, <code class="language-plaintext highlighter-rouge">extSales</code> are names of JWT groups and 3,4,7 are IDs of Metabase groups.</p>
4933+
<ul>
4934+
<li>
4935+
<p><a href="../configuring-metabase/environment-variables#mb_jwt_attribute_groups"><code class="language-plaintext highlighter-rouge">MB_JWT_ATTRIBUTE_GROUPS</code></a> to specify the key to retrieve the JWT user’s groups;</p>
4936+
</li>
4937+
<li>
4938+
<p><a href="../configuring-metabase/environment-variables#mb_jwt_group_sync"><code class="language-plaintext highlighter-rouge">MB_JWT_GROUP_SYNC</code></a> to turn group sync on or off (sync is off by default).</p>
4939+
4940+
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MB_JWT_GROUP_SYNC=true
4941+
</code></pre></div> </div>
4942+
</li>
4943+
<li>
4944+
<p><a href="../configuring-metabase/environment-variables#mb_jwt_group_mappings"><code class="language-plaintext highlighter-rouge">MB_JWT_GROUP_MAPPINGS</code></a> to configure group mapping. It accepts a JSON object where the keys are JWT groups and the values are lists of Metabase groups IDs. For example:</p>
4945+
4946+
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
4947+
</code></pre></div> </div>
4948+
4949+
<p>where <code class="language-plaintext highlighter-rouge">extHR</code>, <code class="language-plaintext highlighter-rouge">extSales</code> are names of JWT groups and 3,4,7 are IDs of Metabase groups.</p>
4950+
4951+
<p>You can find Metabase Group ID in the URL for the group page, like <code class="language-plaintext highlighter-rouge">http://your-metabase-url/admin/people/groups/&lt;ID&gt;</code>. “All Users” group has ID 1 and “Administrators” group has ID 2.</p>
4952+
</li>
4953+
</ul>
49244954

4925-
<p>You can find Metabase Group ID in the URL for the group page, like <code class="language-plaintext highlighter-rouge">http://your-metabase-url/admin/people/groups/&lt;ID&gt;</code>. “All Users” group has ID 1 and “Administrators” group has ID 2.</p>
4955+
<h3 id="if-group-mappings-are-not-specified-metabase-will-match-groups-by-name">If group mappings are not specified, Metabase will match groups by name</h3>
49264956

4927-
<p>You can also use the <a href="../configuring-metabase/environment-variables#mb_jwt_group_sync">environment variable <code class="language-plaintext highlighter-rouge">MB_JWT_GROUP_SYNC</code></a> to turn group sync on or off.</p>
4957+
<p>If you don’t specify any group mappings in Metabase’s Admin settings or via <code class="language-plaintext highlighter-rouge">MB_JWT_GROUP_MAPPINGS</code> environment variables, then Metabase will try to assign Metabase groups to users based on the matching names. If the names of groups in the JWT group attribute array match Metabase group names exactly (e.g. both are <code class="language-plaintext highlighter-rouge">"Sales"</code>), then the groups will be mapped automatically.</p>
49284958

4929-
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MB_JWT_GROUP_SYNC=true
4930-
</code></pre></div></div>
4959+
<p>If you add group mappings manually, Metabase will <em>not</em> try to also match groups by names.</p>
49314960

49324961
<h2 id="creating-metabase-accounts-with-sso">Creating Metabase accounts with SSO</h2>
49334962

7.63 KB
Loading
9.81 KB
Loading

0 commit comments

Comments
 (0)