You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/05/18 09:49:33 UTC

[james-project] branch master updated (bb914b8 -> 150a409)

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

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


    from bb914b8  JAMES-3261 Remove mistakenly added keystore
     new 745dedc  JAMES-3491 Configurable websocket url for JMAP configuration
     new 150a409  JAMES-3491 Add documentation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/modules/servers/pages/distributed/configure/jmap.adoc    |  4 ++++
 .../src/test/resources/jmap.properties                        |  1 +
 .../james/jmap/rfc8621/contract/CustomMethodContract.scala    |  6 +++---
 .../james/jmap/rfc8621/contract/SessionRoutesContract.scala   |  4 ++--
 .../src/test/resources/jmap.properties                        |  1 +
 .../main/scala/org/apache/james/jmap/core/Capabilities.scala  |  4 ++--
 .../main/scala/org/apache/james/jmap/core/Capability.scala    |  5 +++--
 .../org/apache/james/jmap/core/JmapRfc8621Configuration.scala | 11 +++++++----
 .../org/apache/james/jmap/routes/JMAPApiRoutesTest.scala      |  4 ++--
 .../org/apache/james/jmap/routes/SessionRoutesTest.scala      |  4 ++--
 src/site/xdoc/server/config-jmap.xml                          |  4 ++++
 11 files changed, 31 insertions(+), 17 deletions(-)

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


[james-project] 01/02: JAMES-3491 Configurable websocket url for JMAP configuration

Posted by bt...@apache.org.
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 745dedc62844b0f5651c89431d27020fea2d1af7
Author: Lan Khuat <kh...@gmail.com>
AuthorDate: Mon May 10 14:49:29 2021 +0700

    JAMES-3491 Configurable websocket url for JMAP configuration
---
 .../src/test/resources/jmap.properties                        |  1 +
 .../james/jmap/rfc8621/contract/CustomMethodContract.scala    |  6 +++---
 .../james/jmap/rfc8621/contract/SessionRoutesContract.scala   |  4 ++--
 .../src/test/resources/jmap.properties                        |  1 +
 .../main/scala/org/apache/james/jmap/core/Capabilities.scala  |  4 ++--
 .../main/scala/org/apache/james/jmap/core/Capability.scala    |  5 +++--
 .../org/apache/james/jmap/core/JmapRfc8621Configuration.scala | 11 +++++++----
 .../org/apache/james/jmap/routes/JMAPApiRoutesTest.scala      |  4 ++--
 .../org/apache/james/jmap/routes/SessionRoutesTest.scala      |  4 ++--
 9 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
index aa1cd40..e04d1d8 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
+++ b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
@@ -1,3 +1,4 @@
 # Configuration urlPrefix for JMAP routes.
 url.prefix=http://domain.com
+websocket.url.prefix=ws://domain.com
 upload.max.size=20M
\ No newline at end of file
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/CustomMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/CustomMethodContract.scala
index f2b9672..b480150 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/CustomMethodContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/CustomMethodContract.scala
@@ -40,7 +40,7 @@ import org.apache.james.jmap.draft.JmapGuiceProbe
 import org.apache.james.jmap.http.UserCredential
 import org.apache.james.jmap.method.{InvocationWithContext, Method}
 import org.apache.james.jmap.rfc8621.contract.CustomMethodContract.CUSTOM
-import org.apache.james.jmap.rfc8621.contract.Fixture.{ACCEPT_RFC8621_VERSION_HEADER, BOB, BOB_PASSWORD, DOMAIN, authScheme, baseRequestSpecBuilder}
+import org.apache.james.jmap.rfc8621.contract.Fixture._
 import org.apache.james.mailbox.MailboxSession
 import org.apache.james.utils.{DataProbeImpl, GuiceProbe}
 import org.junit.jupiter.api.{BeforeEach, Test}
@@ -92,7 +92,7 @@ object CustomMethodContract {
       |    },
       |    "urn:ietf:params:jmap:websocket": {
       |      "supportsPush": true,
-      |      "url": "http://domain.com/jmap/ws"
+      |      "url": "ws://domain.com/jmap/ws"
       |    },
       |    "urn:apache:james:params:jmap:mail:quota": {},
       |    "$CUSTOM": {"custom": "property"},
