Skip to content

[auto-build] workspace-starting-point -> master #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _docs/master/developers-guide/driver-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ layout: new-docs

- Added the driver multi-method `driver/set-database-used!` for drivers to set a database on the connection with statements like `USE DATABASE`.

- Added the driver features `:transforms/table`, `:transforms/view`, and `:transforms/matarialized-view` for drivers
that support transforms with table, view, and materialized view as target, respectively.

## Metabase 0.55.9

- Add multi-method `driver/do-with-resilient-connection` for executing functions in a context where closed connections may be automatically reopened


## Metabase 0.55.0

- Add the multi-method `->date` that allows the driver to control how to cast strings and temporal types to dates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ You'll map this string in the `groups` key to a Metabase group, so that when the

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

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.

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.
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.

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

Expand Down
4 changes: 2 additions & 2 deletions _docs/master/embedding/sdk/api/MetabaseCollectionItem.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ type MetabaseCollectionItem = {
};
model: string;
name: string;
type?: "instance-analytics" | "trash" | "model" | "question" | "metric" | null;
type?: | "instance-analytics"
| "trash"
| "model"
| "question"
| "metric"
| "in_document"
| null;
};
```

Expand All @@ -46,6 +52,6 @@ The CollectionItem entity
| `last-edit-info.timestamp` | `string` |
| <a id="model"></a> `model` | `string` |
| <a id="name"></a> `name` | `string` |
| <a id="type"></a> `type?` | `"instance-analytics"` \| `"trash"` \| `"model"` \| `"question"` \| `"metric"` \| `null` |
| <a id="type"></a> `type?` | \| `"instance-analytics"` \| `"trash"` \| `"model"` \| `"question"` \| `"metric"` \| `"in_document"` \| `null` |

<!-- [<endsnippet properties>] -->
61 changes: 22 additions & 39 deletions _docs/master/people-and-groups/authenticating-with-jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,73 +29,56 @@ Assuming your site is localhost serving on port 3000:
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`.
6. Metabase verifies the JSON Web Token, logs the person in, then redirects the person to their original destination, `/question/1-superb-question`.

## Set up JWT authentication
## Enabling JWT authentication

Navigate to the **Admin**>**Settings** section of the Admin area, then click on the **Authentication > JWT** tab.
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:

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

Here's a breakdown of each of the settings:

- **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.
**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.

- **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.
**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.

## User attribute configuration (optional)

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

- **Email attribute:** the key to retrieve each JWT user's email address.
- **First name attribute:** the key to retrieve each JWT user's first name.
- **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.
- **Group assignment attribute:** the key to retrieve each JWT user's group assignments.
- **First Name attribute:** the key to retrieve each JWT user's first name.
- **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.

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.

## Configure group mappings

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.
You can use your JWT to assign Metabase users to custom groups.

You can configure JWT group assignments through Metabase's Admin interface, or by setting environment variables.

### Configure group mapping in Metabase

1. Add groups to your JWT: `groups: ["group_name"]`. The attribute key (e.g. `groups`) should match the **Group assignment attribute** in Metabase.
1. In Metabase JWT settings, under **Group Sync**, toggle on **Synchronize Group Memberships**
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.

1. Otherwise, click **New mapping** and add the name of a JWT group.
1. Add groups to your JWT: `groups: ["group_name"]`.
1. In Metabase, go to the Admin panel and switch to **Setting > Authentication** tab.
1. Click the **Configure** button under JWT.
1. Under **Group Schema**, turn on the toggle **Synchronize Group Memberships**
1. Click **New mapping** and add the name of a JWT group.
1. In the row that appears, click the dropdown to pick the Metabase group(s) that this should map to.
![Metabase JWT group mappings](./images/jwt-groups.png)
1. Repeat this for each of the groups you want to map.

### Configure group mapping through environment variables

You can use the following environment variables to configure JTW group mappings instead of configuring them in Metabase's Admin settings:

- [`MB_JWT_ATTRIBUTE_GROUPS`](../configuring-metabase/environment-variables#mb_jwt_attribute_groups) to specify the key to retrieve the JWT user’s groups;

- [`MB_JWT_GROUP_SYNC`](../configuring-metabase/environment-variables#mb_jwt_group_sync) to turn group sync on or off (sync is off by default).

```
MB_JWT_GROUP_SYNC=true
```

- [`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:

```
MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
```
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:

where `extHR`, `extSales` are names of JWT groups and 3,4,7 are IDs of Metabase groups.
```
MB_JWT_GROUP_MAPPINGS='{"extHR":[7], "extSales":[3,4]}'
```

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.
where `extHR`, `extSales` are names of JWT groups and 3,4,7 are IDs of Metabase groups.

### If group mappings are not specified, Metabase will match groups by name
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.

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.
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.

If you add group mappings manually, Metabase will _not_ try to also match groups by names.
```
MB_JWT_GROUP_SYNC=true
```

## Creating Metabase accounts with SSO

Expand Down
Binary file modified _docs/master/people-and-groups/images/JWT-auth-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _docs/master/people-and-groups/images/jwt-groups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions _site/docs/master/developers-guide/driver-changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -4875,6 +4875,10 @@ <h2 id="metabase-0560">Metabase 0.56.0</h2>
<li>
<p>Added the driver multi-method <code class="language-plaintext highlighter-rouge">driver/set-database-used!</code> for drivers to set a database on the connection with statements like <code class="language-plaintext highlighter-rouge">USE DATABASE</code>.</p>
</li>
<li>
<p>Added the driver features <code class="language-plaintext highlighter-rouge">:transforms/table</code>, <code class="language-plaintext highlighter-rouge">:transforms/view</code>, and <code class="language-plaintext highlighter-rouge">:transforms/matarialized-view</code> for drivers
that support transforms with table, view, and materialized view as target, respectively.</p>
</li>
</ul>

<h2 id="metabase-0559">Metabase 0.55.9</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5064,9 +5064,7 @@ <h3 id="synchronize-groups-between-metabase-and-your-app">Synchronize groups bet

<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>

<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>

<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>
<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>

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

Expand Down
Loading