idp angepasst

This commit is contained in:
Bastian Wagner
2026-07-15 16:59:17 +02:00
parent 0dfba43aa6
commit fadb5dd049
59 changed files with 1954 additions and 367 deletions

View File

@@ -60,17 +60,21 @@ Configure the external MCP connector with `Authorization: Bearer $MCP_ACCESS_TOK
Every Mistral response is stored in `assistant_chat_logs`. The table includes the sanitized provider request, the full raw provider response, the extracted assistant text sent back to the UI, response status and timing metadata.
## SSO mit Keycloak
## SSO mit OIDC
Listify nutzt OpenID Connect mit Authorization Code + PKCE. Bei Keycloak muss der Issuer immer auf den Realm zeigen, nicht nur auf die Basisdomain.
Listify nutzt OpenID Connect mit Authorization Code Flow und PKCE (`S256`). Die Discovery-URL wird automatisch aus dem Issuer gebildet:
### Keycloak Client
```text
{OIDC_ISSUER}/.well-known/openid-configuration
```
1. In Keycloak im passenden Realm einen OpenID-Connect-Client fuer Listify anlegen, z. B. `listify`.
2. `Standard flow` aktivieren. PKCE mit `S256` erlauben oder erzwingen.
3. Scopes `openid`, `email` und `profile` verfuegbar machen.
4. Der User muss ein `email` Claim im ID Token erhalten. Ohne E-Mail lehnt Listify den Login ab.
5. Redirect URI fuer die Browser-URL eintragen:
### LDAP-Portal Client
1. Im LDAP-Portal unter `/admin/oidc-clients` einen Client fuer Listify registrieren.
2. Authorization Code Flow mit PKCE aktivieren. Dynamic Client Registration wird nicht verwendet.
3. Scopes `openid profile email groups` erlauben. Fuer Refresh Tokens optional `offline_access` ergaenzen.
4. Der Client muss `sub`, `preferred_username`, `email`, `name`, `given_name`, `family_name` und bei Scope `groups` den Claim `groups` erhalten.
5. Redirect URI registrieren:
```text
http://localhost:4200/auth/sso/callback
@@ -84,30 +88,43 @@ http://localhost:8080/auth/sso/callback
In Produktion muss hier die oeffentlich erreichbare Listify-URL stehen, z. B. `https://listify.example.com/auth/sso/callback`.
6. Post-Logout Redirect URI registrieren:
```text
http://localhost:4200/login
```
Bei Docker/Reverse Proxy:
```text
http://localhost:8080/login
```
### Listify Environment
Bei einem Keycloak-Realm `listify` unter `https://auth.forgecore.work`:
```bash
OIDC_ISSUER_URL=https://auth.forgecore.work/realms/listify
OIDC_DISCOVERY_URL=
OIDC_CLIENT_ID=listify
OIDC_CLIENT_SECRET=<keycloak-client-secret>
OIDC_CALLBACK_URL=http://localhost:4200/auth/sso/callback
OIDC_ISSUER=https://id.example.com
OIDC_CLIENT_ID=<client-id-aus-admin-oidc-clients>
OIDC_CLIENT_SECRET=<client-secret-aus-admin-oidc-clients>
OIDC_SCOPES=openid profile email groups
OIDC_REDIRECT_URI=http://localhost:4200/auth/sso/callback
OIDC_POST_LOGOUT_REDIRECT_URI=http://localhost:4200/login
CLIENT_URL=http://localhost:4200
```
Wenn dein Realm anders heisst, muss nur der Realm-Teil angepasst werden. Die Discovery-URL wird automatisch aus dem Issuer gebildet:
Das ID Token wird per JWKS validiert. Das Access Token des LDAP-Portals ist opaque; Listify validiert es ueber `/oidc/token/introspection` und ruft danach `/oidc/me` mit `Authorization: Bearer <access_token>` fuer UserInfo auf.
```text
https://auth.forgecore.work/realms/<realm>/.well-known/openid-configuration
```
Nur falls Keycloak hinter einem Proxy eine abweichende Discovery-URL liefert oder du sie explizit setzen willst:
Wenn die Introspection-Antwort eine andere Access-Token-Audience als die Client-ID enthaelt, kann sie explizit gesetzt werden:
```bash
OIDC_ISSUER_URL=https://auth.forgecore.work/realms/listify
OIDC_DISCOVERY_URL=https://auth.forgecore.work/realms/listify/.well-known/openid-configuration
OIDC_ACCESS_TOKEN_AUDIENCE=<expected-access-token-audience>
```
Gruppen werden aus dem Claim `groups` gelesen und lokal auf App-Rollen gemappt. Das Mapping ist zentral in `oidc_group_role_mappings` konfigurierbar, z. B.:
```sql
INSERT INTO oidc_group_role_mappings (id, groupPath, role, enabled)
VALUES (UUID(), '/teams/admins', 'app_admin', 1);
```
## Run tests