2.2 KiB
2.2 KiB
Keycloak Setup für r/place
Keycloak Installation
Docker (Empfohlen)
docker run -d \
--name keycloak \
-p 8080:8080 \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=admin \
quay.io/keycloak/keycloak:latest \
start-dev
Standalone Installation
- Lade Keycloak von https://www.keycloak.org/downloads herunter
- Entpacke das Archiv
- Starte Keycloak:
bin/kc.sh start-dev
Konfiguration
1. Admin Console öffnen
Gehe zu http://localhost:8080/admin und melde dich mit admin/admin an.
2. Realm erstellen
- Klicke auf "Create Realm"
- Name:
rplace - Klicke "Create"
3. Client erstellen
- Gehe zu "Clients" → "Create client"
- Client ID:
rplace-client - Client type:
OpenID Connect - Klicke "Next"
- Client authentication:
OFF(Public client) - Standard flow:
ON - Direct access grants:
ON - Klicke "Save"
4. Client Settings
- Gehe zu deinem Client
rplace-client - Settings Tab:
- Valid redirect URIs:
http://localhost:5000/* - Valid post logout redirect URIs:
http://localhost:5000/* - Web origins:
http://localhost:5000
- Valid redirect URIs:
- Klicke "Save"
5. Test User erstellen
- Gehe zu "Users" → "Add user"
- Username:
testuser - Klicke "Create"
- Gehe zum "Credentials" Tab
- Setze ein Passwort und deaktiviere "Temporary"
r/place Konfiguration
Bearbeite config.cfg:
ENABLE_KEYCLOAK=true
KEYCLOAK_REALM=rplace
KEYCLOAK_AUTH_URL=http://localhost:8080
KEYCLOAK_CLIENT_ID=rplace-client
Erweiterte Konfiguration
HTTPS (Produktion)
Für Produktionsumgebungen:
KEYCLOAK_AUTH_URL=https://dein-keycloak-server.de
Benutzer-Attribute
Du kannst zusätzliche Benutzerattribute in Keycloak konfigurieren:
- Gehe zu "Client scopes"
- Bearbeite "profile" scope
- Füge Mappers für zusätzliche Attribute hinzu
Sicherheit
- Ändere Admin-Passwort
- Konfiguriere SSL/TLS
- Setze starke Passwort-Richtlinien
- Aktiviere Brute-Force-Schutz
Fehlerbehebung
CORS-Probleme
Stelle sicher, dass die Web origins korrekt konfiguriert sind.
Token-Probleme
Überprüfe die Client-Konfiguration und Redirect-URIs.
Verbindungsprobleme
Stelle sicher, dass Keycloak erreichbar ist und die URLs korrekt sind.