-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from wultra/develop
Merge develop to master
- Loading branch information
Showing
25 changed files
with
274 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="TestServerApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> | ||
<option name="ACTIVE_PROFILES" value="dev" /> | ||
<module name="powerauth-test-server" /> | ||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.wultra.security.powerauth.app.testserver.TestServerApplication" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/powerauth-test-server/pom.xml" goal="process-resources" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, [email protected] | ||
*/ | ||
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<ServerStatusResponse> 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<StepItem> isStepItemDecryptedResponse() { | ||
return stepItem -> "Decrypted Response".equals(stepItem.name()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ibm-semeru-runtimes:open-17.0.8_7-jre | ||
FROM ibm-semeru-runtimes:open-17.0.9_9-jre | ||
LABEL maintainer="[email protected]" | ||
|
||
# Prepare environment variables | ||
|
@@ -8,7 +8,7 @@ ENV JAVA_HOME=/opt/java/openjdk \ | |
LB_VERSION=4.23.2 \ | ||
TOMCAT_HOME=/usr/local/tomcat \ | ||
TOMCAT_MAJOR=10 \ | ||
TOMCAT_VERSION=10.1.13 \ | ||
TOMCAT_VERSION=10.1.17 \ | ||
LOGBACK_CONF=/opt/logback/conf \ | ||
TZ=UTC | ||
|
||
|
@@ -21,7 +21,7 @@ RUN apt-get -y update \ | |
|
||
# Install tomcat | ||
RUN curl -jkSL -o /tmp/apache-tomcat.tar.gz http://archive.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz \ | ||
&& [ "406c0c367ac6ad95bb724ecc3a3c340ad7ded8c62287d657811eeec496eaaca1f5add52d2f46111da1426ae67090c543f6deccfeb5fdf4bdae32f9b39e773265 /tmp/apache-tomcat.tar.gz" = "$(sha512sum /tmp/apache-tomcat.tar.gz)" ] \ | ||
&& [ "ff9670f9cd49a604e47edfbcfb5855fe59342048c3278ea8736276b51327adf2d076973f3ad1b8aa7870ef26c28cf7111527be810b445c9927f2a457795f5cb6 /tmp/apache-tomcat.tar.gz" = "$(sha512sum /tmp/apache-tomcat.tar.gz)" ] \ | ||
&& gunzip /tmp/apache-tomcat.tar.gz \ | ||
&& tar -C /opt -xf /tmp/apache-tomcat.tar \ | ||
&& ln -s /opt/apache-tomcat-$TOMCAT_VERSION $TOMCAT_HOME | ||
|
Oops, something went wrong.