Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
75bfa59
feat: add integrations (OIDC, connectors, notifications, admin, eval)…
etiquet Apr 18, 2026
dc01975
feat(myrag): init FastAPI skeleton + Dockerfile + docker-compose
etiquet Apr 18, 2026
825dc61
feat(myrag): add chunker with 4 strategies
etiquet Apr 18, 2026
98c34a4
feat(myrag): add OpenRAG client + ingest endpoint
etiquet Apr 18, 2026
8d3f7c3
feat(myrag): enrich chunk metadata for graph post-processing
etiquet Apr 18, 2026
eff7e9e
feat(myrag): add sensitivity metadata + article headers in chunks
etiquet Apr 18, 2026
56dbd6f
feat(myrag): async ingest with job tracking + progress endpoint
etiquet Apr 18, 2026
57ab687
fix(myrag): fix hierarchy regex — roman numerals only, no trailing words
etiquet Apr 18, 2026
702fb16
feat(myrag): add collection config + system prompt + async ingest tra…
etiquet Apr 18, 2026
d667a16
feat(myrag): improve default system prompt for article citation
etiquet Apr 18, 2026
15e269a
feat(myrag): prompt templates catalog — 7 builtin + custom admin temp…
etiquet Apr 18, 2026
c74f204
feat(myrag): add Keycloak admin client for group management
etiquet Apr 18, 2026
ad33559
feat(myrag): add sync service Keycloak → OpenRAG + sync router
etiquet Apr 18, 2026
f660f17
docs(myrag): update capitalisation — Phase 1 complete
etiquet Apr 18, 2026
365fa38
feat(myrag): add graph builder — NetworkX article reference graphs
etiquet Apr 18, 2026
ab5f0ad
feat(myrag): add graph API, Cytoscape.js viewer, article HTML views
etiquet Apr 18, 2026
2db89f0
feat(myrag): add OWUI tool (4 methods) + pipe filter #collection
etiquet Apr 18, 2026
f3cae01
fix(myrag): fix route ordering — templates before /{name} to avoid 404
etiquet Apr 18, 2026
35de27b
feat(myrag): build CESEDA graph — 2399 nodes, 9293 edges
etiquet Apr 18, 2026
e572961
fix(myrag): increase graph content preview from 200 to 2000 chars
etiquet Apr 18, 2026
edb15d9
fix(myrag): increase content preview to 10000 chars
etiquet Apr 18, 2026
8140bff
feat(myrag): AI summary for long articles + collection preferences
etiquet Apr 18, 2026
e665a8a
feat(myrag): add Legifrance PISTE client + sources router
etiquet Apr 18, 2026
ddcb772
feat(myrag): add K8s Scaleway manifests
etiquet Apr 18, 2026
a7f8997
feat(myrag): R1 — Q&R cache with fuzzy matching + import/export
etiquet Apr 18, 2026
4599f0e
feat(myrag): R2 — RAG evaluation with dataset + scoring + runs
etiquet Apr 18, 2026
371751c
feat(myrag): R3 — feedback system + OWUI outlet + promotion loop
etiquet Apr 18, 2026
7183b49
feat(myrag): add DSFR frontend — Nuxt 4 + vue-dsfr
etiquet Apr 19, 2026
8137710
feat(myrag-front): add service status indicators in header
etiquet Apr 19, 2026
01bddec
fix(myrag-front): fix DSFR CSS import — use css array instead of head…
etiquet Apr 19, 2026
8a3fbdf
feat(myrag-front): add Keycloak OIDC auth + beta badge
etiquet Apr 19, 2026
373663f
fix(myrag-front): use dedicated public PKCE client 'myrag-front'
etiquet Apr 19, 2026
1433f69
feat(myrag): publication lifecycle — publish/unpublish/archive
etiquet Apr 19, 2026
b81a2ed
feat(myrag): wizard 4-step creation + catalog with contacts + widget …
etiquet Apr 19, 2026
b34f155
fix(myrag-front): fix OIDC auth — dynamic import + error handling
etiquet Apr 19, 2026
1ae2fa6
fix(myrag-front): wizard navigation — breadcrumbs, subtitles, guard
etiquet Apr 19, 2026
e993af5
docs(myrag): add contextualized prompt for CESEDA import feature
etiquet Apr 19, 2026
f62f29b
docs(myrag): update prompt — source-first wizard, 6 connectors, full …
etiquet Apr 19, 2026
5dca989
feat(myrag): wizard 5-step source-first + BaseConnector + SourceConfig
etiquet Apr 19, 2026
dedae15
feat(myrag-front): catalog page + duplicate detection + contact owner
etiquet Apr 19, 2026
1512b41
feat(myrag-front): redesign 'Mes collections' — tiles + cards like ow…
etiquet Apr 19, 2026
446b235
chore(myrag-front): rename MyRAG → Mes collections
etiquet Apr 19, 2026
732ffda
chore(myrag-front): simplify footer description
etiquet Apr 19, 2026
7d641f4
chore(myrag-front): update lead text — gestionnaire perspective
etiquet Apr 19, 2026
b5f031f
fix(myrag-front): merge duplicate style attributes in WizardStepper
etiquet Apr 19, 2026
b695525
feat(myrag-front): grayed-out 'Bientot disponible' cards in source wi…
etiquet Apr 19, 2026
fcde907
feat(myrag-front): couple strategy + prompt into profiles
etiquet Apr 19, 2026
eb653f4
feat(myrag-front): AI summary requires graph + info tooltip
etiquet Apr 19, 2026
ac71849
fix(myrag-front): fix inline if in @change — use method instead
etiquet Apr 19, 2026
d5fb58d
fix(myrag-front): AI summary — hide when graph off, clarify in tooltip
etiquet Apr 19, 2026
a2fb943
fix(myrag-front): fix missing end tag — extra </div> removed
etiquet Apr 19, 2026
ddca1d9
feat(myrag-front): pre-fill contact from Keycloak session
etiquet Apr 19, 2026
04f0ccb
feat(myrag-front): name uniqueness check + suggestion + description hint
etiquet Apr 19, 2026
8e2a1c6
feat(myrag-front): scope groups + reorder options + label fixes
etiquet Apr 19, 2026
47c487a
fix(myrag-front): align Sensibilite and Portee dropdowns (flex-start)
etiquet Apr 19, 2026
d664784
feat(myrag-front): add hint + descriptions on sensitivity dropdown
etiquet Apr 19, 2026
2098614
chore(myrag-front): update sensitivity labels to ministry vocabulary
etiquet Apr 19, 2026
29bfc47
feat(myrag): R6.1 — add SQLAlchemy database schema (SQLite/PostgreSQL)
etiquet Apr 19, 2026
7e0fa23
feat(myrag): R6.2 — migrate collections and publications to SQLAlchem…
etiquet Apr 19, 2026
3629308
feat(myrag): R6.3+R7.1 — migrate jobs to DB + store source files
etiquet Apr 19, 2026
364f1d5
feat(myrag): R6.4 — migrate feedback to SQLAlchemy DB
etiquet Apr 19, 2026
36d1e69
feat(myrag): R7.2 — add reindex endpoint using stored source files
etiquet Apr 19, 2026
b671365
feat(myrag): R6+R7 complete — DB migration, source storage, reindex, UI
etiquet Apr 19, 2026
3c48d05
chore: remove integrations/ — moved to github.com/IA-Generative/mycol…
etiquet Apr 19, 2026
ad1ef94
fix(auth): detect HTTPS behind TLS-terminating reverse proxy
etiquet Apr 19, 2026
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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ docs/plans/
# Build artifacts
*.egg-info/

