Sample project to setup an environment with Keycloak
This is my personal research project, I may document it later.
Docker Installation
Pull the project to your development machine.
Create Docker Networks from create_network.sh file. Either run it directly (Linux only) or execute the docker commands in the file manually.
Open a shell inside the root folder and start up docker containers with:
docker-compose up &
Open http://localhost
in your browser.
You will find a simple page with three links:
http://localhost/public
http://localhost/private
http://localhost/auth
Open http://localhost/public
and you will see the public page.
Open http://localhost/private
and you will see the private page... NOT! Instead you'll should see a Keycloak login page and only after login you will see the private page. On the first run you will see an Keycloak error page, because the Keycloak client is not configured yet.
Open http://localhost/auth
and you will see the Welcome to Keycloak page.
This are the Keycloak credentials for the administrative user:
- Username: admin
- Password: admin
Well, I might document this later, but in the End there should be an client privateapp_client and the client secret has to be set in reverseproxy/conf/reverseproxy.conf
file as OIDCClientSecret
.
You can create a user or enable self registration.
Setup a docker environment with three Apache HTTPD servers:
- Public Pages
- Private Pages
- Reverse Proxy
Add Keycloak with a PostgreSQL database to the setup.
I figured out one way to configure Keycloak as needed for my setup (create a client with self registration etc.). Added Module Auth-OpenIDC (libapache2-mod-auth-openidc) to Reverse Proxy and configured it to run with the configured Keycloak client. Unfortunatly I cannot add this Keycloak configuration to this project by now.
Replace Private Server Apache HTTPD with an Apache Tomcat server. On Tomcat server an application is installed to show all HTTP headers send from reverse proxy to private server.