diff --git a/src/main/java/es/in2/vcverifier/config/properties/UiUrlsProperties.java b/src/main/java/es/in2/vcverifier/config/properties/UiUrlsProperties.java new file mode 100644 index 0000000..15ace00 --- /dev/null +++ b/src/main/java/es/in2/vcverifier/config/properties/UiUrlsProperties.java @@ -0,0 +1,7 @@ +package es.in2.vcverifier.config.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "ui.urls") +public record UiUrlsProperties(String onboardingUrl, String supportUrl, String walletUrl) { +} diff --git a/src/main/java/es/in2/vcverifier/oid4vp/controller/LoginQrController.java b/src/main/java/es/in2/vcverifier/oid4vp/controller/LoginQrController.java index f6c1c56..e47db74 100644 --- a/src/main/java/es/in2/vcverifier/oid4vp/controller/LoginQrController.java +++ b/src/main/java/es/in2/vcverifier/oid4vp/controller/LoginQrController.java @@ -1,6 +1,8 @@ package es.in2.vcverifier.oid4vp.controller; +import es.in2.vcverifier.config.properties.UiUrlsProperties; import es.in2.vcverifier.exception.QRCodeGenerationException; +import lombok.RequiredArgsConstructor; import net.glxn.qrgen.javase.QRCode; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; @@ -11,8 +13,11 @@ import java.util.Base64; @Controller +@RequiredArgsConstructor public class LoginQrController { + private final UiUrlsProperties uiUrlsProperties; + @GetMapping("/login") @ResponseStatus(HttpStatus.OK) @@ -27,6 +32,10 @@ public String showQrLogin(@RequestParam("authRequest") String authRequest, @Requ // Pasar el sessionId al modelo model.addAttribute("state", state); + model.addAttribute("onboardingUrl", uiUrlsProperties.onboardingUrl()); + model.addAttribute("supportUrl", uiUrlsProperties.supportUrl()); + model.addAttribute("walletUrl", uiUrlsProperties.walletUrl()); + } catch (Exception e) { throw new QRCodeGenerationException(e.getMessage()); } @@ -34,7 +43,7 @@ public String showQrLogin(@RequestParam("authRequest") String authRequest, @Requ return "login"; } - private String generateQRCodeImageBase64(String barcodeText){ + private String generateQRCodeImageBase64(String barcodeText) { ByteArrayOutputStream stream = QRCode .from(barcodeText) .withSize(250, 250) diff --git a/src/main/resources/application-dev.yaml b/src/main/resources/application-dev.yaml index 037f4ef..1992e30 100644 --- a/src/main/resources/application-dev.yaml +++ b/src/main/resources/application-dev.yaml @@ -57,3 +57,9 @@ trustedIssuerList: crypto: privateKey: + +ui: + urls: + onboardingUrl: + supportUrl: + walletUrl: \ No newline at end of file diff --git a/src/main/resources/application-local.yaml b/src/main/resources/application-local.yaml index 1debe38..593e758 100644 --- a/src/main/resources/application-local.yaml +++ b/src/main/resources/application-local.yaml @@ -59,4 +59,10 @@ trustedIssuerList: uri: "http://localhost:8080/v4/issuers/" crypto: - privateKey: "73e509a7681d4a395b1ced75681c4dc4020dbab02da868512276dd766733d5b5" # for test purposes \ No newline at end of file + privateKey: "73e509a7681d4a395b1ced75681c4dc4020dbab02da868512276dd766733d5b5" # for test purposes + +ui: + urls: + onboardingUrl: + supportUrl: + walletUrl: \ No newline at end of file diff --git a/src/main/resources/application-prod.yaml b/src/main/resources/application-prod.yaml index 25ae71b..1992e30 100644 --- a/src/main/resources/application-prod.yaml +++ b/src/main/resources/application-prod.yaml @@ -56,4 +56,10 @@ trustedIssuerList: uri: crypto: - privateKey: \ No newline at end of file + privateKey: + +ui: + urls: + onboardingUrl: + supportUrl: + walletUrl: \ No newline at end of file diff --git a/src/main/resources/application-test.yaml b/src/main/resources/application-test.yaml index 25ae71b..1992e30 100644 --- a/src/main/resources/application-test.yaml +++ b/src/main/resources/application-test.yaml @@ -56,4 +56,10 @@ trustedIssuerList: uri: crypto: - privateKey: \ No newline at end of file + privateKey: + +ui: + urls: + onboardingUrl: + supportUrl: + walletUrl: \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 7df9ea9..d62a6bf 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -59,4 +59,10 @@ trustedIssuerList: uri: "http://localhost:8080/v4/issuers/" crypto: - privateKey: "73e509a7681d4a395b1ced75681c4dc4020dbab02da868512276dd766733d5b5" # for test purposes \ No newline at end of file + privateKey: "73e509a7681d4a395b1ced75681c4dc4020dbab02da868512276dd766733d5b5" # for test purposes + +ui: + urls: + onboardingUrl: + supportUrl: + walletUrl: \ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index f2edd99..60ecaf6 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -254,14 +254,14 @@

Your organization must be registered in the marketplace before you log in.

-

Having trouble logging in?

-

Get help from Customer Support

+

Get help from Customer Support

@@ -283,7 +283,8 @@

Login from the same device

Login instructions

-

1. You must register or log in to a Wallet using your phone. You may use the DOME Wallet.

+

1. You must register or log in to a Wallet using your phone. You may use the DOME Wallet.

2. Scan the QR code.

3. Select the credential.

diff --git a/src/test/java/es/in2/vcverifier/config/properties/UiUrlPropertiesTest.java b/src/test/java/es/in2/vcverifier/config/properties/UiUrlPropertiesTest.java new file mode 100644 index 0000000..b091f39 --- /dev/null +++ b/src/test/java/es/in2/vcverifier/config/properties/UiUrlPropertiesTest.java @@ -0,0 +1,42 @@ +package es.in2.vcverifier.config.properties; + +import es.in2.vcverifier.objectmothers.UiUrlsPropertiesMother; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +class UiUrlPropertiesTest { + @Autowired + private UiUrlsProperties uiUrlsProperties; + + private static final String ONBOARDING_URL = UiUrlsPropertiesMother.createOnboardingUrl(); + private static final String SUPPORT_URL = UiUrlsPropertiesMother.createSupportUrl(); + private static final String WALLET_URL = UiUrlsPropertiesMother.createWalletUrl(); + + @DynamicPropertySource + static void setDynamicProperties(DynamicPropertyRegistry registry) { + registry.add("ui.urls.onboardingUrl", () -> ONBOARDING_URL); + registry.add("ui.urls.supportUrl", () -> SUPPORT_URL); + registry.add("ui.urls.walletUrl", () -> WALLET_URL); + } + + @Test + void testUiUrlsOnboardingUrl() { + assertThat(uiUrlsProperties.onboardingUrl()).isEqualTo(ONBOARDING_URL); + } + + @Test + void testUiUrlSupportUrl() { + assertThat(uiUrlsProperties.supportUrl()).isEqualTo(SUPPORT_URL); + } + + @Test + void testUiUrlwalletUrl() { + assertThat(uiUrlsProperties.walletUrl()).isEqualTo(WALLET_URL); + } +} \ No newline at end of file diff --git a/src/test/java/es/in2/vcverifier/objectmothers/UiUrlsPropertiesMother.java b/src/test/java/es/in2/vcverifier/objectmothers/UiUrlsPropertiesMother.java new file mode 100644 index 0000000..3885800 --- /dev/null +++ b/src/test/java/es/in2/vcverifier/objectmothers/UiUrlsPropertiesMother.java @@ -0,0 +1,18 @@ +package es.in2.vcverifier.objectmothers; + +public final class UiUrlsPropertiesMother { + private UiUrlsPropertiesMother() { + } + + public static String createOnboardingUrl(){ + return "knowledge-base.example.org"; + } + + public static String createSupportUrl(){ + return "ticketing.example.org"; + } + + public static String createWalletUrl(){ + return "wallet.example.org"; + } +}