|
8 | 8 | * [Java 11](#java-11) |
9 | 9 | * [Postgres Database](#postgres-database) |
10 | 10 | * [SORMAS Server](#sormas-server) |
| 11 | +* [Keycloak Server](#keycloak-server) |
11 | 12 | * [Web Server Setup](#web-server-setup) |
12 | 13 | * [Apache Web Server](#apache-web-server) |
13 | 14 | * [Firewall](#firewall) |
|
18 | 19 |
|
19 | 20 | ## Related |
20 | 21 | * [Creating an App for a Demo Server](DEMO_APP.md) |
| 22 | +* [SORMAS Docker Repository](https://github.com/hzi-braunschweig/SORMAS-Docker) |
21 | 23 |
|
22 | 24 | ## Prerequisites |
23 | 25 |
|
|
71 | 73 | * Adjust the logging configuration in ``/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender) |
72 | 74 | * Linux: [Update the SORMAS domain](SERVER_UPDATE.md) |
73 | 75 |
|
| 76 | +## Keycloak Server |
| 77 | + |
| 78 | +By default Keycloak is run as a Docker container, which can be set up in two ways: |
| 79 | +* As a Docker container |
| 80 | +* As a Standalone installation |
| 81 | + |
| 82 | +### Keycloak as a Docker container |
| 83 | +*To be done only in the situation when SORMAS is already installed on the machine as a standalone installation.* |
| 84 | + |
| 85 | +*For complete Docker setup see the [SORMAS-Docker](https://github.com/hzi-braunschweig/SORMAS-Docker/tree/keycloak-integration) repository.* |
| 86 | + |
| 87 | +**Prerequisites** |
| 88 | +* SORMAS Server is installed |
| 89 | +* PostgreSQL is installed |
| 90 | +* Docker is installed |
| 91 | +* Open and edit [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh) with your system's actual values |
| 92 | + |
| 93 | +**Setup** |
| 94 | +* Run [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh) |
| 95 | +* Update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK` |
| 96 | + |
| 97 | + |
| 98 | +### Keycloak as a standalone installation |
| 99 | + |
| 100 | +**Prerequisites** |
| 101 | +* SORMAS Server is installed |
| 102 | +* PostgreSQL is installed |
| 103 | + |
| 104 | +**Setup** |
| 105 | + |
| 106 | +Setting Keycloak up as a standalone installation [Server Installation and Configuration Guide](https://www.keycloak.org/docs/11.0/server_installation/#installation) |
| 107 | +* Make sure to configure Keycloak with PostgreSQL Database [Relational Database Setup](https://www.keycloak.org/docs/11.0/server_installation/#_database) |
| 108 | +* Setup an Admin User |
| 109 | +* Copy the `themes` folder content to `${KEYCLOAK_HOME}/themes` [Deploying Themes](https://www.keycloak.org/docs/11.0/server_development/#deploying-themes) |
| 110 | +* Create the SORMAS Realm by importing [SORMAS.json](sormas-base/setup/keycloak/SORMAS.json) see [Create a New Realm](https://www.keycloak.org/docs/11.0/server_admin/#_create-realm) |
| 111 | +* Update the `sormas-*` clients by generating new secrets for them |
| 112 | +* Update the realm's email settings to allow sending emails to users |
| 113 | + |
| 114 | +To update the SORMAS Server run the following commands |
| 115 | +```shell script |
| 116 | +${ASADMIN} set-config-property --propertyName=payara.security.openid.clientSecret --propertyValue=${KEYCLOAK_SORMAS_UI_SECRET} --source=domain |
| 117 | +${ASADMIN} set-config-property --propertyName=payara.security.openid.clientId --propertyValue=sormas-ui --source=domain |
| 118 | +${ASADMIN} set-config-property --propertyName=payara.security.openid.scope --propertyValue=openid --source=domain |
| 119 | +${ASADMIN} set-config-property --propertyName=payara.security.openid.providerURI --propertyValue=http://localhost:${KEYCLOAK_PORT}/keycloak/auth/realms/SORMAS --source=domain |
| 120 | +${ASADMIN} set-config-property --propertyName=sormas.rest.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth\",\"ssl-required\":\"external\",\"resource\":\"sormas-rest\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_REST_SECRET}\"},\"confidential-port\":0,\"principal-attribute\":\"preferred_username\",\"enable-basic-auth\":true}" --source=domain |
| 121 | +${ASADMIN} set-config-property --propertyName=sormas.backend.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth/\",\"ssl-required\":\"external\",\"resource\":\"sormas-backend\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_BACKEND_SECRET}\"},\"confidential-port\":0}" --source=domain |
| 122 | +``` |
| 123 | +where: |
| 124 | +* `${ASADMIN}` - represents the location to `${PAYARA_HOME}\bin\asadmin` |
| 125 | +* `${KEYCLOAK_PORT}` - the port on which keycloak will run |
| 126 | +* `${KEYCLOAK_SORMAS_UI_SECRET}` - is the secret generated in Keycloak for the `sormas-ui` client |
| 127 | +* `${KEYCLOAK_SORMAS_REST_SECRET}` - is the secret generated in Keycloack for the `sormas-rest` client |
| 128 | +* `${KEYCLOAK_SORMAS_BACKEND_SECRET}` - is the secret generated in Keycloack for the `sormas-backend` client |
| 129 | + |
| 130 | +Then update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK` |
| 131 | + |
74 | 132 | ## Web Server Setup |
75 | 133 |
|
76 | 134 | ### Apache Web Server |
|
0 commit comments