Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

Commit 70ab5d5

Browse files
committed
Merge tag 'v1.18.0' into 115-update_v1.18.0
2 parents 7a43cb6 + ab2e693 commit 70ab5d5

File tree

78 files changed

+1928
-723
lines changed

Some content is hidden

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

78 files changed

+1928
-723
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# SPDX-FileCopyrightText: 2022 - 2023 Dusan Mijatovic (dv4all)
2+
# SPDX-FileCopyrightText: 2022 - 2023 dv4all
3+
# SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all) (dv4all)
4+
# SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <[email protected]>
5+
# SPDX-FileCopyrightText: 2022 Netherlands eScience Center
6+
#
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: e2e tests chrome
10+
on:
11+
workflow_dispatch:
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- "authentication/**"
17+
- "backend-postgrest/**"
18+
- "database/**"
19+
- "e2e/**"
20+
- "frontend/**"
21+
- "nginx/**"
22+
pull_request:
23+
paths:
24+
- "authentication/**"
25+
- "backend-postgrest/**"
26+
- "database/**"
27+
- "e2e/**"
28+
- "frontend/**"
29+
- "nginx/**"
30+
31+
jobs:
32+
ubuntu-v22:
33+
timeout-minutes: 30
34+
runs-on: ubuntu-22.04
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: actions/setup-node@v3
38+
with:
39+
node-version: 18.5
40+
cache: 'npm'
41+
cache-dependency-path: e2e/package-lock.json
42+
- name: get playwright version
43+
id: playwright-version
44+
working-directory: e2e
45+
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
46+
- name: cache playwright binaries
47+
uses: actions/cache@v3
48+
id: playwright-cache
49+
with:
50+
path: |
51+
~/.cache/ms-playwright
52+
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
53+
- name: install dependencies
54+
working-directory: e2e
55+
run: npm ci
56+
- name: install browsers
57+
working-directory: e2e
58+
run: npx playwright install chromium chrome firefox --with-deps
59+
if: steps.playwright-cache.outputs.cache-hit != 'true'
60+
- name: build rsd
61+
working-directory: .
62+
run: |
63+
cp e2e/.env.e2e .env
64+
docker-compose build --parallel database backend auth frontend nginx
65+
- name: start rsd
66+
working-directory: .
67+
run: |
68+
docker-compose up --detach --scale scrapers=0
69+
sleep 5
70+
- name: run e2e tests in chrome
71+
working-directory: e2e
72+
run: npm run e2e:chrome:action
73+
- uses: actions/upload-artifact@v3
74+
if: always()
75+
with:
76+
name: playwright-report
77+
path: e2e/playwright-report/
78+
retention-days: 30
79+
- uses: actions/upload-artifact@v3
80+
if: failure()
81+
with:
82+
name: browser state and .env file
83+
path: |
84+
e2e/state/
85+
.env
86+
retention-days: 30
87+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-FileCopyrightText: 2022 - 2023 Dusan Mijatovic (dv4all)
2+
# SPDX-FileCopyrightText: 2022 - 2023 dv4all
3+
# SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all) (dv4all)
4+
# SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <[email protected]>
5+
# SPDX-FileCopyrightText: 2022 Netherlands eScience Center
6+
#
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: e2e tests firefox
10+
on:
11+
workflow_dispatch:
12+
13+
jobs:
14+
ubuntu-v22:
15+
timeout-minutes: 30
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 18.5
22+
cache: 'npm'
23+
cache-dependency-path: e2e/package-lock.json
24+
- name: get playwright version
25+
id: playwright-version
26+
working-directory: e2e
27+
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
28+
- name: cache playwright binaries
29+
uses: actions/cache@v3
30+
id: playwright-cache
31+
with:
32+
path: |
33+
~/.cache/ms-playwright
34+
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
35+
- name: install dependencies
36+
working-directory: e2e
37+
run: npm ci
38+
- name: install browsers
39+
working-directory: e2e
40+
run: npx playwright install chromium chrome firefox --with-deps
41+
if: steps.playwright-cache.outputs.cache-hit != 'true'
42+
- name: build rsd
43+
working-directory: .
44+
run: |
45+
cp e2e/.env.e2e .env
46+
docker-compose build --parallel database backend auth frontend nginx
47+
- name: start rsd
48+
working-directory: .
49+
run: |
50+
docker-compose up --detach --scale scrapers=0
51+
sleep 5
52+
- name: run e2e tests in firefox
53+
working-directory: e2e
54+
run: npm run e2e:ff:action
55+
- uses: actions/upload-artifact@v3
56+
if: always()
57+
with:
58+
name: playwright-report
59+
path: e2e/playwright-report/
60+
retention-days: 30
61+
- uses: actions/upload-artifact@v3
62+
if: failure()
63+
with:
64+
name: browser state and .env file
65+
path: |
66+
e2e/state/
67+
.env
68+
retention-days: 30
69+

