4 Home
Thomas Rother edited this page 9 months ago

Keycloak Basis Dokumentation

Keycloak 18 = Quarkus (aktuell)

Keycloak 17 Wildfly (deprecated).

Weitere Doku:

Setup mit Quarkus

Setzen des Admin/PW für den Master Realm über envrironment variablen vor dem ersten Start. Die Variable wird dann in die Postgres DB rein geschrieben. Weitere Administration danach über das Web UI oder per kcadm.sh

Umgebungsvariablen setzen

root@kc1:/opt/keycloak# export KEYCLOAK_ADMIN=admin
root@kc1:/opt/keycloak# export KEYCLOAK_ADMIN_PASSWORD=xxxx

Test & Start

root@kc1:/opt/keycloak# echo $KEYCLOAK_ADMIN
root@kc1:/opt/keycloak# echo $KEYCLOAK_ADMIN_PASSWORD                         
root@kc1:/opt/keycloak# ./bin/kc.sh start

https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-environment-variables-in-linux/

Keycloak behind load balancer

https://www.keycloak.org/docs/latest/server_installation/#_setting-up-a-load-balancer-or-proxy

Mit Haproxy: Config proxy=edge. In Haproxy muss X-Forwarded-For gesetzt sein:

backend login-backend
   option forwardfor
   server login.netzwissen.de 10.10.10.20:8080 check verify none
   http-request set-header X-Forwarded-Port %[dst_port]
   http-request add-header X-Forwarded-Proto https if { ssl_fc }
   http-request add-header X-Forwarded-For %[src]
   ## HSTS header, 16000000 seconds: a bit more than 6 months
   http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"

Keycloak connected to Postgresql

https://www.tutorialsbuddy.com/keycloak-postgresql-setup

Wichtig: Die Keycloak DB braucht UTF8 encoding, nicht den SQL_ASCII Standard. Siehe postgres

Server Development (REST API und Themes)

https://www.keycloak.org/docs/latest/server_development/

Lokal starten zur Entwicklung

/bin/kc.sh start.dev

Danach horcht die lokale JVM auf http://localhost:8080/

Keycloak Konfiguration im Realm

Setup eines Realm

https://wjw465150.gitbooks.io/keycloak-documentation/content/server_admin/topics/realms/create.html

https://www.keycloak.org/docs/latest/server_admin/

User Self Registration

Andocken des Google IDP

https://keycloakthemes.com/blog/how-to-setup-sign-in-with-google-using-keycloak

Logging

https://www.keycloak.org/server/logging