From b06f6396a89b704bbfdc0c4ee9f9a5df6329d7fc Mon Sep 17 00:00:00 2001 From: Artur T <81235055+a-trzewik@users.noreply.github.com> Date: Mon, 17 May 2021 11:13:07 +0200 Subject: [PATCH] context file config (#59) --- Dockerfile | 1 + context/context.json | 27 +++++++++++++++++ context/context.jsonc | 30 +++++++++++++++++++ docs/configuration.md | 9 ++++++ .../dgc/issuance/service/ContextService.java | 2 +- src/main/resources/application.yml | 1 + 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 context/context.json create mode 100644 context/context.jsonc diff --git a/Dockerfile b/Dockerfile index c27de24..f3078bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM adoptopenjdk:11-jre-hotspot COPY ./target/*.jar /app/app.jar COPY ./certs/test.jks /app/certs/test.jks +COPY ./context/context.json /app/context/context.json WORKDIR /app ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar ./app.jar" ] diff --git a/context/context.json b/context/context.json new file mode 100644 index 0000000..3d7c0c3 --- /dev/null +++ b/context/context.json @@ -0,0 +1,27 @@ +{ + "origin": "DE", + "versions": { + "default": { + "privacyUrl": "https://publications.europa.eu/en/web/about-us/legal-notices/eu-mobile-apps", + "context": { + "url": "https://dgca-issuance-web.cfapps.eu10.hana.ondemand.com/dgca-issuance-service/context", + "pubKeys": [ + "lKdU1EbQubxyDDm2q3N8KclZ2C94Num3xXjG0pk+3eI=", + "r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=" + ] + }, + "endpoints": { + "claim": { + "url": "https://dgca-issuance-web.cfapps.eu10.hana.ondemand.com/dgca-issuance-service/dgci/wallet/claim", + "pubKeys": [ + "lKdU1EbQubxyDDm2q3N8KclZ2C94Num3xXjG0pk+3eI=", + "r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=" + ] + } + } + }, + "0.1.0": { + "outdated": true + } + } +} diff --git a/context/context.jsonc b/context/context.jsonc new file mode 100644 index 0000000..40e68fa --- /dev/null +++ b/context/context.jsonc @@ -0,0 +1,30 @@ +{ + // Origin in ISO alpha 2 code: + "origin": "DE", + "versions": { + "default": { + // catch-all for normal versions + "privacyUrl": "https://publications.europa.eu/en/web/about-us/legal-notices/eu-mobile-apps", + "context": { + "url": "https://dgca-issuance-web.cfapps.eu10.hana.ondemand.com/dgca-issuance-service/context", + "pubKeys": [ + "lKdU1EbQubxyDDm2q3N8KclZ2C94Num3xXjG0pk+3eI=", + "r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=" + ] + }, + "endpoints": { + "claim": { + "url": "https://dgca-issuance-web.cfapps.eu10.hana.ondemand.com/dgca-issuance-service/dgci/wallet/claim", + "pubKeys": [ + "lKdU1EbQubxyDDm2q3N8KclZ2C94Num3xXjG0pk+3eI=", + "r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=" + ] + } + } + }, + "0.1.0": { + // Example for a version that is insecure and shouldn't start. + "outdated": true + } + } +} diff --git a/docs/configuration.md b/docs/configuration.md index 39db77a..8865bc6 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -65,6 +65,15 @@ The default database is in-memory H2 database and is usable for development only In the spring profile "cloud" see src/main/resources/application-cloud.yml there are example postgres database configured. Consult [spring boot manuals](https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-data-access) +# Context File +Context file is used by wallet app for url pinning. It will be server at /context endpoint without any other modification. +If the context file is not configured and empty context json will be returned. + +``` +issuance: + context: context.json +``` + # Configuring Connection to EDGC Gateway The connection to EDGC is optional. The application uses DGC Gateway connector from dgc-lib to configure and use the dgc-gateway. diff --git a/src/main/java/eu/europa/ec/dgc/issuance/service/ContextService.java b/src/main/java/eu/europa/ec/dgc/issuance/service/ContextService.java index a5e0f0c..2326462 100644 --- a/src/main/java/eu/europa/ec/dgc/issuance/service/ContextService.java +++ b/src/main/java/eu/europa/ec/dgc/issuance/service/ContextService.java @@ -44,7 +44,7 @@ public void loadContextFile() { JsonNodeFactory jsonNodeFactory = JsonNodeFactory.instance; ObjectNode contextObj = jsonNodeFactory.objectNode(); contextObj.set("Origin", jsonNodeFactory.textNode(issuanceConfigProperties.getCountryCode())); - contextObj.set("claimEndpoints", jsonNodeFactory.arrayNode()); + contextObj.set("versions", jsonNodeFactory.objectNode()); contextDefinition = contextObj; } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b0186d1..a463b07 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -47,6 +47,7 @@ issuance: privateKeyPassword: dgca countryCode: DE tanExpirationHours: 2 + contextFile: context/context.json expiration: vaccination: 365 recoverty: 365