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 5ff0c873291bddd3ea7def5b15a11bcb6dcdb4df
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Thu Oct 29 08:50:47 2020 +0700

    JAMES-2891 JMAP Session: Add {accountId} as a compulsory parameter of 
upload URL
---
 .../james/jmap/rfc8621/contract/SessionRoutesContract.scala      | 2 +-
 .../main/scala/org/apache/james/jmap/http/SessionRoutes.scala    | 3 +--
 .../org/apache/james/jmap/model/JmapRfc8621Configuration.scala   | 2 +-
 .../scala/org/apache/james/jmap/http/SessionRoutesTest.scala     | 9 +++++----
 .../apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala   | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

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 aac2416..7fc769e 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
@@ -103,7 +103,7 @@ object SessionRoutesContract {
                          |  "username" : "b...@domain.tld",
                          |  "apiUrl" : "http://domain.com/jmap";,
                          |  "downloadUrl" : 
"http://domain.com/download/{accountId}/{blobId}/?type={type}&name={name}";,
-                         |  "uploadUrl" : "http://domain.com/upload";,
+                         |  "uploadUrl" : 
"http://domain.com/upload/{accountId}";,
                          |  "eventSourceUrl" : "http://domain.com/eventSource";,
                          |  "state" : "000001"
                          |}""".stripMargin
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
index 10f1565..33e9598 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/SessionRoutes.scala
@@ -27,9 +27,8 @@ import io.netty.handler.codec.http.HttpResponseStatus.OK
 import javax.inject.{Inject, Named}
 import org.apache.james.jmap.HttpConstants.JSON_CONTENT_TYPE_UTF8
 import org.apache.james.jmap.JMAPRoutes.CORS_CONTROL
-import org.apache.james.jmap.JMAPUrls.AUTHENTICATION
 import org.apache.james.jmap.exceptions.UnauthorizedException
-import org.apache.james.jmap.http.SessionRoutes.{JMAP_SESSION, 
WELL_KNOWN_JMAP, LOGGER}
+import org.apache.james.jmap.http.SessionRoutes.{JMAP_SESSION, LOGGER, 
WELL_KNOWN_JMAP}
 import org.apache.james.jmap.http.rfc8621.InjectionKeys
 import org.apache.james.jmap.json.ResponseSerializer
 import org.apache.james.jmap.model.Session
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
index aea142d..5897623 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
@@ -46,6 +46,6 @@ case class JmapRfc8621Configuration(urlPrefixString: String, 
maxUploadSize: MaxS
   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")
+  val uploadUrl: URL = new URL(s"$urlPrefixString/upload/{accountId}")
   val eventSourceUrl: URL = new URL(s"$urlPrefixString/eventSource")
 }
diff --git 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
index b466742..1f3083c 100644
--- 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
@@ -33,6 +33,7 @@ import org.apache.james.core.Username
 import org.apache.james.jmap._
 import org.apache.james.jmap.http.SessionRoutesTest.{BOB, TEST_CONFIGURATION}
 import org.apache.james.jmap.model.JmapRfc8621Configuration
+import 
org.apache.james.jmap.model.JmapRfc8621Configuration.LOCALHOST_URL_PREFIX
 import org.apache.james.mailbox.MailboxSession
 import org.mockito.ArgumentMatchers.any
 import org.mockito.Mockito._
@@ -177,10 +178,10 @@ class SessionRoutesTest extends AnyFlatSpec with 
BeforeAndAfter with Matchers {
                          |    "urn:ietf:params:jmap:vacationresponse": 
"0fe275bf13ff761407c17f64b1dfae2f4b3186feea223d7267b79f873a105401"
                          |  },
                          |  "username" : "b...@james.org",
-                         |  "apiUrl" : 
"${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/jmap",
-                         |  "downloadUrl" : 
"${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/$downloadPath",
-                         |  "uploadUrl" : 
"${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/upload",
-                         |  "eventSourceUrl" : 
"${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/eventSource",
+                         |  "apiUrl" : "$LOCALHOST_URL_PREFIX/jmap",
+                         |  "downloadUrl" : 
"$LOCALHOST_URL_PREFIX/$downloadPath",
+                         |  "uploadUrl" : 
"$LOCALHOST_URL_PREFIX/upload/{accountId}",
+                         |  "eventSourceUrl" : 
"$LOCALHOST_URL_PREFIX/eventSource",
                          |  "state" : "000001"
                          |}""".stripMargin
 
diff --git 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
index 1c84bae..5d82b91 100644
--- 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
@@ -43,7 +43,7 @@ class JmapRfc8621ConfigurationTest extends AnyWordSpec with 
Matchers {
 
       jmapRfc8621Configuration.apiUrl must be(new 
URL("http://random-domain.com/jmap";))
       jmapRfc8621Configuration.downloadUrl must be(new 
URL("http://random-domain.com/download/{accountId}/{blobId}/?type={type}&name={name}";))
-      jmapRfc8621Configuration.uploadUrl must be(new 
URL("http://random-domain.com/upload";))
+      jmapRfc8621Configuration.uploadUrl must be(new 
URL("http://random-domain.com/upload/{accountId}";))
       jmapRfc8621Configuration.eventSourceUrl must be(new 
URL("http://random-domain.com/eventSource";))
     }
 
@@ -52,7 +52,7 @@ class JmapRfc8621ConfigurationTest extends AnyWordSpec with 
Matchers {
 
       jmapRfc8621Configuration.apiUrl must be(new URL("http://localhost/jmap";))
       jmapRfc8621Configuration.downloadUrl must be(new 
URL("http://localhost/download/{accountId}/{blobId}/?type={type}&name={name}";))
-      jmapRfc8621Configuration.uploadUrl must be(new 
URL("http://localhost/upload";))
+      jmapRfc8621Configuration.uploadUrl must be(new 
URL("http://localhost/upload/{accountId}";))
       jmapRfc8621Configuration.eventSourceUrl must be(new 
URL("http://localhost/eventSource";))
     }
   }


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

Reply via email to