.github/workflows/e2e_tests_ubuntu.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
# SPDX-License-Identifier: Apache-2.0
1111
# SPDX-License-Identifier: EUPL-1.2
1212

13-
name: e2e tests ubuntu
13+
name: e2e tests firefox
1414
on:
15+
# only manual run
1516
workflow_dispatch:
1617

1718
jobs:
@@ -51,7 +52,7 @@ jobs:
5152
- name: start rsd
5253
working-directory: .
5354
run: |
54-
docker-compose up --detach database backend auth frontend nginx
55+
docker-compose up --detach --scale scrapers=0
5556
sleep 5
5657
- name: run e2e tests
5758
working-directory: e2e

CITATION.cff

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ references:
5151
- name: "Netherlands eScience Center"
5252
title: "Research Software Directory (as a service)"
5353
doi: 10.5281/zenodo.6379973
54-
version: v1.17.1
54+
version: v1.18.0
5555
repository-code: https://github.com/research-software-directory/RSD-as-a-service
5656
keywords:
5757
- Research Software
@@ -62,5 +62,5 @@ keywords:
6262
license:
6363
- EUPL-1.2
6464
- Apache-2.0
65-
version: hifis-1.6.0
66-
date-released: '2023-02-27'
65+
version: hifis-1.7.0
66+
date-released: '2023-03-06'

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
# SPDX-FileCopyrightText: 2022 - 2023 Christian Meeßen (GFZ) <[email protected]>
12
# SPDX-FileCopyrightText: 2022 - 2023 Dusan Mijatovic (dv4all)
3+
# SPDX-FileCopyrightText: 2022 - 2023 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
24
# SPDX-FileCopyrightText: 2022 - 2023 dv4all
3-
# SPDX-FileCopyrightText: 2022 Christian Meeßen (GFZ) <[email protected]>
45
# SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <[email protected]>
5-
# SPDX-FileCopyrightText: 2022 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
66
# SPDX-FileCopyrightText: 2022 Jesús García Gonzalez (Netherlands eScience Center) <[email protected]>
77
# SPDX-FileCopyrightText: 2022 Netherlands eScience Center
88
#
@@ -28,14 +28,12 @@ export DGID
2828

2929
# Main commands
3030
# ----------------------------------------------------------------
31-
start:
32-
docker-compose down --volumes #cleanup phase
31+
start: clean
3332
docker-compose build # build all services
3433
docker-compose up --scale data-generation=1 --scale scrapers=0 -d
3534
# open http://localhost to see the application running
3635

37-
install:
38-
docker-compose down --volumes #cleanup phase
36+
install: clean
3937
docker-compose build database backend auth scrapers nginx # exclude frontend and wait for the build to finish
4038
docker-compose up --scale scrapers=0 -d
4139
cd frontend && yarn install -d
@@ -45,6 +43,8 @@ install:
4543
docker-compose up --scale data-generation=1 -d
4644
# All dependencies are installed. The data migration is runing in the background. You can now run `make dev' to start the application
4745

46+
clean:
47+
docker-compose down --volumes
4848

4949

5050
dev:
@@ -84,7 +84,7 @@ dev-frontend: frontend/.env.local
8484
e2e-tests:
8585
docker-compose down --volumes
8686
docker-compose build --parallel database backend auth frontend nginx
87-
docker-compose up --detach database backend auth frontend nginx
87+
docker-compose up --detach --scale scrapers=0
8888
sleep 10
8989
docker-compose --file e2e/docker-compose.yml build
9090
docker-compose --file e2e/docker-compose.yml up

authentication/src/main/java/nl/esciencecenter/rsd/authentication/HelmholtzAaiLogin.java

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// SPDX-FileCopyrightText: 2022 - 2023 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
12
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <[email protected]>
2-
// SPDX-FileCopyrightText: 2022 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
33
// SPDX-FileCopyrightText: 2022 Matthias Rüster (GFZ) <[email protected]>
44
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
5+
// SPDX-FileCopyrightText: 2023 Christian Meeßen (GFZ) <[email protected]>
56
//
67
// SPDX-License-Identifier: Apache-2.0
78