# PostgreSQL data directory
db/

# macOS
.DS_Store
**/.DS_Store
.AppleDouble
.LSOverride
._*
.Spotlight-V100
.Trashes

# Local developer overrides (not committed)
docker-compose.override.yaml
docker-compose.override.yml
164 changes: 164 additions & 0 deletions docs/content/docs/guides/openwebui-keycloak.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
title: Open WebUI + Keycloak + OpenRAG Integration
description: How to set up SSO authentication with Keycloak for Open WebUI and OpenRAG
---

This guide explains how to configure **Keycloak** as a shared identity provider for both **Open WebUI** (chat frontend) and **OpenRAG** (RAG backend), so that user identity and group-based partition access flow seamlessly from login to document retrieval.

## Architecture Overview

```mermaid
sequenceDiagram
participant U as User
participant KC as Keycloak
participant OWUI as Open WebUI
participant OR as OpenRAG

U->>KC: Login (OIDC)
KC-->>U: JWT (sub, email, groups)
U->>OWUI: Access chat
OWUI->>OR: Forward JWT (Authorization: Bearer)
OR->>OR: Validate JWT, sync group→partition memberships
OR-->>OWUI: RAG response (filtered by user partitions)
```

## 1. Keycloak Configuration

### Create a Client for OpenRAG

1. In your Keycloak realm, go to **Clients** > **Create client**
2. Set **Client ID** to `openrag` (this will be `OIDC_AUDIENCE`)
3. Set **Client authentication** to **On**
4. Set **Valid redirect URIs** to your Open WebUI URL (e.g., `https://chat.example.com/*`)
5. Note the **Client secret** from the Credentials tab

### Configure Group Claim Mapper

1. Go to **Client scopes** > **openrag-dedicated** > **Mappers** > **Create mapper**
2. Choose **Group Membership** mapper type
3. Set:
- **Name**: `groups`
- **Token Claim Name**: `groups`
- **Full group path**: ON
- **Add to ID token**: ON
- **Add to access token**: ON

