Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit b515dbd

Browse files
lgallgal
authored andcommitted
Merge remote-tracking branch 'remotes/origin/development' into 2624_sormas-to-sormas-rest-endpoints
# Conflicts: # sormas-api/src/main/java/de/symeda/sormas/api/ConfigFacade.java # sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java # sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseIndexDto.java # sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java # sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleIndexDto.java # sormas-api/src/main/java/de/symeda/sormas/api/symptoms/SymptomsDto.java # sormas-app/app/src/main/java/de/symeda/sormas/app/backend/caze/Case.java # sormas-app/app/src/main/java/de/symeda/sormas/app/backend/caze/CaseDtoHelper.java # sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java # sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditFragment.java # sormas-app/app/src/main/java/de/symeda/sormas/app/component/dialog/LocationDialog.java # sormas-app/app/src/main/java/de/symeda/sormas/app/contact/edit/ContactEditFragment.java # sormas-app/app/src/main/java/de/symeda/sormas/app/person/edit/PersonEditFragment.java # sormas-app/app/src/main/java/de/symeda/sormas/app/person/read/PersonReadFragment.java # sormas-backend/src/main/java/de/symeda/sormas/backend/caze/Case.java # sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java # sormas-backend/src/main/java/de/symeda/sormas/backend/common/ConfigFacadeEjb.java # sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java # sormas-backend/src/main/java/de/symeda/sormas/backend/sormas2sormas/ServerAccessDataFacadeEjb.java # sormas-backend/src/main/resources/sql/sormas_schema.sql # sormas-rest/src/main/webapp/WEB-INF/web.xml # sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataView.java # sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseFilterForm.java # sormas-ui/src/main/java/de/symeda/sormas/ui/clinicalcourse/ClinicalCourseView.java # sormas-ui/src/main/java/de/symeda/sormas/ui/contact/ContactDataView.java # sormas-ui/src/main/java/de/symeda/sormas/ui/contact/ContactPersonView.java # sormas-ui/src/main/java/de/symeda/sormas/ui/events/EventDataView.java # sormas-ui/src/main/java/de/symeda/sormas/ui/events/EventParticipantEditForm.java # sormas-ui/src/main/java/de/symeda/sormas/ui/location/LocationEditForm.java # sormas-ui/src/main/java/de/symeda/sormas/ui/person/PersonController.java # sormas-ui/src/main/java/de/symeda/sormas/ui/person/PersonEditForm.java # sormas-ui/src/main/java/de/symeda/sormas/ui/samples/SampleDataView.java
2 parents b39bf4b + 47b2332 commit b515dbd

616 files changed

Lines changed: 20070 additions & 3269 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ If you've never submitted an issue to the SORMAS repository before or this is yo
2424
* Device:
2525
* SORMAS version:
2626
* Android version/Browser:
27+
* Server URL:
28+
* User Role:
2729

2830
### Additional Information

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ deploy
2323
/sormas-app/java_pid21052.hprof
2424
bin
2525
/sormas-base/setup/setup.log
26+
/sormas-cargoserver/.env
27+
/sormas-cargoserver/custom.env
28+
/sormas-cargoserver/custom.properties

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ language: java
22
jdk:
33
- openjdk8 # FIXME remove after transition period (#2617)
44
- openjdk11
5-
before_install: cd sormas-base
6-
install: mvn test -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
5+
before_install:
6+
- cd sormas-base
7+
install: skip
8+
script:
9+
- mvn install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

DEVELOPMENT_ENVIRONMENT.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# SORMAS Development Environment
33

44
## Server
5-
- Install [your local server](SERVER_SETUP.md).
5+
- Install [your local server](SERVER_SETUP.md)
6+
- Or install your local development server using [maven cargo](sormas-cargoserver/README.md)
67
- Alternatively [SERVER_DEV_SETUP.md](SERVER_DEV_SETUP.md) could be used (at this time not recommended)
78