@@ -112,7 +112,7 @@ object CustomMethodContract {
       |        },
       |        "urn:ietf:params:jmap:websocket": {
       |            "supportsPush": true,
-      |            "url": "http://domain.com/jmap/ws"
+      |            "url": "ws://domain.com/jmap/ws"
       |        },
       |        "urn:ietf:params:jmap:core" : {
       |          "maxSizeUpload" : 20971520,
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
index c7737c7..a8b52a3 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
@@ -65,7 +65,7 @@ object SessionRoutesContract {
                          |    },
                          |    "urn:ietf:params:jmap:websocket": {
                          |      "supportsPush": true,
-                         |      "url": "http://domain.com/jmap/ws"
+                         |      "url": "ws://domain.com/jmap/ws"
                          |    },
                          |    "urn:apache:james:params:jmap:mail:quota": {},
                          |    "urn:apache:james:params:jmap:mail:shares": {},
@@ -84,7 +84,7 @@ object SessionRoutesContract {
                          |        },
                          |        "urn:ietf:params:jmap:websocket": {
                          |            "supportsPush": true,
-                         |            "url": "http://domain.com/jmap/ws"
+                         |            "url": "ws://domain.com/jmap/ws"
                          |        },
                          |        "urn:ietf:params:jmap:core" : {
                          |          "maxSizeUpload" : 20971520,
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
index aa1cd40..e04d1d8 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
+++ b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/jmap.properties
@@ -1,3 +1,4 @@
 # Configuration urlPrefix for JMAP routes.
 url.prefix=http://domain.com
+websocket.url.prefix=ws://domain.com
 upload.max.size=20M
\ No newline at end of file
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capabilities.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capabilities.scala
index ef46ff0..6a899c0 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capabilities.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capabilities.scala
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.jmap.core
 
-import java.net.URL
+import java.net.URI
 
 import eu.timepit.refined.auto._
 import org.apache.james.jmap.core.CapabilityIdentifier.CapabilityIdentifier
@@ -35,7 +35,7 @@ object DefaultCapabilities {
       MaxObjectsInSet(500L),
       collationAlgorithms = List("i;unicode-casemap")))
 
-  def webSocketCapability(url: URL) = WebSocketCapability(
+  def webSocketCapability(url: URI) = WebSocketCapability(
     properties = WebSocketCapabilityProperties(SupportsPush(true), url))
 
   val MAIL_CAPABILITY = MailCapability(
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capability.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capability.scala
index d69ab77..920d087 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capability.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/Capability.scala
@@ -19,7 +19,8 @@
 
 package org.apache.james.jmap.core
 
-import java.net.URL
+import java.net.URI
+
 import eu.timepit.refined
 import eu.timepit.refined.api.Refined
 import eu.timepit.refined.auto._
@@ -95,7 +96,7 @@ final case class CoreCapabilityProperties(maxSizeUpload: MaxSizeUpload,
 }
 
 final case class WebSocketCapabilityProperties(supportsPush: SupportsPush,
-                                               url: URL) extends CapabilityProperties {
+                                               url: URI) extends CapabilityProperties {
   override def jsonify(): JsObject = ResponseSerializer.webSocketPropertiesWrites.writes(this)
 }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala
index 4501459..d100f2b 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/JmapRfc8621Configuration.scala
@@ -19,7 +19,7 @@
 
 package org.apache.james.jmap.core
 
-import java.net.URL
+import java.net.{URI, URL}
 
 import org.apache.commons.configuration2.Configuration
 import org.apache.james.jmap.core.JmapRfc8621Configuration.UPLOAD_LIMIT_30_MB
@@ -27,14 +27,17 @@ import org.apache.james.util.Size
 
 object JmapRfc8621Configuration {
   val LOCALHOST_URL_PREFIX: String = "http://localhost"
+  val LOCALHOST_WEBSOCKET_URL_PREFIX: String = "ws://localhost"
   val UPLOAD_LIMIT_30_MB: MaxSizeUpload = MaxSizeUpload.of(Size.of(30L, Size.Unit.M)).get
-  val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration = JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, UPLOAD_LIMIT_30_MB)
+  val LOCALHOST_CONFIGURATION: JmapRfc8621Configuration = JmapRfc8621Configuration(LOCALHOST_URL_PREFIX, LOCALHOST_WEBSOCKET_URL_PREFIX, UPLOAD_LIMIT_30_MB)
   val URL_PREFIX_PROPERTIES: String = "url.prefix"
+  val WEBSOCKET_URL_PREFIX_PROPERTIES: String = "websocket.url.prefix"
   val UPLOAD_LIMIT_PROPERTIES: String = "upload.max.size"
 
   def from(configuration: Configuration): JmapRfc8621Configuration = {
     JmapRfc8621Configuration(
       urlPrefixString = Option(configuration.getString(URL_PREFIX_PROPERTIES)).getOrElse(LOCALHOST_URL_PREFIX),
+      websocketPrefixString = Option(configuration.getString(WEBSOCKET_URL_PREFIX_PROPERTIES)).getOrElse(LOCALHOST_WEBSOCKET_URL_PREFIX),
       maxUploadSize = Option(configuration.getString(UPLOAD_LIMIT_PROPERTIES, null))
         .map(Size.parse)
         .map(MaxSizeUpload.of(_).get)
@@ -42,11 +45,11 @@ object JmapRfc8621Configuration {
   }
 }
 
-case class JmapRfc8621Configuration(urlPrefixString: String, maxUploadSize: MaxSizeUpload = UPLOAD_LIMIT_30_MB) {
+case class JmapRfc8621Configuration(urlPrefixString: String, websocketPrefixString: String, maxUploadSize: MaxSizeUpload = UPLOAD_LIMIT_30_MB) {
   val urlPrefix: URL = new URL(urlPrefixString)
   val apiUrl: URL = new URL(s"$urlPrefixString/jmap")
   val downloadUrl: URL = new URL(urlPrefixString + "/download/{accountId}/{blobId}/?type={type}&name={name}")
   val uploadUrl: URL = new URL(s"$urlPrefixString/upload/{accountId}")
   val eventSourceUrl: URL = new URL(s"$urlPrefixString/eventSource?types={types}&closeAfter={closeafter}&ping={ping}")
-  val webSocketUrl: URL = new URL(s"$urlPrefixString/jmap/ws")
+  val webSocketUrl: URI = new URI(s"$websocketPrefixString/jmap/ws")
 }
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
index da32739..84c7d47 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
@@ -78,7 +78,7 @@ object JMAPApiRoutesTest {
   private val userProvisionner: UserProvisioning = new UserProvisioning(usersRepository, new RecordingMetricFactory)
   private val JMAP_METHODS: Set[Method] = Set(new CoreEchoMethod)
 
-  private val JMAP_API_ROUTE: JMAPApiRoutes = new JMAPApiRoutes(AUTHENTICATOR, userProvisionner, new JMAPApi(JMAP_METHODS, DefaultCapabilities.supported(JmapRfc8621Configuration("http://127.0.0.1")).capabilities.toSet))
+  private val JMAP_API_ROUTE: JMAPApiRoutes = new JMAPApiRoutes(AUTHENTICATOR, userProvisionner, new JMAPApi(JMAP_METHODS, DefaultCapabilities.supported(JmapRfc8621Configuration("http://127.0.0.1", "ws://127.0.0.1")).capabilities.toSet))
   private val ROUTES_HANDLER: ImmutableSet[JMAPRoutesHandler] = ImmutableSet.of(new JMAPRoutesHandler(Version.RFC8621, JMAP_API_ROUTE))
 
   private val userBase64String: String = Base64.getEncoder.encodeToString("user1:password".getBytes(StandardCharsets.UTF_8))
@@ -442,7 +442,7 @@ class JMAPApiRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
     when(mockCoreEchoMethod.requiredCapabilities).thenReturn(Set(JMAP_CORE))
 
     val methods: Set[Method] = Set(mockCoreEchoMethod)
-    val apiRoute: JMAPApiRoutes = new JMAPApiRoutes(AUTHENTICATOR, userProvisionner, new JMAPApi(methods, DefaultCapabilities.supported(JmapRfc8621Configuration("http://127.0.0.1")).capabilities.toSet))
+    val apiRoute: JMAPApiRoutes = new JMAPApiRoutes(AUTHENTICATOR, userProvisionner, new JMAPApi(methods, DefaultCapabilities.supported(JmapRfc8621Configuration("http://127.0.0.1", "ws://127.0.0.1")).capabilities.toSet))
     val routesHandler: ImmutableSet[JMAPRoutesHandler] = ImmutableSet.of(new JMAPRoutesHandler(Version.RFC8621, apiRoute))
 
     val versionParser: VersionParser = new VersionParser(SUPPORTED_VERSIONS, JMAPConfiguration.DEFAULT)
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/SessionRoutesTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/SessionRoutesTest.scala
index 4ca303c..0e81e21 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/SessionRoutesTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/SessionRoutesTest.scala
@@ -146,7 +146,7 @@ class SessionRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
                          |    },
                          |    "urn:ietf:params:jmap:websocket": {
                          |      "supportsPush": true,
-                         |      "url": "http://localhost/jmap/ws"
+                         |      "url": "ws://localhost/jmap/ws"
                          |    },
                          |    "urn:apache:james:params:jmap:mail:quota": {},
                          |    "urn:apache:james:params:jmap:mail:shares": {},
@@ -164,7 +164,7 @@ class SessionRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
                          |        },
                          |        "urn:ietf:params:jmap:websocket": {
                          |            "supportsPush": true,
-                         |            "url": "http://localhost/jmap/ws"
+                         |            "url": "ws://localhost/jmap/ws"
                          |        },
                          |        "urn:ietf:params:jmap:core" : {
                          |          "maxSizeUpload" : 31457280,

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


[james-project] 02/02: JAMES-3491 Add documentation

Posted by bt...@apache.org.
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 150a409023d0c0b89c1d0c975628b9426cc881eb
Author: Lan Khuat <kh...@gmail.com>
AuthorDate: Tue May 11 17:34:43 2021 +0700

    JAMES-3491 Add documentation
---
 docs/modules/servers/pages/distributed/configure/jmap.adoc | 4 ++++
 src/site/xdoc/server/config-jmap.xml                       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/docs/modules/servers/pages/distributed/configure/jmap.adoc b/docs/modules/servers/pages/distributed/configure/jmap.adoc
index 78f47c7..8084600 100644
--- a/docs/modules/servers/pages/distributed/configure/jmap.adoc
+++ b/docs/modules/servers/pages/distributed/configure/jmap.adoc
@@ -33,6 +33,10 @@ This should not be the same keystore than the ones used by TLS based protocols.
 | Optional. Configuration urlPrefix for JMAP routes.
 | Default value: http://localhost.
 
+| websocket.url.prefix
+| Optional. URL for JMAP WebSocket route.
+| Default value: ws://localhost
+
 | upload.max.size
 | Optional. Configuration max size Upload in new JMAP-RFC-8621.
 | Default value: 30M. Supported units are B (bytes) K (KB) M (MB) G (GB).
diff --git a/src/site/xdoc/server/config-jmap.xml b/src/site/xdoc/server/config-jmap.xml
index 703e436..c90cfed 100644
--- a/src/site/xdoc/server/config-jmap.xml
+++ b/src/site/xdoc/server/config-jmap.xml
@@ -61,6 +61,10 @@
                     <dd>Optional. Configuration urlPrefix for JMAP routes.</dd>
                     <dd>Default value: http://localhost.</dd>
 
+                    <dt><strong>websocket.url.prefix</strong></dt>
+                    <dd>Optional. URL for JMAP WebSocket route</dd>
+                    <dd>Default value: ws://localhost</dd>
+
                     <dt><strong>upload.max.size</strong></dt>
                     <dd>Optional. Configuration max size Upload in new JMAP-RFC-8621.</dd>
                     <dd>Default value: 30M. Supported units are B (bytes) K (KB) M (MB) G (GB).</dd>

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