@@ -34,31 +35,42 @@
3435
import java.net.http.HttpRequest;
3536
import java.net.http.HttpResponse;
3637
import java.net.http.HttpResponse.BodyHandlers;
38+
import java.util.ArrayList;
39+
import java.util.Collection;
3740
import java.util.Objects;
41+
import java.util.Set;
3842

3943
public class HelmholtzAaiLogin implements Login {
4044

4145
private final String code;
4246
private final String redirectUrl;
4347
static final String DEFAULT_ORGANISATION = "Helmholtz";
4448

49+
// See https://hifis.net/doc/helmholtz-aai/list-of-vos/#vos-representing-helmholtz-centres
50+
static private final Collection<String> knownHgfOrganisations = Set.<String>of(
51+
"AWI", "CISPA", "DESY", "DKFZ", "DLR", "DZNE", "FZJ", "GEOMAR", "GFZ", "GSI", "hereon", "HMGU", "HZB", "KIT", "MDC", "UFZ"
52+
);
53+
4554
public HelmholtzAaiLogin(String code, String redirectUrl) {
4655
this.code = Objects.requireNonNull(code);
4756
this.redirectUrl = Objects.requireNonNull(redirectUrl);
4857
}
4958

50-
static String getOrganisationFromEntitlements(
51-
JSONArray entitlements,
52-
boolean allowExternal
53-
) {
59+
static String getOrganisationFromEntitlements(JSONArray entitlements) {
5460
if (entitlements == null || entitlements.isEmpty()) {
55-
return allowExternal ? DEFAULT_ORGANISATION : null;
61+
return null;
5662
}
5763

58-
String organisation = DEFAULT_ORGANISATION;
64+
String returnOrganisation;
65+
ArrayList<String> organisationsDelivered = new ArrayList<String>();
5966
boolean helmholtzmemberFound = false;
6067

68+
// Collect all organisations delivered, because the home organisation
69+
// must not be the first one in the list. This assumes that a person
70+
// is only member of one organisation
71+
String organisation;
6172
for (Object element : entitlements.toArray()) {
73+
organisation = null;
6274
String ent = element.toString();
6375

6476
// we expect this for logins from Helmholtz centres
@@ -72,6 +84,7 @@ static String getOrganisationFromEntitlements(
7284
if (ent.matches("urn:geant:helmholtz\\.de:group:.*")) {
7385
String withoutHash = ent;
7486

87+
// remove everything behind the hash
7588
if (ent.contains("#")) {
7689
String[] splitHash = ent.split("#");
7790

@@ -93,17 +106,27 @@ static String getOrganisationFromEntitlements(
93106

94107
// get organisation from last element
95108
organisation = splitGroup[splitGroup.length - 1];
109+
organisationsDelivered.add(organisation);
96110
}
97111
}
98112

99-
if (!helmholtzmemberFound && !allowExternal) {
100-
// deny login
113+
if (!helmholtzmemberFound) {
101114
return null;
102115
}
103116

117+
// Detect whether one of the delivered organisations is in the list of known HGF centres
118+
organisationsDelivered.retainAll(knownHgfOrganisations);
119+
if (organisationsDelivered.size() == 0) {
120+
// No known HGF organisation could be found
121+
returnOrganisation = DEFAULT_ORGANISATION;
122+
} else {
123+
// Always return the first element in the list, even if there were multiple centres found
124+
returnOrganisation = organisationsDelivered.get(0);
125+
};
126+
104127
// else: we either return the found the Helmholtz centre name
105128
// or the default organisation
106-
return organisation;
129+
return returnOrganisation;
107130
}
108131

109132
@Override
@@ -173,15 +196,12 @@ public OpenIdInfo openidInfo() {
173196
}
174197

175198
JSONArray entitlements = (JSONArray) userInfo.getClaim("eduperson_entitlement");
176-
String organisation = getOrganisationFromEntitlements(
177-
entitlements,
178-
Config.helmholtzAaiAllowExternalUsers()
179-
);
199+
String organisation = getOrganisationFromEntitlements(entitlements);
180200

181-
if (organisation == null) {
182-
// login denied by missing entitlements
183-
// or external providers are not allowed
184-
throw new RsdAuthenticationException("You are not allowed to login");
201+
if (organisation == null && !Config.helmholtzAaiAllowExternalUsers()) {
202+
// Login denied because no HGF organisation could be found in eduperson_entitlements
203+
// and because social IdPs are not allowed
204+
throw new RsdAuthenticationException("You are not allowed to login.");
185205
}
186206

187207
return new OpenIdInfo(

0 commit comments

Comments
 (0)