89
## Git

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Please [create a new issue](https://github.com/hzi-braunschweig/SORMAS-Project/i
2525
#### Which Browsers and Android Versions Are Supported?
2626
SORMAS officially supports and is tested on **Chromium-based browsers** (like Google Chrome) and **Mozilla Firefox**, and all Android versions starting from **Android 7.0** (Nougat). In principle, SORMAS should be usable with all web browsers that are supported by Vaadin 8 (Chrome, Firefox, Safari, Edge, Internet Explorer 11; see https://vaadin.com/faq).
2727

28+
#### Is there a ReST API documentation?
29+
Yes! Please download the [latest release](https://github.com/hzi-braunschweig/SORMAS-Project/releases/latest) and copy the content of /deploy/openapi/sormas-rest.yaml to an editor that generates a visual API documentation (e.g. https://editor.swagger.io/).
30+
2831
<p align="center"><img src="https://user-images.githubusercontent.com/23701005/74659600-ebb8fc00-5194-11ea-836b-a7ca9d682301.png"/></p>
2932

3033
## Project Structure
@@ -37,6 +40,8 @@ The project consists of the following modules:
3740
- **sormas-ear:** The ear needed to build the application
3841
- **sormas-rest:** The REST interface; see [`sormas-rest/README.md`](sormas-rest/README.md)
3942
- **sormas-ui:** The web application
43+
- **sormas-base/dependencies:** dependencies to be deployed with the payara server
44+
- **sormas-cargoserver:** setup for a local dev server using maven-cargo
4045

4146
## Server Management
4247

SERVER_DEV_SETUP.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Other steps :
4444
* Adjust the logging configuration in ``${HOME}/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
4545
* Build and deploy applications (ear and war) with you IDE.
4646

47+
## Keycloak
48+
49+
See [Keycloak](SERVER_SETUP.md#keycloak-server) for how to install Docker locally.
50+
51+
If you are doing active development on Keycloak (themes, authentication mechanisms, translations, etc.) it's recommended to install the standalone variant.
52+
4753

4854
## Other components
4955

SERVER_SETUP.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Java 11](#java-11)
99
* [Postgres Database](#postgres-database)
1010
* [SORMAS Server](#sormas-server)
11+
* [Keycloak Server](#keycloak-server)
1112
* [Web Server Setup](#web-server-setup)
1213
* [Apache Web Server](#apache-web-server)
1314
* [Firewall](#firewall)
@@ -18,6 +19,7 @@
1819

1920
## Related
2021
* [Creating an App for a Demo Server](DEMO_APP.md)
22+
* [SORMAS Docker Repository](https://github.com/hzi-braunschweig/SORMAS-Docker)
2123

2224
## Prerequisites
2325

@@ -71,6 +73,62 @@
7173
* Adjust the logging configuration in ``/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
7274
* Linux: [Update the SORMAS domain](SERVER_UPDATE.md)
7375

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+
74132
## Web Server Setup
75133

76134
### Apache Web Server

sormas-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<groupId>de.symeda.sormas</groupId>
44
<artifactId>sormas-base</artifactId>
5-
<version>1.49.0-SNAPSHOT</version>
5+
<version>1.50.0-SNAPSHOT</version>
66
<relativePath>../sormas-base</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package de.symeda.sormas.api;
20+
21+
/**
22+
* Authentication provider which can be obtained trough the {@link ConfigFacade#getAuthenticationProvider()} property.
23+
*
24+
* @author Alex Vidrean
25+
* @since 13-Aug-20
26+
*/
27+
public class AuthProvider {
28+
29+
public static final String KEYCLOAK = "KEYCLOAK";
30+
31+
public static final String SORMAS = "SORMAS";
32+
33+
}

sormas-api/src/main/java/de/symeda/sormas/api/ConfigFacade.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public interface ConfigFacade {
2828

2929
String getCountryLocale();
3030

31+
String getCountryCode();
32+
3133
boolean isConfiguredCountry(String countryCode);
3234

3335
String getEpidPrefix();
@@ -96,9 +98,13 @@ public interface ConfigFacade {
9698

9799
String getSymptomJournalSecret();
98100

101+
String getPatientDiaryUrl();
102+
99103
String getSormasToSormasUserPassword();
100104

101105
void validateExternalUrls();
102106

103107
SormasToSormasConfig getSormasToSormasConfig();
108+
109+
String getAuthenticationProvider();
104110
}

0 commit comments

Comments
 (0)