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: README.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -337,6 +337,49 @@ We currently support [IDEFICS](https://huggingface.co/blog/idefics) (hosted on T
337
337
}
338
338
```
339
339
340
+
#### Group-based Model Permissions
341
+
342
+
If [logging in with OpenID](#openid-connect) via a supported provider, then user groups can be used in combination with the `allowed_groups` field for each model to show/hide models to users based on their group membership.
343
+
344
+
For all providers, see the following. Then, see additional instructions for your provider below.
345
+
346
+
1. Add `PROVIDER: "<provider-name-here>"` to your `.env.local` (you will enter the actual provider name later). Also, add `groups` to the `OPENID_CONFIG.SCOPES` field in your `.env.local` file:
347
+
```env
348
+
OPENID_CONFIG=`{
349
+
// rest of OPENID_CONFIG here
350
+
PROVIDER: "<provider-name-here>",
351
+
SCOPES: "openid profile groups",
352
+
// rest of OPENID_CONFIG here
353
+
}`
354
+
```
355
+
356
+
2. Use the `allowed_groups` parameter for each model to specify which group(s) should have access to that model. If not specified, all users will be able to access the model.
357
+
358
+
> [!WARNING]
359
+
> The first model in your `.env.local` file is considered the "default" model and should be available to all users, so we strongly recommend against setting `allowed_groups` for this model.
360
+
361
+
> Note that during development, it is common to have `APP_BASE=""` in your `.env.local` - however, due to the cookies created by using a provider, this value should not be empty (e.g. setting `APP_BASE="/"` in `.env.local` would work).
362
+
363
+
#### Provider: Microsoft Entra
364
+
365
+
In order to enable use of [Microsoft Entra Security Groups](https://learn.microsoft.com/en-us/entra/fundamentals/concept-learn-about-groups) to show/hide models, do the following:
366
+
367
+
1. Replace `<provider-name-here>` with `entra` in `.env.local`.
368
+
369
+
2.`allowed_groups` for each model in `.env.local` should be a list of Microsoft Entra **Group IDs** (not group names), e.g.:
// origin is null for some reason when the POST request callback comes from an auth provider like MS entra so we skip this check (CSRF token is still validated)
235
+
if(
236
+
event.url.pathname!==`${base}/login/callback`&&
237
+
!validOrigins.includes(newURL(origin).host)
238
+
){
233
239
returnerrorResponse(403,"Invalid referer for POST request");
0 commit comments