You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/v0.56/embedding/interactive-embedding-quick-start-guide.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,9 @@ You'll map this string in the `groups` key to a Metabase group, so that when the
176
176
177
177
In Metabase's admin section, go to **Settings** > **Authentication**. Scroll to the **JWT** card and click **Edit**.
178
178
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.
180
182
181
183

Copy file name to clipboardExpand all lines: _docs/v0.56/people-and-groups/authenticating-with-jwt.md
+39-22Lines changed: 39 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,56 +29,73 @@ Assuming your site is localhost serving on port 3000:
29
29
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`.
30
30
6. Metabase verifies the JSON Web Token, logs the person in, then redirects the person to their original destination, `/question/1-superb-question`.
31
31
32
-
## Enabling JWT authentication
32
+
## Set up JWT authentication
33
33
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.
35
35
36
36

37
37
38
38
Here's a breakdown of each of the settings:
39
39
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.
41
41
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.
43
43
44
44
## User attribute configuration (optional)
45
45
46
46
These are additional settings you can fill in to pass user attributes to Metabase.
47
47
48
48
-**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.
51
52
52
53
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.
53
54
54
55
## Configure group mappings
55
56
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.
57
58
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.
63
68
1. In the row that appears, click the dropdown to pick the Metabase group(s) that this should map to.
64
69

65
70
1. Repeat this for each of the groups you want to map.
66
71
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:
where `extHR`, `extSales` are names of JWT groups and 3,4,7 are IDs of Metabase groups.
72
91
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.
74
93
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
76
95
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`environmentvariables, 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.
78
97
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.
Copy file name to clipboardExpand all lines: _site/docs/v0.56/embedding/interactive-embedding-quick-start-guide.html
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5064,7 +5064,9 @@ <h3 id="synchronize-groups-between-metabase-and-your-app">Synchronize groups bet
5064
5064
5065
5065
<p>In Metabase’s admin section, go to <strong>Settings</strong> > <strong>Authentication</strong>. Scroll to the <strong>JWT</strong> card and click <strong>Edit</strong>.</p>
5066
5066
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 <codeclass="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 <codeclass="language-plaintext highlighter-rouge">groups</code> array match Metabase group names exactly (e.g. both are <codeclass="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 <codeclass="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>
5068
5070
5069
5071
<p><imgsrc="./images/sync-groups.png" alt="Mapping user attributes to groups."></p>
<li>Metabase verifies the JSON Web Token, logs the person in, then redirects the person to their original destination, <codeclass="language-plaintext highlighter-rouge">/question/1-superb-question</code>.</li>
<h2id="set-up-jwt-authentication">Set up JWT authentication</h2>
4880
4880
4881
-
<p>Navigate to the <strong>Admin</strong>><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>><strong>Settings</strong> section of the Admin area, then click on the <strong>Authentication > JWT</strong>tab.</p>
<p>Here’s a breakdown of each of the settings:</p>
4886
4886
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>
<p>These are additional settings you can fill in to pass user attributes to Metabase.</p>
4894
4899
4895
4900
<ul>
4896
4901
<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>
4899
4905
</ul>
4900
4906
4901
4907
<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>
4902
4908
4903
4909
<h2id="configure-group-mappings">Configure group mappings</h2>
4904
4910
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 <ahref="./managing#groups">groups</a> based on their attributes, e.g. automatically assign everyone with a certain JWT attribute to the <codeclass="language-plaintext highlighter-rouge">Sales</code> group in Metabase. This can be helpful for <ahref="../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
+
<h3id="configure-group-mapping-in-metabase">Configure group mapping in Metabase</h3>
4906
4916
4907
4917
<ol>
4908
-
<li>Add groups to your JWT: <codeclass="language-plaintext highlighter-rouge">groups: ["group_name"]</code>.</li>
4909
-
<li>In Metabase, go to the Admin panel and switch to <strong>Setting > 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: <codeclass="language-plaintext highlighter-rouge">groups: ["group_name"]</code>. The attribute key (e.g. <codeclass="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>
4913
4924
<li>In the row that appears, click the dropdown to pick the Metabase group(s) that this should map to.
4914
4925
<imgsrc="./images/jwt-groups.png" alt="Metabase JWT group mappings"></li>
4915
4926
<li>Repeat this for each of the groups you want to map.</li>
4916
4927
</ol>
4917
4928
4918
-
<p>Alternatively, you can define the mappings between JWT and Metabase groups using the <ahref="../configuring-metabase/environment-variables#mb_jwt_group_mappings">environment variable <codeclass="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
+
<h3id="configure-group-mapping-through-environment-variables">Configure group mapping through environment variables</h3>
<p>You can use the following environment variables to configure JTW group mappings instead of configuring them in Metabase’s Admin settings:</p>
4922
4932
4923
-
<p>where <codeclass="language-plaintext highlighter-rouge">extHR</code>, <codeclass="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><ahref="../configuring-metabase/environment-variables#mb_jwt_attribute_groups"><codeclass="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><ahref="../configuring-metabase/environment-variables#mb_jwt_group_sync"><codeclass="language-plaintext highlighter-rouge">MB_JWT_GROUP_SYNC</code></a> to turn group sync on or off (sync is off by default).</p>
<p><ahref="../configuring-metabase/environment-variables#mb_jwt_group_mappings"><codeclass="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>
<p>where <codeclass="language-plaintext highlighter-rouge">extHR</code>, <codeclass="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 <codeclass="language-plaintext highlighter-rouge">http://your-metabase-url/admin/people/groups/<ID></code>. “All Users” group has ID 1 and “Administrators” group has ID 2.</p>
4952
+
</li>
4953
+
</ul>
4924
4954
4925
-
<p>You can find Metabase Group ID in the URL for the group page, like <codeclass="language-plaintext highlighter-rouge">http://your-metabase-url/admin/people/groups/<ID></code>. “All Users” group has ID 1 and “Administrators” group has ID 2.</p>
4955
+
<h3id="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>
4926
4956
4927
-
<p>You can also use the <ahref="../configuring-metabase/environment-variables#mb_jwt_group_sync">environment variable <codeclass="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 <codeclass="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 <codeclass="language-plaintext highlighter-rouge">"Sales"</code>), then the groups will be mapped automatically.</p>
0 commit comments