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 42faa90d2e31f562c5a3a2f21480635ac98042a7 Author: Raphael Ouazana <raphael.ouaz...@linagora.com> AuthorDate: Thu Nov 14 16:32:15 2019 +0100 James-2949 Fix tokens with valid usernames when needed, regenerate public key --- .../apache/james/modules/TestJMAPServerModule.java | 52 +++++++++++++++++----- .../apache/james/jmap/JMAPAuthenticationTest.java | 18 ++++---- .../integration/GetMailboxesMethodTest.java | 12 ++--- 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java index 6c5e5ec..8252360 100644 --- a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java +++ b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java @@ -34,16 +34,48 @@ import com.google.inject.name.Names; public class TestJMAPServerModule extends AbstractModule { - private static final String PUBLIC_PEM_KEY = - "-----BEGIN PUBLIC KEY-----\n" - + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" - + "16XrMRf6M4NeyGa7j5+1UKm42IKUf3lM28oe82MqIIRyvskPc11NuzSor8HmvH8H\n" - + "lhDs5DyJtx2qp35AT0zCqfwlaDnlDc/QDlZv1CoRZGpQk1Inyh6SbZwYpxxwh0fi\n" - + "+d/4RpE3LBVo8wgOaXPylOlHxsDizfkL8QwXItyakBfMO6jWQRrj7/9WDhGf4Hi+\n" - + "GQur1tPGZDl9mvCoRHjFrD5M/yypIPlfMGWFVEvV5jClNMLAQ9bYFuOc7H1fEWw6\n" - + "U1LZUUbJW9/CH45YXz82CYqkrfbnQxqRb2iVbVjs/sHopHd1NTiCfUtwvcYJiBVj\n" - + "kwIDAQAB\n" - + "-----END PUBLIC KEY-----"; + private static final String PUBLIC_PEM_KEY = + "-----BEGIN PUBLIC KEY-----\n" + + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8RfttZlaFNar/3GcU9RG\n" + + "3/2ZGi7PMI8B75XaX3AG2J1Mvl30Dl+yZ8tQKGGd/eelQsQAQboGXCHB/wCHR7n8\n" + + "CSF/E0hjRu6FK/2D6VTnn5BMiiPWPcEpLGT7CsGQPFZ54R0e5vJcGTty9Da/3Z+C\n" + + "YvrpupecrmJXCXwBwhm4WPb1woTfv9gVtTMpKOhfzmrGURy8nJ+1s4Lli46/UBIu\n" + + "fzTmzng4rXouLMvkq7eS4jIWtB0ifXHmPwRN/YhGmuq+GYG59KQ1iStSxVi9Nuzy\n" + + "Ik8eH3KeLx/2BuSshSwnnnYbxHEfR+p6H4oqKjTGutvLNamBRFKpj7CcryKbgVG0\n" + + "zwIDAQAB\n" + + "-----END PUBLIC KEY-----\n"; + + // For commodity, here is the matching private key, allowing to generate easily token if needed + // for example using jwt.io. + @SuppressWarnings("unused") + private static final String UNUSED_PRIVATE_KEY = + "-----BEGIN RSA PRIVATE KEY-----\n" + + "MIIEogIBAAKCAQEA8RfttZlaFNar/3GcU9RG3/2ZGi7PMI8B75XaX3AG2J1Mvl30\n" + + "Dl+yZ8tQKGGd/eelQsQAQboGXCHB/wCHR7n8CSF/E0hjRu6FK/2D6VTnn5BMiiPW\n" + + "PcEpLGT7CsGQPFZ54R0e5vJcGTty9Da/3Z+CYvrpupecrmJXCXwBwhm4WPb1woTf\n" + + "v9gVtTMpKOhfzmrGURy8nJ+1s4Lli46/UBIufzTmzng4rXouLMvkq7eS4jIWtB0i\n" + + "fXHmPwRN/YhGmuq+GYG59KQ1iStSxVi9NuzyIk8eH3KeLx/2BuSshSwnnnYbxHEf\n" + + "R+p6H4oqKjTGutvLNamBRFKpj7CcryKbgVG0zwIDAQABAoIBADGzIxeag01ka5R/\n" + + "ESDe07V9C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OSOIPB5FC7T7t/5XXn6mW9gRktv0e6Ib+h\n" + + "FilHAoGAMA32OsmvG+tHam8FjrUgNNyBrdO2yfFNOWLDVt9CYIYSQa4dVpUKAyOH\n" + + "CF52SG6Ki1L0z001yrJ7gBk/i6KD9h+7izzs+16DSbWTPB3R16BVjRVoXgmg0vh5\n" + + "ICQil1aaN7/2au+p7E4n7nzfYG7nRX5syDoqgBbdhpJxV8/5ohA=\n" + + "-----END RSA PRIVATE KEY-----\n"; public static JMAPConfiguration.Builder jmapConfigurationBuilder() { return JMAPConfiguration.builder() diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java index 6d8a5212..acb2973 100644 --- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java +++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java @@ -335,11 +335,10 @@ public abstract class JMAPAuthenticationTest { @Category(BasicFeature.class) @Test public void getMustReturnEndpointsWhenValidJwtAuthorizationHeader() throws Exception { - String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0.T04BTk" + - "LXkJj24coSZkK13RfG25lpvmSl2MJ7N10KpBk9_-95EGYZdog-BDAn3PJzqVw52z-Bwjh4VOj1-j7cURu0cT4jXehhUrlCxS4n7QHZ" + - "DN_bsEYGu7KzjWTpTsUiHe-rN7izXVFxDGG1TGwlmBCBnPW-EFCf9ylUsJi0r2BKNdaaPRfMIrHptH1zJBkkUziWpBN1RNLjmvlAUf" + - "49t1Tbv21ZqYM5Ht2vrhJWczFbuC-TD-8zJkXhjTmA1GVgomIX5dx1cH-dZX1wANNmshUJGHgepWlPU-5VIYxPEhb219RMLJIELMY2" + - "qNOR8Q31ydinyqzXvCSzVJOf6T60-w"; + String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyQGRvbWFpbi50bGQifQ.U-dUPv6OU6KO5N7CooHUfMkCd" + + "FJHx2F3H4fm7Q79g1BPfBSkifPj5xyVlZ0JwEGXypC4zBw9ay3l4DxzX7D_6p1Hx_ihXsoLx1Ca-WUo44x-XRSpPfgxiZjHCJkGBLMV3RZlA" + + "jip-d18mxkcX3JGplX_sCQkFisduAOAHuKSUg9wI6VBgUQi_0B35FYv6tP_bD6eFtvaAUN9QyXXh8UQjEp8CO12lRz6enfLx_V6BG_fEMkee" + + "6vRqdEqx_F9OF3eWTe1giMp_JhQ7_l1OXXtbd4TndVvTeuVy4irPbsRc-M8x_-qTDpFp6saRRsyOcFspxPp5n3yIhEK7B3UZiseXw"; given() .header("Authorization", "Bearer " + token) @@ -351,11 +350,10 @@ public abstract class JMAPAuthenticationTest { @Test public void getMustReturnEndpointsWhenValidUnkwnonUserJwtAuthorizationHeader() throws Exception { - String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6Ik5ldyBVc2VyIn0.ci8U04EOWKpi_y" - + "faKs8fnCBcu1mWs8fvf-t9SDP2kkvDDfD-ya4sEGn4ueCp2dA2ndefZfVu_IfvdlVtxqzSf0tQ-dFKrIe-OtSKhI2otjWctLtk9A" - + "G7jpWkXoDgr5IOVmsqg37Zxc2bgkLkC5FJqV6oCp51TNQTH6zZbXIUeuGFbHj2-iJeX8sACKTQB0llwc6TFm7GYUF03rv4DfJjqp" - + "Kd0g8RdnlevSOjV-gGzvKEItugtexS5pgOZ2GYcvqEUDb9EnQR7Qe2EzPAX_FCJfGhlv7bDQlTgOHHAjqw2lD4-zeAznw-3wlYLS" - + "zhi4ivvPjT-y2T5wnnhzeeYOpYOQ"; + String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1bmtub3duQGRvbWFpbi50bGQifQ.hr8AhlNIpiA3Mv_A5ZLyL" + + "f1BHeBSaRDfdR_GLV_hlPdIrWv1xtwjBH86E1YnTPx2tTpr_NWTbHcR1OCkuVCpgloEnUNbE3U2l0WrGOX2Eh9dWCXOCtrNvCeSHQuvx5_8W" + + "nSVENYidk7o2icE8_gz_Giwf0Z3bHJJYXfAxupv__tCkmhqt3E888VZPjs26AsqxQ29YyX0Fjx8UwKbPrH5-tnyftX-kLjjZNtahVIVtbW4v" + + "b8rEEZ4nzqxHqtI2co6yCXjgyoFMdDAKCOU-Bq35Gdo-Qiu8l7a0kQGhuhkjoaVWvw4bcSvunxAnh_0W5g3Lw-rwljNu2JrJS0gAH6NDA"; given() .header("Authorization", "Bearer " + token) diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java index aeb2286..daa5fe1 100644 --- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java +++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java @@ -351,12 +351,12 @@ public abstract class GetMailboxesMethodTest { @Category(BasicFeature.class) @Test public void getMailboxesShouldReturnDefaultMailboxesWhenAuthenticatedUserDoesntHaveAnAccountYet() { - String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3QGRvbWFpbi50bGQiLCJuYW1lIjoiTmV3IFVzZXIif" - + "Q.fxNWNzksXyCij2ooVi-QfGe9vTicF2N9FDtWSJdjWTjhwoQ_i0dgiT8clp4dtOJzy78hB2UkAW-iq7z3PR_Gz0qFah7EbYoEs" - + "5lQs1UlhNGCRTvIsyR8qHUXtA6emw9x0nuMnswtyXhzoA-cEHCArrMxMeWhTYi2l4od3G8Irrvu1Yc5hKLwLgPdnImbKyB5a89T" - + "vzuZE8-FVyMmhlaJA2T1GpbsaUnfE1ki_bBzqMHTD_Ob7oSVzz2UOiOeL-ombn1X9GbYQ2I-Ob4V84WHONYxw0VjPHlj9saZ2n7" - + "2RJTBsIo6flJT-MchaEvTYBvuV_wlCCQYjI1g7mdeD6aXfw"; - + String token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3QGRvbWFpbi50bGQiLCJuYW1lIjoiTmV3IFVzZXIif" + + "Q.bPeoAWAOyu4teilj27cL4uZ9jBO9zJOus3mJdqZYEeDe9OZeweopqkIE7ljuh-iTxBDE-f3OqaEqGa_mi6eOYT7XXAEPolcEAe4EooU" + + "lI8anYMrSlbMPBKGymH-QTWIcPS5P8XNFnIn94XheuEIXeaRHNvO5-SgENbFYS19kgyzOV54umQtIAewLyMdvG6aooLSk6lEy3AhVPIfl" + + "QJm6MLOsNzHMj7F7mM0Wm6QBfYeWIHzQLtEgGFFLyqeSXyzbgbbec2WYpVjXHNyWhAFcq7OMjOb2UEmb9gKr1fkL_XZgXna2CW46hzwaG" + + "jNO-6ZWpHjLfDEP7oHui51Hn_wJfw"; + given() .header("Authorization", "Bearer " + token) .body("[[\"getMailboxes\", {}, \"#0\"]]") --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org