# Open WebUI as Your Internal ChatGPT: Setup with SSO and Permissions

> Run Open WebUI as a container in front of your model server, connect sign-in to Microsoft Entra ID or another OIDC provider, and sync roles and groups from the directory. Make models and knowledge bases private and grant them to groups, then decide on temporary chat, admin visibility and how chats get deleted.

Canonical URL: https://www.ruebstudio.de/en/guides/local-ai/open-webui-internal-chatgpt  
Author: Dr.-Ing. Marcus Rüb, CEO  
Published: 2026-11-05

A self-hosted model server is only half of an internal ChatGPT. Staff also need a familiar chat window, company sign-in, and some assurance about who can see what. Open WebUI covers that layer and talks to Ollama, vLLM or any OpenAI-compatible endpoint. This guide stays on the interface layer: identity, group permissions and stored chat data.

## What are we building?

The result is a chat portal where employees sign in with their work account, see only the models and knowledge bases meant for their team, and where stored chat history follows a policy you chose rather than the defaults. Microsoft Entra ID is the worked example; Okta, Keycloak or any OIDC provider uses the same building blocks.

Picking and running the model server underneath is covered in the [overview of LLM inference servers](https://www.ruebstudio.de/en/guides/local-ai/llm-inference-servers-overview). For a broader comparison of local chat front ends and when they can stand in for ChatGPT, see [using ChatGPT offline](https://www.ruebstudio.de/en/guides/local-ai/chatgpt-offline-local-alternative). This guide is narrower: the hands-on Open WebUI setup between the browser and the model server:

- **Identity:** single sign-on through OIDC instead of local passwords.
- **Roles:** who is an admin, who is a regular user, who waits for approval.
- **Groups:** which team can use which model and which document collection.
- **Chat data:** what is stored, who can read it, and how it is removed.

The setup targets a single instance. Running several replicas behind a load balancer adds Redis and a shared database, which is out of scope here.

## Prerequisites

You need a Linux host with Docker, a reachable model server and admin access to your identity provider. Everything below was checked against the documentation for Open WebUI [v0.13.0](https://github.com/open-webui/open-webui/releases/tag/v0.13.0), released on 3 November 2026. Status: November 2026.

- A host running Docker Compose behind a TLS reverse proxy, with a stable name such as `chat.example.internal`.
- A model server (Ollama, vLLM or similar) that the container can reach over the network.
- In Entra ID, permission to create app registrations and assign groups to an enterprise application.
- PostgreSQL for production. The Open WebUI [privacy page](https://docs.openwebui.com/security/chat-data-privacy-and-encryption) recommends PostgreSQL on encrypted storage; for SQLite, the data directory should sit on an encrypted file system.

## Step 1: Run a pinned version with a persistent volume

Pin a release tag instead of `main` and mount a named volume. According to the [quick start](https://docs.openwebui.com/getting-started/quick-start), chats, users and settings live in `/app/backend/data`, so a container without that volume loses everything on the next update.

```yaml
# docker-compose.yml
services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:v0.13.0
    ports:
      - "127.0.0.1:3000:8080"   # local only; the reverse proxy handles TLS
    volumes:
      - open-webui:/app/backend/data
    env_file: .env
    restart: unless-stopped
volumes:
  open-webui:
```

Start with a minimal `.env`:

```bash
WEBUI_URL=https://chat.example.internal
WEBUI_SECRET_KEY=<long-random-value>
OLLAMA_BASE_URL=http://models.example.internal:11434
DATABASE_URL=postgresql://openwebui:<password>@db.example.internal:5432/openwebui
DEFAULT_USER_ROLE=pending
```

The secret key signs sessions and encrypts stored OAuth tokens, and the SSO docs say it must be set to avoid session problems. `pending` is already the default role according to the [environment variable reference](https://docs.openwebui.com/reference/env-configuration): new accounts cannot do anything until an admin approves them. The first account on a fresh install becomes admin automatically, so create it before anyone else can reach the service.

## Step 2: Register the application in Entra ID

Create a web app registration in Entra ID with the redirect URI `https://chat.example.internal/oauth/microsoft/callback`, then note the client ID, a client secret and the tenant ID. The [SSO documentation](https://docs.openwebui.com/features/authentication-access/auth/sso) states that Microsoft sign-in is limited to a single tenant.

Set up group claims now, so groups arrive with readable names later:

1. Under **Token configuration**, add a groups claim for ID and access tokens.
2. In the **Manifest**, set `groupMembershipClaims` to `ApplicationGroup` and add `cloud_displayname` to the `groups` claim.
3. Under **Enterprise applications > Users and groups**, assign the security groups Open WebUI should know about.

Skip this and groups arrive as object IDs. Microsoft documents that `cloud_displayname` only works together with `ApplicationGroup` ([optional claims](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims)), and the community [Entra group name sync](https://docs.openwebui.com/tutorials/auth-sso/entra-group-name-sync) tutorial walks through the manifest. Assigning groups to the application also keeps tokens small: Microsoft caps a JWT at 200 groups, nested groups included, and recommends this option for large organisations.

If admin rights should come from the directory too, define app roles such as `user` and `admin` and assign them.

## Step 3: Turn on SSO and switch off passwords

Add the Microsoft values and the account-creation switches to `.env`. Only disable password sign-in once SSO works, or you will lock yourself out.

```bash
MICROSOFT_CLIENT_ID=<client-id>
MICROSOFT_CLIENT_SECRET=<client-secret>
MICROSOFT_CLIENT_TENANT_ID=<tenant-id>
MICROSOFT_OAUTH_SCOPE=openid email profile offline_access
ENABLE_OAUTH_SIGNUP=true
OAUTH_ALLOWED_DOMAINS=example.com
# only after a successful SSO test:
ENABLE_LOGIN_FORM=false
ENABLE_PASSWORD_AUTH=false
```

Points worth knowing:

- `ENABLE_OAUTH_SIGNUP` defaults to `false`, so without it the first SSO sign-in creates no account.
- `offline_access` makes Microsoft return a refresh token. Plain chat keeps working without it, but OAuth-based tool servers and OneDrive or SharePoint access fail after roughly an hour.
- `ENABLE_LOGIN_FORM=false` hides the form and refuses local sign-ups; `ENABLE_PASSWORD_AUTH=false` also blocks password sign-in through the API.

For Okta, Keycloak and other providers, use `OAUTH_CLIENT_ID`, `OAUTH_CLIENT_SECRET` and `OPENID_PROVIDER_URL` (the well-known URL); the redirect path is then `/oauth/oidc/callback`. Only one OIDC provider can be active. Leave `OAUTH_MERGE_ACCOUNTS_BY_EMAIL` off unless your provider verifies email addresses, as the docs warn.

One thing that trips people up: with the default `ENABLE_OAUTH_PERSISTENT_CONFIG=false`, the OAuth section in the admin panel is read-only. Change `.env` and restart instead.

## Step 4: Sync roles and groups from the directory

Two switches make Open WebUI read roles and groups from the token at every sign-in. That removes manual upkeep, with one sharp edge: group membership is strictly synchronised, so memberships added by hand disappear when the group is missing from the token.

```bash
ENABLE_OAUTH_ROLE_MANAGEMENT=true
OAUTH_ROLES_CLAIM=roles
OAUTH_ALLOWED_ROLES=user,admin
OAUTH_ADMIN_ROLES=admin
ENABLE_OAUTH_GROUP_MANAGEMENT=true
OAUTH_GROUP_CLAIM=groups
ENABLE_OAUTH_GROUP_CREATION=true
OAUTH_GROUP_DEFAULT_SHARE=members
```

Behaviour documented on the [SSO page](https://docs.openwebui.com/features/authentication-access/auth/sso):

- If the roles claim contains values listed in neither `OAUTH_ALLOWED_ROLES` nor `OAUTH_ADMIN_ROLES`, sign-in is refused with a 403.
- An absent or empty groups claim leaves existing memberships untouched.
- Admin accounts are synchronised like everyone else; there is no exemption.
- Directory changes apply after the user signs out and back in.
- `OAUTH_GROUP_DEFAULT_SHARE=members` keeps auto-created groups out of everyone else's sharing menu.

Behind an authenticating reverse proxy you can pass groups in a header instead (`WEBUI_AUTH_TRUSTED_GROUPS_HEADER`). In that case nothing but the proxy may reach the container, or anyone can impersonate any user.

## Step 5: Grant models and knowledge bases to groups

Open WebUI has two layers of permissions. Feature permissions, such as file upload or web search, are switched on per group. Resource access, for individual models and knowledge bases, is granted per group as read or write. Permissions only add up; there is no deny.

The [groups documentation](https://docs.openwebui.com/features/authentication-access/rbac/groups) puts it plainly: a user in several groups gets the union of their permissions. A clean layout follows from that:

- **Permission groups** such as `P-WebSearch` or `P-Upload` grant features only and are hidden from sharing menus ("Who can share: No one").
- **Team groups** such as `Sales` or `Field Service` come from the directory, carry no feature permissions and exist to receive resource grants.
- **Global defaults** stay minimal. Switching a feature off there takes effect for everyone at once, unless a group switches it back on.

Set each model and knowledge base to **Private**, then add team groups with **Read** under **Access**. The docs describe **Write** as owner-equivalent, including deletion and onward sharing, so reserve it for whoever maintains the collection. A model with its own attached knowledge bases can only use those, not every collection the user could otherwise see. That lets Sales get a model grounded in price lists and product data sheets, while Field Service gets one built on service reports and inspection procedures.

Keep `BYPASS_MODEL_ACCESS_CONTROL` at its default of `false`; `true` shows every model to every user. To check the outcome, use **Preview Access** in the admin panel, which lists every model, knowledge base and tool a user or group can read.

## Step 6: Decide on chat history, admin visibility and retention

Open WebUI keeps every chat in its database until someone deletes it. As of November 2026 we found no built-in, time-based chat retention setting in the official documentation. That means retention is a decision you make explicitly: what gets stored, who can read it, and how it is removed.

The [privacy page](https://docs.openwebui.com/security/chat-data-privacy-and-encryption) and the [permissions reference](https://docs.openwebui.com/features/authentication-access/rbac/permissions) offer these controls:

- **Temporary chat:** grant "Allow Temporary Chat" plus "Enforce Temporary Chat" to a group and the server refuses to save their chats on every route, API included. This suits teams handling HR or health data. Tools left enabled on a model can still store data of their own.
- **Admin visibility:** `ENABLE_ADMIN_CHAT_ACCESS` defaults to `true`, so admins can open any chat. Setting it and `ENABLE_ADMIN_EXPORT` to `false` removes chats and exports from the interface. The docs are explicit that admins can still reach the data via the database, the host or custom functions.
- **User deletion:** "Allow Chat Delete" is on by default. Only turn it off if you have a duty to keep chats.
- **Account removal:** deleting a user deletes their chats as well, including deletions pushed through SCIM when someone leaves.
- **Logs:** `AUDIT_LOG_LEVEL=METADATA` records who did what and when, without chat content. `REQUEST_RESPONSE` writes content to the logs and needs its own approval.

A fixed period such as "delete chats after 90 days" needs a scheduled job of your own against the database or the API. Test it on a copy, and remember backups: a chat deleted from the live database still exists in older backups. The right periods depend on your jurisdiction and works agreements, so agree them with your data protection officer and, in Germany, the works council; this is orientation, not legal advice. Files removed from a knowledge base are deleted by default unless you set `ENABLE_KNOWLEDGE_FILE_RETENTION=true`.

## Step 7: Test sign-in, permissions and deletion

Test with two real test accounts from different groups, never with an admin account. By default, `BYPASS_ADMIN_ACCESS_CONTROL` lets admins see more than regular users, which spoils any permission test.

1. Sign in as test user A (group `Sales`). Does the account show role `user`, group `Sales`, with a readable name rather than an ID?
2. Check the model picker. Does A see only models granted to `Sales`?
3. Remove test user B from a group in the directory, sign out and back in. Is the membership gone in Open WebUI?
4. Sign in with an app role that is not allowed. Do you get the expected 403?
5. In a group with enforced temporary chat, hold a conversation, reload, and confirm it is not in the chat list.
6. Delete a test account and confirm in the database that its chats are gone.

## Running it safely

Day-to-day questions are mostly about updates, sessions and who holds admin rights. Keep the version pinned, read the release notes before each upgrade, and try new versions on a staging instance first. Updates, monitoring and ownership for the whole stack are covered in [operating self-hosted AI](https://www.ruebstudio.de/en/guides/local-ai/operating-self-hosted-ai).

- **Sessions:** without Redis, signing out does not invalidate the token; it stays valid until it expires, four weeks by default according to the [environment variable reference](https://docs.openwebui.com/reference/env-configuration). Shorten `JWT_EXPIRES_IN` or add Redis.
- **Admins:** treat every admin as able to read every chat, and keep the group to two or three people.
- **Backups:** encrypt database backups and set how long they are kept, because they contain every chat.
- **Model providers:** attach external cloud models only to groups whose data allows it; sensitive teams get local models only.

When is this the wrong design? If teams need hard trust boundaries, say executive board and wider staff, the Open WebUI docs recommend separate instances with separate databases and operators rather than group permissions inside one instance. How such a portal fits into a wider plan for [sovereign AI under your own control](https://www.ruebstudio.de/en/sovereign-ai) is an architecture question rather than an interface one.

## Next steps

With identity and permissions in place, the content becomes the main question: which knowledge bases each team needs and who keeps them current. After that come tools and agents that let Open WebUI reach internal systems.

- Create one model per team with a system prompt and attached knowledge base instead of exposing the bare base model.
- Write a short usage policy: which data may go into which model, what happens to chats, and who to ask.
- Review access every quarter with **Preview Access** and compare it against directory groups.
- If the model server struggles under load, the [LLM inference server overview](https://www.ruebstudio.de/en/guides/local-ai/llm-inference-servers-overview) lists the options.

## Frequently asked questions

### Does Open WebUI support more than one identity provider?

Only one OIDC provider can be set through OPENID_PROVIDER_URL. The docs point to a community workaround for running Microsoft and Google side by side, which is not officially supported.

### Why do my synced groups show up as long IDs?

Entra ID puts group object IDs into the groups claim by default. Display names only appear with cloud_displayname, which works only when groupMembershipClaims is set to ApplicationGroup.

### Can admins read everyone's chats?

By default, yes: ENABLE_ADMIN_CHAT_ACCESS is true. Setting it to false hides chats in the interface, but admins can still reach the data through the database, the host or custom functions.

### Can Open WebUI delete chats automatically after a set period?

As of November 2026 we found no built-in, time-based chat retention setting in the official documentation. Retention is handled through temporary chat, account deletion or a scheduled job of your own.

## Sources

- [Open WebUI Docs: SSO (OAuth, OIDC, Trusted Header)](https://docs.openwebui.com/features/authentication-access/auth/sso)
- [Open WebUI Docs: Groups](https://docs.openwebui.com/features/authentication-access/rbac/groups)
- [Open WebUI Docs: Permissions](https://docs.openwebui.com/features/authentication-access/rbac/permissions)
- [Open WebUI Docs: Roles](https://docs.openwebui.com/features/authentication-access/rbac/roles)
- [Open WebUI Docs: Chat Data Privacy & Encryption](https://docs.openwebui.com/security/chat-data-privacy-and-encryption)
- [Open WebUI Docs: Environment Variable Configuration](https://docs.openwebui.com/reference/env-configuration)
- [Open WebUI Docs: Quick Start](https://docs.openwebui.com/getting-started/quick-start)
- [Open WebUI Docs: Microsoft Entra ID Group Name Sync](https://docs.openwebui.com/tutorials/auth-sso/entra-group-name-sync)
- [Microsoft Learn: Configure optional claims](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims)
- [Open WebUI Release v0.13.0 (GitHub)](https://github.com/open-webui/open-webui/releases/tag/v0.13.0)
