From 86ffb124511609ebe3e6f93b2248afabfb701826 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 23 Oct 2023 18:03:41 +0000
Subject: [PATCH 01/27] Bump
org.springframework.boot:spring-boot-starter-parent
Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.1.3 to 3.1.5.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/compare/v3.1.3...v3.1.5)
---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index a16e0735..47d52798 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.3
+ 3.1.5
From 4df89db068eb65dd822c5bb54c06e4dd98e1e66f Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Wed, 1 Nov 2023 12:52:16 +0100
Subject: [PATCH 02/27] Fix #247: Set develop version to 1.6.0-SNAPSHOT
---
pom.xml | 2 +-
powerauth-backend-tests/pom.xml | 2 +-
powerauth-load-tests/pom.xml | 2 +-
powerauth-test-server/pom.xml | 2 +-
powerauth-webflow-tests/pom.xml | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8730c5a3..fcb8b394 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
com.wultra
powerauth-backend-tests-parent
- 1.5.0
+ 1.6.0-SNAPSHOT
pom
Parent pom for backend tests
diff --git a/powerauth-backend-tests/pom.xml b/powerauth-backend-tests/pom.xml
index 5a30f76c..e8ea7543 100644
--- a/powerauth-backend-tests/pom.xml
+++ b/powerauth-backend-tests/pom.xml
@@ -8,7 +8,7 @@
com.wultra
powerauth-backend-tests-parent
- 1.5.0
+ 1.6.0-SNAPSHOT
com.wultra
diff --git a/powerauth-load-tests/pom.xml b/powerauth-load-tests/pom.xml
index 257f92a9..b35b21f8 100644
--- a/powerauth-load-tests/pom.xml
+++ b/powerauth-load-tests/pom.xml
@@ -6,7 +6,7 @@
com.wultra
powerauth-backend-tests-parent
- 1.5.0
+ 1.6.0-SNAPSHOT
com.wultra
diff --git a/powerauth-test-server/pom.xml b/powerauth-test-server/pom.xml
index 2c1d98f0..9c31be24 100644
--- a/powerauth-test-server/pom.xml
+++ b/powerauth-test-server/pom.xml
@@ -23,7 +23,7 @@
com.wultra
powerauth-backend-tests-parent
- 1.5.0
+ 1.6.0-SNAPSHOT
powerauth-test-server
diff --git a/powerauth-webflow-tests/pom.xml b/powerauth-webflow-tests/pom.xml
index f577d876..e4b40b5a 100644
--- a/powerauth-webflow-tests/pom.xml
+++ b/powerauth-webflow-tests/pom.xml
@@ -8,7 +8,7 @@
com.wultra
powerauth-backend-tests-parent
- 1.5.0
+ 1.6.0-SNAPSHOT
com.wultra
From 02721b43b797809b3b97de1408bc1e7ec24021e9 Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Wed, 1 Nov 2023 12:56:25 +0100
Subject: [PATCH 03/27] Fix #282: Update Wultra dependencies to SNAPSHOT
version
---
pom.xml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8730c5a3..545a8543 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,12 +45,12 @@
- 1.5.0
- 1.5.0
- 1.5.1
- 1.5.0
- 1.5.0
- 1.7.0
+ 1.6.0-SNAPSHOT
+ 1.6.0-SNAPSHOT
+ 1.6.0-SNAPSHOT
+ 1.6.0-SNAPSHOT
+ 1.6.0-SNAPSHOT
+ 1.8.0-SNAPSHOT
1.76
2.2.0
From 5665412901e7c527433fcbb8c298bb82bfd8a07c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pe=C5=A1ek?=
Date: Thu, 2 Nov 2023 08:42:03 +0100
Subject: [PATCH 04/27] Fix #260: Executable war (#264)
---
pom.xml | 12 ++++++++++++
powerauth-test-server/pom.xml | 26 --------------------------
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/pom.xml b/pom.xml
index ed4767db..b3ce9be9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -149,6 +149,18 @@
logstash-logback-encoder
${logstash.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-el
+ provided
+
diff --git a/powerauth-test-server/pom.xml b/powerauth-test-server/pom.xml
index 9c31be24..2347ae81 100644
--- a/powerauth-test-server/pom.xml
+++ b/powerauth-test-server/pom.xml
@@ -72,10 +72,6 @@
log4j-to-slf4j
org.apache.logging.log4j
-
- org.springframework.boot
- spring-boot-starter-tomcat
-
@@ -93,12 +89,6 @@
org.springframework.boot
spring-boot-starter-validation
-
-
- org.apache.tomcat.embed
- tomcat-embed-el
-
-
@@ -155,12 +145,6 @@
${springdoc-openapi-starter-webmvc-ui.version}
-
-
- org.apache.tomcat.embed
- tomcat-embed-el
- test
-
@@ -221,16 +205,6 @@
-
- standalone
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
- provided
-
-
-
liquibase
From 0b9d659674af1a0349461d30c4598c8c7164fe0a Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Thu, 2 Nov 2023 09:04:21 +0100
Subject: [PATCH 05/27] Fix #285: Configuration to run dev standalone
---
.run/TestServerApplication.run.xml | 11 +++++++++++
docs-private/Developer-How-To-Start.md | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 .run/TestServerApplication.run.xml
create mode 100644 docs-private/Developer-How-To-Start.md
diff --git a/.run/TestServerApplication.run.xml b/.run/TestServerApplication.run.xml
new file mode 100644
index 00000000..0d98d558
--- /dev/null
+++ b/.run/TestServerApplication.run.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs-private/Developer-How-To-Start.md b/docs-private/Developer-How-To-Start.md
new file mode 100644
index 00000000..5c5376d2
--- /dev/null
+++ b/docs-private/Developer-How-To-Start.md
@@ -0,0 +1,20 @@
+# Developer - How to Start Guide
+
+
+## Standalone Run
+
+- Use IntelliJ Idea run configuration at `../.run/TestServerApplication.run.xml`
+- Open [http://localhost:8080/actuator/health](http://localhost:8080/actuator/health) and you should get `{"status":"UP"}`
+
+
+## Database
+
+Database changes are driven by Liquibase.
+
+This is an example how to manually check the Liquibase status.
+Important and fixed parameter is `changelog-file`.
+Others (like URL, username, password) depend on your environment.
+
+```shell
+liquibase --changelog-file=./docs/db/changelog/changesets/powerauth-test-server/db.changelog-module.xml --url=jdbc:postgresql://localhost:5432/powerauth --username=powerauth status
+```
From dac00f75314f908a34dc90a70432465e2cbd6299 Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Thu, 2 Nov 2023 11:04:57 +0100
Subject: [PATCH 06/27] Document Accept-Language header for /operations/pending
endpoint
A follow-up to #261
---
.../app/testserver/controller/OperationsController.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/powerauth-test-server/src/main/java/com/wultra/security/powerauth/app/testserver/controller/OperationsController.java b/powerauth-test-server/src/main/java/com/wultra/security/powerauth/app/testserver/controller/OperationsController.java
index af82c383..18f7bbf6 100644
--- a/powerauth-test-server/src/main/java/com/wultra/security/powerauth/app/testserver/controller/OperationsController.java
+++ b/powerauth-test-server/src/main/java/com/wultra/security/powerauth/app/testserver/controller/OperationsController.java
@@ -29,8 +29,14 @@
import io.getlime.core.rest.model.base.response.ObjectResponse;
import io.getlime.core.rest.model.base.response.Response;
import io.getlime.security.powerauth.lib.mtoken.model.response.OperationListResponse;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
* Controller for operation specific services.
@@ -61,6 +67,7 @@ public OperationsController(OperationsService operationsService) {
* @throws SignatureVerificationException In case signature verification fails.
* @throws ActivationFailedException In case activation is not found.
*/
+ @Parameter(name = HttpHeaders.ACCEPT_LANGUAGE, in = ParameterIn.HEADER, allowEmptyValue = true, description = "Preferred language in which we want to get the operations.", example = "en")
@PostMapping("pending")
public ObjectResponse fetchOperations(@RequestBody ObjectRequest request) throws RemoteExecutionException, RestClientException, SignatureVerificationException, ActivationFailedException {
final OperationListResponse response = operationsService.getOperations(request.getRequestObject());
From ced30be41bce953428a1d3b977d7f625a56f4dfb Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Thu, 2 Nov 2023 11:11:07 +0100
Subject: [PATCH 07/27] Fix #288: HHH90000025: PostgreSQLDialect does not need
to be specified explicitly
---
powerauth-backend-tests/README.md | 1 -
powerauth-test-server/docker/powerauth-test-server.xml | 3 ---
.../src/main/resources/application.properties | 1 -
3 files changed, 5 deletions(-)
diff --git a/powerauth-backend-tests/README.md b/powerauth-backend-tests/README.md
index c7c43bbf..b6101ad7 100644
--- a/powerauth-backend-tests/README.md
+++ b/powerauth-backend-tests/README.md
@@ -61,7 +61,6 @@ File `powerauth-java.server.xml`:
-
```
diff --git a/powerauth-test-server/docker/powerauth-test-server.xml b/powerauth-test-server/docker/powerauth-test-server.xml
index d1a7c1f6..d2381332 100644
--- a/powerauth-test-server/docker/powerauth-test-server.xml
+++ b/powerauth-test-server/docker/powerauth-test-server.xml
@@ -26,9 +26,6 @@
-
-
-
diff --git a/powerauth-test-server/src/main/resources/application.properties b/powerauth-test-server/src/main/resources/application.properties
index 76b53afa..c9d58e85 100644
--- a/powerauth-test-server/src/main/resources/application.properties
+++ b/powerauth-test-server/src/main/resources/application.properties
@@ -20,7 +20,6 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/powerauth
spring.datasource.username=powerauth
spring.datasource.password=
spring.datasource.driver-class-name=org.postgresql.Driver
-spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.connection.CharSet=UTF-8
spring.jpa.properties.hibernate.connection.characterEncoding=UTF-8
spring.jpa.properties.hibernate.connection.useUnicode=true
From fe7c9fecee2f91ac83dac878556e53fe81288fe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20=C5=A0trobl?=
Date: Thu, 2 Nov 2023 12:44:52 +0100
Subject: [PATCH 08/27] Fix #266: Crypto 3.2: Add tests for new scenarios
(#284)
---
.../shared/PowerAuthEncryptionShared.java | 60 +++++++++++++++++++
...foShared.java => PowerAuthInfoShared.java} | 18 +++++-
.../test/v30/PowerAuthEncryptionTest.java | 5 ++
.../test/v31/PowerAuthEncryptionTest.java | 5 ++
.../test/v32/PowerAuthEncryptionTest.java | 10 ++++
...erInfoTest.java => PowerAuthInfoTest.java} | 11 +++-
6 files changed, 104 insertions(+), 5 deletions(-)
rename powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/{PowerAuthUserInfoShared.java => PowerAuthInfoShared.java} (78%)
rename powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/{PowerAuthUserInfoTest.java => PowerAuthInfoTest.java} (89%)
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthEncryptionShared.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthEncryptionShared.java
index 4823bab5..644349ee 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthEncryptionShared.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthEncryptionShared.java
@@ -19,8 +19,18 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wultra.security.powerauth.client.PowerAuthClient;
+import com.wultra.security.powerauth.client.model.error.PowerAuthClientException;
+import com.wultra.security.powerauth.client.model.request.GetEciesDecryptorRequest;
+import com.wultra.security.powerauth.client.model.response.GetEciesDecryptorResponse;
import com.wultra.security.powerauth.configuration.PowerAuthTestConfiguration;
import io.getlime.core.rest.model.base.response.ErrorResponse;
+import io.getlime.security.powerauth.crypto.lib.encryptor.ClientEncryptor;
+import io.getlime.security.powerauth.crypto.lib.encryptor.EncryptorFactory;
+import io.getlime.security.powerauth.crypto.lib.encryptor.exception.EncryptorException;
+import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptedRequest;
+import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
+import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorParameters;
+import io.getlime.security.powerauth.crypto.lib.encryptor.model.v3.ClientEncryptorSecrets;
import io.getlime.security.powerauth.crypto.lib.enums.PowerAuthSignatureTypes;
import io.getlime.security.powerauth.crypto.lib.generator.HashBasedCounter;
import io.getlime.security.powerauth.lib.cmd.logging.ObjectStepLogger;
@@ -51,6 +61,8 @@
*/
public class PowerAuthEncryptionShared {
+ private static final EncryptorFactory ENCRYPTOR_FACTORY = new EncryptorFactory();
+
public static void encryptInActivationScopeTest(PowerAuthTestConfiguration config, EncryptStepModel encryptModel, ObjectStepLogger stepLogger) throws Exception {
encryptModel.setUriString(config.getEnrollmentServiceUrl() + "/exchange/v3/activation");
encryptModel.setScope("activation");
@@ -487,6 +499,54 @@ public static void signAndEncryptThreeFactorTest(PowerAuthTestConfiguration conf
assertEquals(200, stepLogger.getResponse().statusCode());
}
+ public static void replayAttackEciesDecryptorTest(final PowerAuthClient powerAuthClient, final PowerAuthTestConfiguration config, String version) throws EncryptorException, PowerAuthClientException {
+ String requestData = "test_data";
+ ClientEncryptor clientEncryptor = ENCRYPTOR_FACTORY.getClientEncryptor(
+ EncryptorId.APPLICATION_SCOPE_GENERIC,
+ new EncryptorParameters(version, config.getApplicationKey(), null),
+ new ClientEncryptorSecrets(config.getMasterPublicKey(), config.getApplicationSecret())
+ );
+ EncryptedRequest encryptedRequest = clientEncryptor.encryptRequest(requestData.getBytes(StandardCharsets.UTF_8));
+ final GetEciesDecryptorRequest eciesDecryptorRequest = new GetEciesDecryptorRequest();
+ eciesDecryptorRequest.setProtocolVersion(version);
+ eciesDecryptorRequest.setActivationId(null);
+ eciesDecryptorRequest.setApplicationKey(config.getApplicationKey());
+ eciesDecryptorRequest.setEphemeralPublicKey(encryptedRequest.getEphemeralPublicKey());
+ eciesDecryptorRequest.setNonce(encryptedRequest.getNonce());
+ eciesDecryptorRequest.setTimestamp(encryptedRequest.getTimestamp());
+ GetEciesDecryptorResponse decryptorResponse = powerAuthClient.getEciesDecryptor(eciesDecryptorRequest);
+ assertNotNull(decryptorResponse.getSecretKey());
+ assertNotNull(decryptorResponse.getSharedInfo2());
+
+ // Replay attack simulation - send the same request twice, expect error ERR0024
+ final PowerAuthClientException ex = assertThrows(PowerAuthClientException.class, () ->
+ powerAuthClient.getEciesDecryptor(eciesDecryptorRequest));
+ assertEquals("ERR0024", ex.getPowerAuthError().get().getCode());
+ }
+
+ public static void encryptedResponseTest(final PowerAuthTestConfiguration config, EncryptStepModel encryptModel, ObjectStepLogger stepLogger, String version) throws Exception {
+ encryptModel.setUriString(config.getEnrollmentServiceUrl() + "/exchange/v3/activation");
+ encryptModel.setScope("activation");
+
+ new EncryptStep().execute(stepLogger, encryptModel.toMap());
+ assertTrue(stepLogger.getResult().success());
+ assertEquals(200, stepLogger.getResponse().statusCode());
+ EciesEncryptedResponse responseObject = (EciesEncryptedResponse) stepLogger.getResponse().responseObject();
+ assertNotNull(responseObject.getEncryptedData());
+ assertNotNull(responseObject.getMac());
+ switch (version) {
+ case "3.0", "3.1" -> {
+ assertNull(responseObject.getNonce());
+ assertNull(responseObject.getTimestamp());
+ }
+ case "3.2" -> {
+ assertNotNull(responseObject.getNonce());
+ assertNotNull(responseObject.getTimestamp());
+ }
+ default -> fail("Unsupported version");
+ }
+ }
+
private static String generateRandomString() {
SecureRandom secureRandom = new SecureRandom();
StringBuilder alphabetBuilder = new StringBuilder();
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthUserInfoShared.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthInfoShared.java
similarity index 78%
rename from powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthUserInfoShared.java
rename to powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthInfoShared.java
index 385607b1..d11f3fe1 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthUserInfoShared.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/shared/PowerAuthInfoShared.java
@@ -21,13 +21,18 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.wultra.core.rest.client.base.DefaultRestClient;
+import com.wultra.core.rest.client.base.RestClient;
import com.wultra.security.powerauth.configuration.PowerAuthTestConfiguration;
+import io.getlime.core.rest.model.base.request.ObjectRequest;
+import io.getlime.core.rest.model.base.response.ObjectResponse;
import io.getlime.security.powerauth.lib.cmd.logging.ObjectStepLogger;
import io.getlime.security.powerauth.lib.cmd.logging.model.StepItem;
import io.getlime.security.powerauth.lib.cmd.steps.model.EncryptStepModel;
import io.getlime.security.powerauth.lib.cmd.steps.v3.EncryptStep;
import io.getlime.security.powerauth.rest.api.model.request.UserInfoRequest;
import io.getlime.security.powerauth.rest.api.model.response.EciesEncryptedResponse;
+import io.getlime.security.powerauth.rest.api.model.response.ServerStatusResponse;
import org.opentest4j.AssertionFailedError;
import java.util.Map;
@@ -37,14 +42,17 @@
import static org.junit.jupiter.api.Assertions.*;
/**
- * PowerAuth user info test shared logic.
+ * PowerAuth server info test shared logic.
*
* @author Roman Strobl, roman.strobl@wultra.com
*/
-public class PowerAuthUserInfoShared {
+public class PowerAuthInfoShared {
private static final ObjectMapper objectMapper = new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ // Tolerate 60 seconds time difference between client and server in tests
+ private static final long SERVER_CLIENT_TIME_DIFF_TOLERANCE_MILLIS = 60000;
+
public static void testUserInfo(final PowerAuthTestConfiguration config, final EncryptStepModel encryptModel, final String version) throws Exception {
encryptModel.setUriString(config.getEnrollmentServiceUrl() + "/pa/v3/user/info");
encryptModel.setScope("activation");
@@ -73,6 +81,12 @@ public static void testUserInfo(final PowerAuthTestConfiguration config, final E
assertEquals(config.getUser(version), decryptedData.get("sub"));
}
+ public static void testServerStatus(final PowerAuthTestConfiguration config) throws Exception {
+ final RestClient restClient = new DefaultRestClient(config.getEnrollmentServiceUrl());
+ final ObjectResponse objectResponse = restClient.postObject("/pa/v3/status", new ObjectRequest<>(), ServerStatusResponse.class);
+ assertTrue(Math.abs(objectResponse.getResponseObject().serverTime() - System.currentTimeMillis()) < SERVER_CLIENT_TIME_DIFF_TOLERANCE_MILLIS);
+ }
+
private static Predicate isStepItemDecryptedResponse() {
return stepItem -> "Decrypted Response".equals(stepItem.name());
}
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v30/PowerAuthEncryptionTest.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v30/PowerAuthEncryptionTest.java
index ca56c631..28722be0 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v30/PowerAuthEncryptionTest.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v30/PowerAuthEncryptionTest.java
@@ -219,4 +219,9 @@ void signAndEncryptThreeFactorTest() throws Exception {
PowerAuthEncryptionShared.signAndEncryptThreeFactorTest(config, signatureModel, stepLogger);
}
+ @Test
+ void encryptedResponseTest() throws Exception {
+ PowerAuthEncryptionShared.encryptedResponseTest(config, encryptModel, stepLogger, VERSION);
+ }
+
}
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v31/PowerAuthEncryptionTest.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v31/PowerAuthEncryptionTest.java
index babb0204..d04b7828 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v31/PowerAuthEncryptionTest.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v31/PowerAuthEncryptionTest.java
@@ -219,4 +219,9 @@ void signAndEncryptThreeFactorTest() throws Exception {
PowerAuthEncryptionShared.signAndEncryptThreeFactorTest(config, signatureModel, stepLogger);
}
+ @Test
+ void encryptedResponseTest() throws Exception {
+ PowerAuthEncryptionShared.encryptedResponseTest(config, encryptModel, stepLogger, VERSION);
+ }
+
}
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v32/PowerAuthEncryptionTest.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v32/PowerAuthEncryptionTest.java
index 8439f1fd..9603919d 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v32/PowerAuthEncryptionTest.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v32/PowerAuthEncryptionTest.java
@@ -219,4 +219,14 @@ void signAndEncryptThreeFactorTest() throws Exception {
PowerAuthEncryptionShared.signAndEncryptThreeFactorTest(config, signatureModel, stepLogger);
}
+ @Test
+ void replayAttackEciesDecryptorTest() throws Exception {
+ PowerAuthEncryptionShared.replayAttackEciesDecryptorTest(powerAuthClient, config, VERSION);
+ }
+
+ @Test
+ void encryptedResponseTest() throws Exception {
+ PowerAuthEncryptionShared.encryptedResponseTest(config, encryptModel, stepLogger, VERSION);
+ }
+
}
diff --git a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthUserInfoTest.java b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthInfoTest.java
similarity index 89%
rename from powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthUserInfoTest.java
rename to powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthInfoTest.java
index 8f1dbd5b..f8f90c1a 100644
--- a/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthUserInfoTest.java
+++ b/powerauth-backend-tests/src/test/java/com/wultra/security/powerauth/test/v3x/PowerAuthInfoTest.java
@@ -18,7 +18,7 @@
package com.wultra.security.powerauth.test.v3x;
import com.wultra.security.powerauth.configuration.PowerAuthTestConfiguration;
-import com.wultra.security.powerauth.test.shared.PowerAuthUserInfoShared;
+import com.wultra.security.powerauth.test.shared.PowerAuthInfoShared;
import io.getlime.security.powerauth.lib.cmd.steps.model.EncryptStepModel;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -40,7 +40,7 @@
@SpringBootTest(classes = PowerAuthTestConfiguration.class)
@EnableConfigurationProperties
@EnabledIf(expression = "${powerauth.test.includeCustomTests}", loadContext = true)
-class PowerAuthUserInfoTest {
+class PowerAuthInfoTest {
private final static String VERSION = "3.2";
@@ -62,7 +62,12 @@ void setUp() {
@Test
void testUserInfo() throws Exception {
- PowerAuthUserInfoShared.testUserInfo(config, encryptModel, VERSION);
+ PowerAuthInfoShared.testUserInfo(config, encryptModel, VERSION);
+ }
+
+ @Test
+ void testServerStatus() throws Exception {
+ PowerAuthInfoShared.testServerStatus(config);
}
}
From bba5e5b84075e6aebb01736821d5a7ee92e8e7cf Mon Sep 17 00:00:00 2001
From: Lubos Racansky
Date: Mon, 6 Nov 2023 09:52:19 +0100
Subject: [PATCH 09/27] Fix configuration of scheduled GitHub action for
Integration Tests
---
.github/workflows/maven-integration-test.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/maven-integration-test.yml b/.github/workflows/maven-integration-test.yml
index 77875ff2..cdbefeac 100644
--- a/.github/workflows/maven-integration-test.yml
+++ b/.github/workflows/maven-integration-test.yml
@@ -44,7 +44,7 @@ jobs:
POWERAUTH_ENROLLMENT_ONBOARDING_SERVICE_URL: ${{ secrets.POWERAUTH_ENROLLMENT_ONBOARDING_SERVICE_URL }}
POWERAUTH_SERVICE_SECURITY_CLIENTTOKEN: ${{ secrets.POWERAUTH_SERVICE_SECURITY_CLIENTTOKEN }}
POWERAUTH_SERVICE_SECURITY_CLIENTSECRET: ${{ secrets.POWERAUTH_SERVICE_SECURITY_CLIENTSECRET }}
- POWERAUTH_TEST_INCLUDECUSTOMTESTS: ${{ inputs.includeCustomTests }}
+ POWERAUTH_TEST_INCLUDECUSTOMTESTS: ${{ inputs.includeCustomTests == '' || inputs.includeCustomTests }} # default includeCustomTests=true even for 'schedule' event
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always()
From 4d0a71ac727216a39320425309052be81909480f Mon Sep 17 00:00:00 2001
From: Jan Dusil <134381434+jandusil@users.noreply.github.com>
Date: Thu, 9 Nov 2023 16:48:49 -0600
Subject: [PATCH 10/27] Fix #290: Update doc for the docker build (#292)
* Fix #290: Update doc for the docker build
- Add docker build section to the root README.md
- Remove old README.md
- Create readme.txt
- Update home page
- Fix index.html
---
powerauth-test-server/README.md | 43 ++++++++++++++++++-
.../deploy/liquibase/readme.txt | 21 +++++++++
powerauth-test-server/docker/README.md | 28 ------------
.../src/main/resources/templates/index.html | 7 ++-
4 files changed, 68 insertions(+), 31 deletions(-)
create mode 100644 powerauth-test-server/deploy/liquibase/readme.txt
delete mode 100644 powerauth-test-server/docker/README.md
diff --git a/powerauth-test-server/README.md b/powerauth-test-server/README.md
index 70b80732..7ae8bccf 100644
--- a/powerauth-test-server/README.md
+++ b/powerauth-test-server/README.md
@@ -1,6 +1,47 @@
# PowerAuth Test Server
-PowerAuth TestServer is deployed to simplify testing of PowerAuth backends. The REST API encapsulates PowerAuth actions which require cryptography with an embedded `powerauth-java-cmd-lib` library.
+PowerAuth Test Server is deployed to simplify testing of PowerAuth backends. The REST API encapsulates PowerAuth actions which require cryptography with an embedded `powerauth-java-cmd-lib` library.
+
+## Docker Build Instructions
+
+Follow these steps to build and run (example commands were run from root) the PowerAuth Test Server Docker image:
+
+### Preparation Steps
+
+1. **Build the WAR File**:
+ Execute the following Maven command to package the `powerauth-test-server` application:
+ ```shell
+ mvn -pl powerauth-test-server clean package
+ ```
+
+2. **Liquibase Scripts**:
+ Copy the Liquibase migration scripts into the Docker build context. For detailed instructions, refer to [readme.txt](deploy/liquibase/readme.txt).
+
+3. **Environment Configuration**:
+ Set up the environment variables using one of the two methods below:
+
+ - **Using an `env.list` File**:
+ Duplicate `powerauth-test-server/docker/env.list.tmp` as `powerauth-test-server/env.list` and modify the values accordingly.
+ - **Using the `-e` Flag**:
+ Directly set environment variables via the Docker run command. For example, to set the database username, you would use:
+ ```shell
+ docker run -e POWERAUTH_TEST_SERVER_DATASOURCE_USERNAME='powerauth' IMAGE
+ ```
+
+4. **Docker Image Build**:
+ Build the Docker image using the provided Dockerfile:
+ ```shell
+ docker build -f powerauth-test-server/Dockerfile -t powerauth-test-server:latest ./powerauth-test-server
+ ```
+
+5. **Run the Docker Image**:
+ Deploy the container with the following command:
+ ```shell
+ docker run -d -p 80:8080 --name powerauth-test-server --env-file ./powerauth-test-server/env.list powerauth-test-server:latest
+ ```
+
+6. **Server Verification**:
+ Confirm the server is operational by navigating to [http://localhost/powerauth-test-server/](http://localhost/powerauth-test-server/) in your web browser. You should see the PowerAuth Test Server home page.
## Test Server Configuration
diff --git a/powerauth-test-server/deploy/liquibase/readme.txt b/powerauth-test-server/deploy/liquibase/readme.txt
new file mode 100644
index 00000000..e9a34079
--- /dev/null
+++ b/powerauth-test-server/deploy/liquibase/readme.txt
@@ -0,0 +1,21 @@
+================================================================================
+ PowerAuth Test Server
+ Liquibase Setup Instructions
+================================================================================
+
+Directory Purpose:
+------------------
+The directory is dedicated to storing Liquibase scripts for Docker build context.
+
+Setup Instructions:
+-------------------
+A) Manually copy all the contents from the following path:
+ 'docs/db/changelog/changesets/powerauth-test-server'
+ to
+ 'powerauth-test-server/deploy/liquibase/data'
+
+ - OR -
+
+B) Utilize the 'copy_liquibase.sh' script available in the
+ 'powerauth-test-server' directory to automate the copying process.
+================================================================================
\ No newline at end of file
diff --git a/powerauth-test-server/docker/README.md b/powerauth-test-server/docker/README.md
deleted file mode 100644
index 984d3627..00000000
--- a/powerauth-test-server/docker/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# How to Build Docker
-
-
-## Build War
-
-```shell
-mvn -pl powerauth-test-server clean package
-```
-
-
-## Build the docker image
-
-```shell
-docker build ./powerauth-test-server -t powerauth-test-server:1.5.0
-```
-
-
-## Prepare environment variables
-
-* Copy `deploy/env.list.tmp` to `./env.list` and edit the values to use it via `docker run --env-file env.list IMAGE`
-* Or set environment variables via `docker run -e POWERAUTH_TEST_SERVER_DATASOURCE_USERNAME='powerauth' IMAGE`
-
-
-## Run the docker image
-
-```shell
-docker run -p 80:8080 powerauth-test-server:1.5.0
-```
diff --git a/powerauth-test-server/src/main/resources/templates/index.html b/powerauth-test-server/src/main/resources/templates/index.html
index f8b29520..5e063bab 100644
--- a/powerauth-test-server/src/main/resources/templates/index.html
+++ b/powerauth-test-server/src/main/resources/templates/index.html
@@ -28,8 +28,11 @@ PowerAuth Test Server
Version version, built on
built.
-
- 2022, © Wultra s.r.o.
+
+ year, © Wultra s.r.o.
+
+
+ 2023, © Wultra s.r.o.