You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/06/17 11:04:40 UTC

[james-project] 08/09: JAMES-2146 Add a test of loading keystore in different versions

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit aafeb6f63f59ee14328bc822e08a15ca6ca69458
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Fri Jun 7 10:16:14 2019 +0700

    JAMES-2146 Add a test of loading keystore in different versions
---
 .../james/jmap/crypto/SecurityKeyLoaderTest.java   |  25 +++++++++++++++++++++
 .../jmap/src/test/resources/keystoreJava11         | Bin 0 -> 2581 bytes
 .../jmap/src/test/resources/keystoreJava7          | Bin 0 -> 2239 bytes
 3 files changed, 25 insertions(+)

diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java
index c47f33f..8c5675a 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java
@@ -30,6 +30,8 @@ import java.util.Optional;
 import org.apache.james.filesystem.api.FileSystemFixture;
 import org.apache.james.jmap.JMAPConfiguration;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 class SecurityKeyLoaderTest {
 
@@ -85,4 +87,27 @@ class SecurityKeyLoaderTest {
         assertThat(loader.load())
             .isNotNull();
     }
+
+    @ParameterizedTest
+    @ValueSource(strings = {
+        "keystoreJava7",
+        "keystoreJava11",
+    })
+    void loadShouldReturnSecurityKeysWhenUsingKeyStoreGeneratedByDifferentJavaVersions(
+        String keyStoreInDifferentVersion) throws Exception {
+
+        JMAPConfiguration jmapConfiguration = JMAPConfiguration.builder()
+            .enable()
+            .jwtPublicKeyPem(Optional.of(JWT_PUBLIC_KEY))
+            .keystore(keyStoreInDifferentVersion)
+            .secret("james72laBalle")
+            .build();
+
+        SecurityKeyLoader loader = new SecurityKeyLoader(
+            FileSystemFixture.CLASSPATH_FILE_SYSTEM,
+            jmapConfiguration);
+
+        assertThat(loader.load())
+            .isNotNull();
+    }
 }
\ No newline at end of file
diff --git a/server/protocols/jmap/src/test/resources/keystoreJava11 b/server/protocols/jmap/src/test/resources/keystoreJava11
new file mode 100644
index 0000000..e4492c3
Binary files /dev/null and b/server/protocols/jmap/src/test/resources/keystoreJava11 differ
diff --git a/server/protocols/jmap/src/test/resources/keystoreJava7 b/server/protocols/jmap/src/test/resources/keystoreJava7
new file mode 100644
index 0000000..aa45ad0
Binary files /dev/null and b/server/protocols/jmap/src/test/resources/keystoreJava7 differ


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org