### Create Groups

Create groups following this naming convention:

| Group path | OpenRAG role | Description |
|-----------|-------------|-------------|
| `/rag-query/<partition>` | viewer | Can search and view documents |
| `/rag-edit/<partition>` | editor | Can upload and manage files |
| `/rag-admin/<partition>` | owner | Full partition control |

Example groups:
- `/rag-query/finance` — Read access to the "finance" partition
- `/rag-edit/finance` — Upload files to "finance"
- `/rag-admin/hr` — Full control of the "hr" partition

Assign users to the appropriate groups.

## 2. Open WebUI Configuration

Set these environment variables in your Open WebUI deployment:

```bash
# Enable OAuth/OIDC
ENABLE_OAUTH_SIGNUP=true
OAUTH_CLIENT_ID=openrag
OAUTH_CLIENT_SECRET=<your-client-secret>
OPENID_PROVIDER_URL=https://keycloak.example.com/realms/myrealm/.well-known/openid-configuration

# Forward the user's JWT to backend APIs
ENABLE_FORWARD_OAUTH_TOKEN=true

# OpenRAG as OpenAI-compatible backend
OPENAI_API_BASE_URL=https://openrag.example.com/v1
OPENAI_API_KEY=unused # JWT is forwarded instead
```

With `ENABLE_FORWARD_OAUTH_TOKEN=true`, Open WebUI sends the user's Keycloak JWT as the `Authorization: Bearer` header to OpenRAG, instead of a static API key.

## 3. OpenRAG Configuration

Set these environment variables:

```bash
# Switch to OIDC mode
AUTH_MODE=oidc

# Keycloak OIDC settings
OIDC_ISSUER_URL=https://keycloak.example.com/realms/myrealm
OIDC_AUDIENCE=openrag
OIDC_JWKS_CACHE_TTL=3600
OIDC_GROUP_CLAIM=groups
OIDC_AUTO_PROVISION=true

# Group prefix mapping (defaults shown)
OIDC_GROUP_PREFIX_VIEWER=rag-query/
OIDC_GROUP_PREFIX_EDITOR=rag-edit/
OIDC_GROUP_PREFIX_OWNER=rag-admin/

# Sync mode: "additive" (default) or "authoritative"
OIDC_GROUP_SYNC_MODE=additive
```

### Sync Modes

- **Additive** (default): Adds missing partition memberships from Keycloak groups. Never removes existing memberships. Upgrades roles when the JWT grants a higher role, but never downgrades.

- **Authoritative**: Fully syncs OIDC-sourced memberships. Memberships created via Keycloak are added/updated/removed to match the JWT groups exactly. Manually-created memberships (via the API) are never touched.

## 4. How It Works

1. User logs into Open WebUI via Keycloak SSO
2. User sends a chat message in Open WebUI
3. Open WebUI forwards the request to OpenRAG's `/v1/chat/completions` with the user's JWT
4. OpenRAG's AuthMiddleware:
- Validates the JWT signature against Keycloak's JWKS
- Extracts `sub`, `email`, `groups` claims
- Auto-provisions the user if first login
- Syncs Keycloak groups to partition memberships
5. OpenRAG resolves accessible partitions and executes the RAG pipeline
6. Response is filtered to only include sources from authorized partitions

## 5. Verifying the Setup

### Check JWT Contents

Decode a Keycloak token to verify the groups claim:

```bash
# Get a token
TOKEN=$(curl -s -X POST \
"https://keycloak.example.com/realms/myrealm/protocol/openid-connect/token" \
-d "grant_type=password&client_id=openrag&client_secret=SECRET&username=user&password=pass" \
| jq -r '.access_token')

# Decode payload
echo $TOKEN | cut -d'.' -f2 | base64 -d 2>/dev/null | jq '.groups'
```

Expected output:
```json
["/rag-query/finance", "/rag-edit/legal"]
```

### Test OpenRAG Directly

```bash
curl -H "Authorization: Bearer $TOKEN" https://openrag.example.com/v1/models
```

Should return only the models (partitions) the user has access to.

## Troubleshooting

| Problem | Solution |
|---------|----------|
| 403 "Missing token" | Verify `ENABLE_FORWARD_OAUTH_TOKEN=true` in Open WebUI |
| 401 "Token has expired" | Check clock sync between servers and token lifetimes in Keycloak |
| User has no partitions | Verify the `groups` claim is present in the JWT and matches the prefix convention |
| 503 "Failed to fetch JWKS" | Check that OpenRAG can reach the Keycloak server at `OIDC_ISSUER_URL` |
Empty file added openrag/auth/__init__.py
Empty file.
Loading