# Wiki.js: Zugang (wiki.axion1337.chat) + Authentik-OIDC **Status**: vorbereitet, **nicht** ausgerollt · gehört zu #0048 (Ingress/Cert) und #0049 (OIDC) · **löst den Forward-Auth-Zwischenstand aus Guide 09 ab** (der war nur für das statische Docusaurus nötig) ## Wie das Wiki aufgerufen wird **Anwender und Admin öffnen dieselbe URL: `https://wiki.axion1337.chat`.** Wiki.js zeigt seine eigene Login-Seite → „Login with Authentik" → Redirect zu `auth.axion1337.chat` → zurück. **Natives OIDC, kein Forward-Auth/Outpost** — Wiki.js authentifiziert selbst. Nach dem Login entscheidet die Authentik-Gruppe über Sicht und Bearbeiten (Rollen/Abschottung, #0049). Öffentlich wie der Rest der Plattform; Abschottung über Login + Rolle, nicht übers Netz. ## Teil 1 — Ingress + Zertifikat (`apps/production/wiki-ingress.yaml`) Muster: `apps/authentik/certificate.yaml` + `apps/authentik/ingress.yaml`. Namespace = der der Wiki.js-Deployment (#0048); hier als `matrix` angenommen. Service-Name/Port (`wikijs:3000`) müssen zum Deployment passen. ```yaml apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: wiki-axion1337-chat-cert namespace: matrix spec: secretName: wiki-axion1337-chat-tls issuerRef: name: letsencrypt-prod kind: ClusterIssuer dnsNames: - wiki.axion1337.chat --- apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: name: wikijs namespace: matrix spec: entryPoints: [websecure] tls: secretName: wiki-axion1337-chat-tls routes: - match: Host(`wiki.axion1337.chat`) kind: Rule services: - name: wikijs port: 3000 ``` Neue Datei in die Kustomization des `production`-Ordners aufnehmen. DNS: A-Record `wiki.axion1337.chat → 49.13.132.245` ist von sorb angelegt (Propagation läuft). ## Teil 2 — Authentik-OIDC-Provider (Blueprint) Als Dokument in `apps/authentik/authentik-blueprints.yaml`, Muster wie `matrix-oidc-provider`. **Bewusst eigener Name/Slug** (`wiki-js`), damit es **parallel** zum Guide-09-Proxy-Provider „ThreadNet Wiki"/App `wiki` läuft; beim Umschalten auf die Suite werden die Guide-09-Objekte (Proxy-Provider, App `wiki`, Outpost, ggf. Gruppe `wiki-zugang`) **stillgelegt**. ```yaml wiki-oidc-provider.yaml: | # yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json version: 1 metadata: name: wiki-oidc-provider labels: blueprints.goauthentik.io/instantiate: "true" entries: - model: authentik_providers_oauth2.oauth2provider state: present identifiers: name: ThreadNet Wiki (Wiki.js) id: wiki_oidc_provider attrs: client_type: confidential client_id: !Env AUTHENTIK_WIKI_OIDC_CLIENT_ID client_secret: !Env AUTHENTIK_WIKI_OIDC_CLIENT_SECRET # Aus Wiki.js übernehmen (Teil 3 zeigt die Callback-URL nach Anlegen # der Strategy). Erst danach hier eintragen: redirect_uris: - matching_mode: strict url: https://wiki.axion1337.chat/login/PROVIDERKEY/callback sub_mode: hashed_user_id include_claims_in_id_token: true authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]] invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]] property_mappings: - !Find [authentik_core.propertymapping, [managed, "goauthentik.io/providers/oauth2/scope-openid"]] - !Find [authentik_core.propertymapping, [managed, "goauthentik.io/providers/oauth2/scope-email"]] - !Find [authentik_core.propertymapping, [managed, "goauthentik.io/providers/oauth2/scope-profile"]] # + Gruppen-Claim: entweder das mitgelieferte Groups-Scope-Mapping # (falls vorhanden) oder ein eigenes Scope-Mapping, das "groups" # zurückgibt — nötig für Rollen/Abschottung (#0049). - model: authentik_core.application state: present identifiers: slug: wiki-js attrs: name: ThreadNet Wiki provider: !KeyOf wiki_oidc_provider meta_description: Internes Wiki (Betrieb/Anwender), Zugriff nach Gruppe policy_engine_mode: any open_in_new_tab: false ``` `client_id`/`client_secret` sind Credentials → in die `authentik-credentials`- Secret (wie `AUTHENTIK_MAS_OIDC_CLIENT_SECRET`), **nicht** in die ConfigMap. Der ConfigMap-Blueprint liest sie per `!Env`. ## Teil 3 — Wiki.js-Seite (Authentication → OpenID Connect) In Wiki.js *Administration → Authentication → + OpenID Connect*: - **Client ID / Client Secret**: dieselben Werte wie in Teil 2. - **Authorization Endpoint URL**: `https://auth.axion1337.chat/application/o/authorize/` - **Token Endpoint URL**: `https://auth.axion1337.chat/application/o/token/` - **User Info Endpoint URL**: `https://auth.axion1337.chat/application/o/userinfo/` - **Issuer**: `https://auth.axion1337.chat/application/o/wiki-js/` - **Logout URL**: `https://auth.axion1337.chat/application/o/wiki-js/end-session/` - **Scopes**: `openid email profile` (+ das Groups-Scope aus Teil 2). - **Groups Claim**: `groups` → auf Wiki.js-Gruppen/Rollen mappen (Admin schreibt, Anwender read-only, Betrieb/Anwender abgeschottet — #0049). ⚠️ **Reihenfolge:** Wiki.js zeigt beim Anlegen der Strategy die **Callback-URL** (`https://wiki.axion1337.chat/login//callback`). Diese `` in die `redirect_uris` von Teil 2 eintragen — vorher passt die Umleitung nicht. ## Reihenfolge / Abhängigkeiten 1. Wiki.js-Deployment + Service `wikijs` (#0048) — sonst zeigt die IngressRoute ins Leere. 2. Ingress + Cert (Teil 1) — Cert wird erst ausgestellt, wenn der ACME-Challenge über den Ingress erreichbar ist. 3. OIDC (Teil 2/3) — Callback-URL aus Wiki.js, dann Blueprint scharf. 4. Rollen/Abschottung + Gruppen (#0049) — Gruppen legt sorb an. ## Braucht sorb - **OIDC Client-ID + Secret** (Credential; in `authentik-credentials`). - **Authentik-Gruppen** für #0049 (Admin/Betrieb/Anwender). - Beim Cutover: die **Guide-09-Objekte stilllegen** (Proxy-Provider „ThreadNet Wiki", App `wiki`, Outpost `wiki-forward-auth`). ## Verifikation 1. `dig wiki.axion1337.chat` → `49.13.132.245`. 2. `curl -sI https://wiki.axion1337.chat` → 200/302 (nicht Cert-Fehler). 3. Aufruf → Wiki.js-Login → „Login with Authentik" → `auth.axion1337.chat` → zurück, eingeloggt. 4. **Admin**: editieren, sieht Betrieb + Anwender. **Anwender**: read-only, `/betrieb` nicht in Navigation/Suche.