Repository: james-project
Updated Branches:
  refs/heads/master 9b350580b -> 69818cf75


JAMES-2526 Introduce public routes in WebAdmin


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/61b72f1c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/61b72f1c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/61b72f1c

Branch: refs/heads/master
Commit: 61b72f1c0abf0d161593b08c589946092daa6e50
Parents: 9b35058
Author: Antoine Duprat <[email protected]>
Authored: Wed Aug 22 16:50:16 2018 +0200
Committer: Antoine Duprat <[email protected]>
Committed: Wed Aug 29 11:33:20 2018 +0200

----------------------------------------------------------------------
 .../modules/server/HealthCheckRoutesModule.java |   4 +-
 .../integration/AuthorizedEndpointsTest.java    |  73 ++
 .../integration/UnauthorizedEndpointsTest.java  | 771 +++++++++++++++++++
 .../integration/UnauthorizedModule.java         |  47 ++
 .../routes/CassandraMailboxMergingRoutes.java   |   6 +-
 .../routes/CassandraMigrationRoutes.java        |   5 +
 .../org/apache/james/webadmin/PublicRoutes.java |  23 +
 .../java/org/apache/james/webadmin/Routes.java  |   2 +
 .../apache/james/webadmin/WebAdminServer.java   |  12 +-
 .../apache/james/webadmin/routes/CORSRoute.java |   5 +
 .../webadmin/routes/HealthCheckRoutes.java      |   9 +-
 .../james/webadmin/routes/TasksRoutes.java      |   5 +
 .../apache/james/webadmin/WebAdminUtils.java    |  21 +-
 .../james/webadmin/routes/ErrorRoutes.java      |   5 +
 .../webadmin/routes/HealthCheckRoutesTest.java  |   1 -
 .../webadmin/routes/DLPConfigurationRoutes.java |   7 +-
 .../webadmin/routes/DomainMappingsRoutes.java   |   7 +-
 .../james/webadmin/routes/DomainsRoutes.java    |   5 +
 .../james/webadmin/routes/ForwardRoutes.java    |   5 +
 .../james/webadmin/routes/GroupsRoutes.java     |   5 +
 .../james/webadmin/routes/SieveQuotaRoutes.java |   7 +-
 .../james/webadmin/routes/UserRoutes.java       |   5 +
 .../routes/DLPConfigurationRoutesTest.java      |   2 -
 .../routes/DomainMappingsRoutesTest.java        |   8 +-
 .../james/webadmin/routes/GroupsRoutesTest.java |   2 -
 .../webadmin/routes/DomainQuotaRoutes.java      |   8 +-
 .../webadmin/routes/GlobalQuotaRoutes.java      |   7 +-
 .../webadmin/routes/UserMailboxesRoutes.java    |   5 +
 .../james/webadmin/routes/UserQuotaRoutes.java  |   7 +-
 .../webadmin/routes/GlobalQuotaRoutesTest.java  |   1 -
 .../webadmin/routes/UserQuotaRoutesTest.java    |   1 +
 .../routes/WebAdminQuotaSearchTestSystem.java   |   1 +
 .../james/webadmin/routes/MailQueueRoutes.java  |   5 +
 .../webadmin/routes/MailQueueRoutesTest.java    |   1 +
 .../webadmin/routes/MailRepositoriesRoutes.java |   5 +
 .../webadmin/swagger/routes/SwaggerRoutes.java  |   9 +-
 36 files changed, 1067 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/HealthCheckRoutesModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/HealthCheckRoutesModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/HealthCheckRoutesModule.java
index 8ebd5b1..60a6c1b 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/HealthCheckRoutesModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/HealthCheckRoutesModule.java
@@ -20,7 +20,7 @@
 package org.apache.james.modules.server;
 
 import org.apache.james.core.healthcheck.HealthCheck;
-import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.PublicRoutes;
 import org.apache.james.webadmin.routes.HealthCheckRoutes;
 
 import com.google.inject.AbstractModule;
@@ -32,7 +32,7 @@ public class HealthCheckRoutesModule extends AbstractModule {
     protected void configure() {
         bind(HealthCheckRoutes.class).in(Scopes.SINGLETON);
 
-        Multibinder<Routes> routesMultibinder = 
Multibinder.newSetBinder(binder(), Routes.class);
+        Multibinder<PublicRoutes> routesMultibinder = 
Multibinder.newSetBinder(binder(), PublicRoutes.class);
         routesMultibinder.addBinding().to(HealthCheckRoutes.class);
 
         Multibinder.newSetBinder(binder(), HealthCheck.class);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java
new file mode 100644
index 0000000..be23463
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java
@@ -0,0 +1,73 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.webadmin.integration;
+
+import static io.restassured.RestAssured.when;
+import static org.hamcrest.core.IsNot.not;
+
+import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.apache.james.webadmin.routes.HealthCheckRoutes;
+import org.eclipse.jetty.http.HttpStatus;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import io.restassured.RestAssured;
+
+public class AuthorizedEndpointsTest {
+
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
+    @Rule
+    public CassandraJmapTestRule cassandraJmapTestRule = 
CassandraJmapTestRule.defaultTestRule();
+
+    private GuiceJamesServer guiceJamesServer;
+
+    @Before
+    public void setUp() throws Exception {
+        guiceJamesServer = 
cassandraJmapTestRule.jmapServer(cassandra.getModule(), new 
UnauthorizedModule())
+                .overrideWith(new WebAdminConfigurationModule());
+        guiceJamesServer.start();
+        WebAdminGuiceProbe webAdminGuiceProbe = 
guiceJamesServer.getProbe(WebAdminGuiceProbe.class);
+
+        RestAssured.requestSpecification = 
WebAdminUtils.buildRequestSpecification(webAdminGuiceProbe.getWebAdminPort())
+            .build();
+    }
+
+    @After
+    public void tearDown() {
+        guiceJamesServer.stop();
+    }
+
+    @Test
+    public void getHealthchecksShouldNotNeedAuthentication() {
+        when()
+            .get(HealthCheckRoutes.HEALTHCHECK)
+        .then()
+            .statusCode(not(HttpStatus.UNAUTHORIZED_401));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedEndpointsTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedEndpointsTest.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedEndpointsTest.java
new file mode 100644
index 0000000..8ef713a
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedEndpointsTest.java
@@ -0,0 +1,771 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.webadmin.integration;
+
+import static io.restassured.RestAssured.when;
+import static io.restassured.RestAssured.with;
+
+import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.apache.james.webadmin.routes.CassandraMigrationRoutes;
+import org.apache.james.webadmin.routes.DLPConfigurationRoutes;
+import org.apache.james.webadmin.routes.DomainMappingsRoutes;
+import org.apache.james.webadmin.routes.DomainQuotaRoutes;
+import org.apache.james.webadmin.routes.DomainsRoutes;
+import org.apache.james.webadmin.routes.ForwardRoutes;
+import org.apache.james.webadmin.routes.GlobalQuotaRoutes;
+import org.apache.james.webadmin.routes.GroupsRoutes;
+import org.apache.james.webadmin.routes.MailQueueRoutes;
+import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
+import org.apache.james.webadmin.routes.SieveQuotaRoutes;
+import org.apache.james.webadmin.routes.TasksRoutes;
+import org.apache.james.webadmin.routes.UserMailboxesRoutes;
+import org.apache.james.webadmin.routes.UserQuotaRoutes;
+import org.apache.james.webadmin.routes.UserRoutes;
+import org.eclipse.jetty.http.HttpStatus;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import io.restassured.RestAssured;
+
+public class UnauthorizedEndpointsTest {
+
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
+    @Rule
+    public CassandraJmapTestRule cassandraJmapTestRule = 
CassandraJmapTestRule.defaultTestRule();
+
+    private GuiceJamesServer guiceJamesServer;
+
+    @Before
+    public void setUp() throws Exception {
+        guiceJamesServer = 
cassandraJmapTestRule.jmapServer(cassandra.getModule(), new 
UnauthorizedModule())
+                .overrideWith(new WebAdminConfigurationModule());
+        guiceJamesServer.start();
+        WebAdminGuiceProbe webAdminGuiceProbe = 
guiceJamesServer.getProbe(WebAdminGuiceProbe.class);
+
+        RestAssured.requestSpecification = 
WebAdminUtils.buildRequestSpecification(webAdminGuiceProbe.getWebAdminPort())
+            .build();
+    }
+
+    @After
+    public void tearDown() {
+        guiceJamesServer.stop();
+    }
+
+    @Test
+    public void getCassandraMigrationShouldBeAuthenticated() {
+        when()
+            .get(CassandraMigrationRoutes.VERSION_BASE)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void upgradeCassandraMigrationShouldBeAuthenticated() {
+        when()
+            .post(CassandraMigrationRoutes.VERSION_BASE + "/upgrade")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void upgradeLatestCassandraMigrationShouldBeAuthenticated() {
+        when()
+            .post(CassandraMigrationRoutes.VERSION_BASE + "/upgrade/latest")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getLatestCassandraMigrationShouldBeAuthenticated() {
+        when()
+            .get(CassandraMigrationRoutes.VERSION_BASE + "/latest")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void storeDLPShouldBeAuthenticated() {
+        String storeBody =
+                "{\"rules\": [" +
+                        "  {" +
+                        "    \"id\": \"1\"," +
+                        "    \"expression\": \"expression 1\"," +
+                        "    \"explanation\": \"explanation 1\"," +
+                        "    \"targetsSender\": true," +
+                        "    \"targetsRecipients\": true," +
+                        "    \"targetsContent\": true" +
+                        "  }," +
+                        "  {" +
+                        "    \"id\": \"2\"," +
+                        "    \"expression\": \"expression 2\"," +
+                        "    \"explanation\": \"explanation 2\"," +
+                        "    \"targetsSender\": false," +
+                        "    \"targetsRecipients\": false," +
+                        "    \"targetsContent\": false" +
+                        "  }]}";
+
+        with()
+            .body(storeBody)
+        .when()
+            .put(DLPConfigurationRoutes.BASE_PATH + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void clearDLPShouldBeAuthenticated() {
+        when()
+            .delete(DLPConfigurationRoutes.BASE_PATH + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void listDLPShouldBeAuthenticated() {
+        when()
+            .get(DLPConfigurationRoutes.BASE_PATH + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteDomainMappingShouldBeAuthenticated() {
+        with()
+            .body("to.com")
+        .when()
+            .delete(DomainMappingsRoutes.DOMAIN_MAPPINGS + "/from.com")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void addDomainMappingShouldBeAuthenticated() {
+        with()
+            .body("to.com")
+        .when()
+            .put(DomainMappingsRoutes.DOMAIN_MAPPINGS + "/from.com")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getDomainMappingsShouldBeAuthenticated() {
+        with()
+            .get(DomainMappingsRoutes.DOMAIN_MAPPINGS)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getDomainMappingShouldBeAuthenticated() {
+        with()
+            .get(DomainMappingsRoutes.DOMAIN_MAPPINGS + "/from.com")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getDomainQuotaShouldBeAuthenticated() {
+        with()
+            .get(DomainQuotaRoutes.BASE_PATH + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getCountDomainQuotaShouldBeAuthenticated() {
+        with()
+            .get(DomainQuotaRoutes.BASE_PATH + "/james.org/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getSizeDomainQuotaShouldBeAuthenticated() {
+        with()
+            .get(DomainQuotaRoutes.BASE_PATH + "/james.org/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteCountDomainQuotaShouldBeAuthenticated() {
+        with()
+            .delete(DomainQuotaRoutes.BASE_PATH + "/james.org/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteSizeDomainQuotaShouldBeAuthenticated() {
+        with()
+            .delete(DomainQuotaRoutes.BASE_PATH + "/james.org/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putCountDomainQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(DomainQuotaRoutes.BASE_PATH + "/james.org/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putSizeDomainQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(DomainQuotaRoutes.BASE_PATH + "/james.org/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putDomainQuotaShouldBeAuthenticated() {
+        with()
+            .body("{\"count\":52,\"size\":42}")
+        .when()
+            .put(DomainQuotaRoutes.BASE_PATH + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getDomainsShouldBeAuthenticated() {
+        when()
+            .get(DomainsRoutes.DOMAINS)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void createDomainShouldBeAuthenticated() {
+        when()
+            .put(DomainsRoutes.DOMAINS + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteDomainShouldBeAuthenticated() {
+        when()
+            .delete(DomainsRoutes.DOMAINS + "/james.org")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getUserMailboxesShouldBeAuthenticated() {
+        when()
+            .get(UserMailboxesRoutes.USERS_BASE + "/someuser/mailboxes")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getMailboxUserMailboxesShouldBeAuthenticated() {
+        when()
+            .get(UserMailboxesRoutes.USERS_BASE + 
"/someuser/mailboxes/mymailbox")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteUserMailboxesShouldBeAuthenticated() {
+        when()
+            .delete(UserMailboxesRoutes.USERS_BASE + "/someuser/mailboxes")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteMailboxUserMailboxesShouldBeAuthenticated() {
+        when()
+            .delete(UserMailboxesRoutes.USERS_BASE + 
"/someuser/mailboxes/mymailbox")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void createMailboxUserMailboxesShouldBeAuthenticated() {
+        when()
+            .put(UserMailboxesRoutes.USERS_BASE + 
"/someuser/mailboxes/mymailbox")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getUserQuotaShouldBeAuthenticated() {
+        when()
+            .get(UserQuotaRoutes.USERS_QUOTA_ENDPOINT)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getUserUserQuotaShouldBeAuthenticated() {
+        when()
+            .get(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getCountUserQuotaShouldBeAuthenticated() {
+        when()
+            .get(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + 
"/[email protected]/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getSizeUserQuotaShouldBeAuthenticated() {
+        when()
+            .get(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + "/[email protected]/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteCountUserQuotaShouldBeAuthenticated() {
+        when()
+            .delete(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + 
"/[email protected]/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteSizeUserQuotaShouldBeAuthenticated() {
+        when()
+            .delete(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + 
"/[email protected]/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putUserQuotaShouldBeAuthenticated() {
+        with()
+            .body("{\"count\":52,\"size\":42}")
+        .when()
+            .put(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putCountUserQuotaShouldBeAuthenticated() {
+        with()
+            .body("35")
+        .when()
+            .put(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + 
"/[email protected]/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putSizeUserQuotaShouldBeAuthenticated() {
+        with()
+            .body("35")
+        .when()
+            .put(UserQuotaRoutes.USERS_QUOTA_ENDPOINT + "/[email protected]/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getUsersShouldBeAuthenticated() {
+        when()
+            .get(UserRoutes.USERS)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void createUserShouldBeAuthenticated() {
+        with()
+            .body("{\"password\":\"password\"}")
+        .when()
+            .put(UserRoutes.USERS + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteUserShouldBeAuthenticated() {
+        when()
+            .delete(UserRoutes.USERS + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getForwardsShouldBeAuthenticated() {
+        when()
+            .get(ForwardRoutes.ROOT_PATH)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getForwardShouldBeAuthenticated() {
+        when()
+            .get(ForwardRoutes.ROOT_PATH + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putForwardDestinationShouldBeAuthenticated() {
+        when()
+            .put(ForwardRoutes.ROOT_PATH + "/[email protected]/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteForwardDestinationShouldBeAuthenticated() {
+        when()
+            .delete(ForwardRoutes.ROOT_PATH + 
"/[email protected]/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getGlobalQuotaShouldBeAuthenticated() {
+        when()
+            .get(GlobalQuotaRoutes.QUOTA_ENDPOINT)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getCountGlobalQuotaShouldBeAuthenticated() {
+        when()
+            .get(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getSizeGlobalQuotaShouldBeAuthenticated() {
+        when()
+            .get(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteCountGlobalQuotaShouldBeAuthenticated() {
+        when()
+            .delete(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteSizeGlobalQuotaShouldBeAuthenticated() {
+        when()
+            .delete(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putCountGlobalQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/count")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putSizeGlobalQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(GlobalQuotaRoutes.QUOTA_ENDPOINT + "/size")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putGlobalQuotaShouldBeAuthenticated() {
+        with()
+            .body("{\"count\":52,\"size\":42}")
+        .when()
+            .put(GlobalQuotaRoutes.QUOTA_ENDPOINT)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getGroupsShouldBeAuthenticated() {
+        when()
+            .get(GroupsRoutes.ROOT_PATH)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getGroupShouldBeAuthenticated() {
+        when()
+            .get(GroupsRoutes.ROOT_PATH + "/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putGroupMemberShouldBeAuthenticated() {
+        when()
+            .put(GroupsRoutes.ROOT_PATH + "/[email protected]/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteGroupMemberShouldBeAuthenticated() {
+        when()
+            .delete(GroupsRoutes.ROOT_PATH + "/[email protected]/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void listMailQueuesShouldBeAuthenticated() {
+        when()
+            .get(MailQueueRoutes.BASE_URL)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getMailQueueShouldBeAuthenticated() {
+        when()
+            .get(MailQueueRoutes.BASE_URL + "/first_queue")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteMailShouldBeAuthenticated() {
+        with()
+            .param("sender", "123")
+        .when()
+            .delete(MailQueueRoutes.BASE_URL + "/first_queue/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void clearMailQueueShouldBeAuthenticated() {
+        when()
+            .delete(MailQueueRoutes.BASE_URL + "/second_queue/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void flushMailQueueShouldBeAuthenticated() {
+        with()
+            .queryParam("delayed", "true")
+            .body("{\"delayed\": \"false\"}")
+        .when()
+            .patch(MailQueueRoutes.BASE_URL + "/first_queue/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putMailRepositoriesShouldBeAuthenticated() {
+        with()
+            .params("protocol", "memory")
+        .when()
+            .put(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void listMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getMailsMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getMailMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo/mails/1")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteAMailMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .delete(MailRepositoriesRoutes.MAIL_REPOSITORIES + 
"/myRepo/mails/1")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteMailsMailRepositoriesShouldBeAuthenticated() {
+        when()
+            .delete(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void reprocessingAllMailRepositoriesShouldBeAuthenticated() {
+        with()
+            .param("action", "reprocess")
+        .when()
+            .patch(MailRepositoriesRoutes.MAIL_REPOSITORIES + "/myRepo/mails")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void reprocessingOneMailRepositoriesShouldBeAuthenticated() {
+        with()
+            .param("action", "reprocess")
+        .when()
+            .patch(MailRepositoriesRoutes.MAIL_REPOSITORIES + 
"/myRepo/mails/name1")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getGlobalSieveQuotaShouldBeAuthenticated() {
+        when()
+            .get(SieveQuotaRoutes.DEFAULT_QUOTA_PATH)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deleteGlobalSieveQuotaShouldBeAuthenticated() {
+        when()
+            .delete(SieveQuotaRoutes.DEFAULT_QUOTA_PATH)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putGlobalSieveQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(SieveQuotaRoutes.DEFAULT_QUOTA_PATH)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getPerUserSieveQuotaShouldBeAuthenticated() {
+        when()
+            .get(SieveQuotaRoutes.ROOT_PATH + "/users/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void deletePerUsersSieveQuotaShouldBeAuthenticated() {
+        when()
+            .delete(SieveQuotaRoutes.ROOT_PATH + "/users/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void putPerUserSieveQuotaShouldBeAuthenticated() {
+        with()
+            .body("42")
+        .when()
+            .put(SieveQuotaRoutes.ROOT_PATH + "/users/[email protected]")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getTasksRoutesShouldBeAuthenticated() {
+        when()
+            .get(TasksRoutes.BASE)
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void getTaskShouldBeAuthenticated() {
+        when()
+            .get(TasksRoutes.BASE + "/taskId")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void cancelTaskShouldBeAuthenticated() {
+        when()
+            .delete(TasksRoutes.BASE + "/taskId")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+
+    @Test
+    public void awaitTaskShouldBeAuthenticated() {
+        when()
+            .get(TasksRoutes.BASE + "/taskId/await")
+        .then()
+            .statusCode(HttpStatus.UNAUTHORIZED_401);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedModule.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedModule.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedModule.java
new file mode 100644
index 0000000..ecd725a
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/UnauthorizedModule.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.webadmin.integration;
+
+import static spark.Spark.halt;
+
+import org.apache.james.webadmin.authentication.AuthenticationFilter;
+import org.eclipse.jetty.http.HttpStatus;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+
+import spark.Request;
+import spark.Response;
+
+public class UnauthorizedModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        bind(UnauthorizedModule.UnauthorizedFilter.class).in(Scopes.SINGLETON);
+        
bind(AuthenticationFilter.class).to(UnauthorizedModule.UnauthorizedFilter.class);
+    }
+
+    private static class UnauthorizedFilter implements AuthenticationFilter {
+
+        @Override
+        public void handle(Request request, Response response) throws 
Exception {
+            halt(HttpStatus.UNAUTHORIZED_401, "Unauthorize every endpoints.");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
 
b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
index a2ba151..e1f3cd3 100644
--- 
a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMailboxMergingRoutes.java
@@ -80,11 +80,15 @@ public class CassandraMailboxMergingRoutes implements 
Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return BASE;
+    }
+
+    @Override
     public void define(Service service) {
         service.post(BASE, this::mergeMailboxes, jsonTransformer);
     }
 
-
     @POST
     @ApiOperation("Triggers the merge of 2 mailboxes. Old mailbox Id will no 
more be accessible, rights and messages will be merged.")
     @ApiImplicitParams(

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMigrationRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMigrationRoutes.java
 
b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMigrationRoutes.java
index d30b9c5..0cf9ec5 100644
--- 
a/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMigrationRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-cassandra/src/main/java/org/apache/james/webadmin/routes/CassandraMigrationRoutes.java
@@ -80,6 +80,11 @@ public class CassandraMigrationRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return VERSION_BASE;
+    }
+
+    @Override
     public void define(Service service) {
         service.get(VERSION_BASE, (request, response) -> 
getCassandraCurrentVersion(), jsonTransformer);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/PublicRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/PublicRoutes.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/PublicRoutes.java
new file mode 100644
index 0000000..c531f9b
--- /dev/null
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/PublicRoutes.java
@@ -0,0 +1,23 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.webadmin;
+
+public interface PublicRoutes extends Routes {
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/Routes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/Routes.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/Routes.java
index bc8554a..e144b32 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/Routes.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/Routes.java
@@ -23,6 +23,8 @@ import spark.Service;
 
 public interface Routes {
 
+    String getBasePath();
+
     void define(Service service);
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
index 3ec06f9..5315794 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
@@ -61,6 +61,7 @@ public class WebAdminServer implements Configurable {
 
     private final WebAdminConfiguration configuration;
     private final Set<Routes> routesList;
+    private final Set<PublicRoutes> publicRoutes;
     private final Service service;
     private final AuthenticationFilter authenticationFilter;
     private final MetricFactory metricFactory;
@@ -68,10 +69,11 @@ public class WebAdminServer implements Configurable {
 
     // Spark do not allow to retrieve allocated port when using a random port. 
Thus we generate the port.
     @Inject
-    protected WebAdminServer(WebAdminConfiguration configuration, Set<Routes> 
routesList, AuthenticationFilter authenticationFilter,
+    protected WebAdminServer(WebAdminConfiguration configuration, Set<Routes> 
routesList, Set<PublicRoutes> publicRoutes, AuthenticationFilter 
authenticationFilter,
                            MetricFactory metricFactory) {
         this.configuration = configuration;
         this.routesList = routesList;
+        this.publicRoutes = publicRoutes;
         this.authenticationFilter = authenticationFilter;
         this.metricFactory = metricFactory;
         this.service = Service.ignite();
@@ -85,10 +87,14 @@ public class WebAdminServer implements Configurable {
             configureHTTPS();
             configureCORS();
             configureMetrics();
-            service.before(authenticationFilter);
             service.before((request, response) -> 
response.type(Constants.JSON_CONTENT_TYPE));
             configureMDC();
-            routesList.forEach(routes -> routes.define(service));
+            routesList.forEach(routes -> {
+                service.before(routes.getBasePath(), authenticationFilter);
+                service.before(routes.getBasePath() + "/*", 
authenticationFilter);
+                routes.define(service);
+            });
+            publicRoutes.forEach(routes -> routes.define(service));
             service.awaitInitialization();
             port = new Port(service.port());
             LOGGER.info("Web admin server started");

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/CORSRoute.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/CORSRoute.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/CORSRoute.java
index e966667..8674761 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/CORSRoute.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/CORSRoute.java
@@ -28,6 +28,11 @@ import spark.Service;
 public class CORSRoute implements Routes {
 
     @Override
+    public String getBasePath() {
+        return "";
+    }
+
+    @Override
     public void define(Service service) {
         service.options("/*", (request, response) -> {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
index d9c7e67..8ec0b73 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
@@ -28,7 +28,7 @@ import javax.ws.rs.Path;
 
 import org.apache.james.core.healthcheck.HealthCheck;
 import org.apache.james.core.healthcheck.Result;
-import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.PublicRoutes;
 import org.eclipse.jetty.http.HttpStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,7 +43,7 @@ import spark.Service;
 
 @Api(tags = "Healthchecks")
 @Path(HealthCheckRoutes.HEALTHCHECK)
-public class HealthCheckRoutes implements Routes {
+public class HealthCheckRoutes implements PublicRoutes {
 
     private static final Logger LOGGER = 
LoggerFactory.getLogger(HealthCheckRoutes.class);
 
@@ -59,6 +59,11 @@ public class HealthCheckRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return HEALTHCHECK;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/TasksRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/TasksRoutes.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/TasksRoutes.java
index 9116b51..02305b8 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/TasksRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/TasksRoutes.java
@@ -66,6 +66,11 @@ public class TasksRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return BASE;
+    }
+
+    @Override
     public void define(Service service) {
         service.get(BASE + "/:id", this::getStatus, jsonTransformer);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/WebAdminUtils.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/WebAdminUtils.java
 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/WebAdminUtils.java
index 7a984eb..af7110f 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/WebAdminUtils.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/WebAdminUtils.java
@@ -23,12 +23,15 @@ import static 
io.restassured.config.EncoderConfig.encoderConfig;
 import static io.restassured.config.RestAssuredConfig.newConfig;
 
 import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Set;
 
 import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.util.Port;
 import org.apache.james.webadmin.authentication.NoAuthenticationFilter;
 
-import com.google.common.collect.ImmutableSet;
+import com.github.steveash.guavate.Guavate;
+
 import io.restassured.builder.RequestSpecBuilder;
 import io.restassured.http.ContentType;
 
@@ -36,11 +39,25 @@ public class WebAdminUtils {
 
     public static WebAdminServer createWebAdminServer(MetricFactory 
metricFactory, Routes... routes) {
         return new WebAdminServer(WebAdminConfiguration.TEST_CONFIGURATION,
-            ImmutableSet.copyOf(routes),
+            privateRoutes(routes),
+            publicRoutes(routes),
             new NoAuthenticationFilter(),
             metricFactory);
     }
 
+    private static Set<Routes> privateRoutes(Routes[] routes) {
+        return Arrays.stream(routes)
+                .filter(route -> !(route instanceof PublicRoutes))
+                .collect(Guavate.toImmutableSet());
+    }
+
+    private static Set<PublicRoutes> publicRoutes(Routes[] routes) {
+        return Arrays.stream(routes)
+                .filter(PublicRoutes.class::isInstance)
+                .map(PublicRoutes.class::cast)
+                .collect(Guavate.toImmutableSet());
+    }
+
     public static RequestSpecBuilder buildRequestSpecification(WebAdminServer 
webAdminServer) {
         return buildRequestSpecification(webAdminServer.getPort());
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
index 76e2c53..a2563b9 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
@@ -36,6 +36,11 @@ public class ErrorRoutes implements Routes {
         defineJsonExtractException(service);
     }
 
+    @Override
+    public String getBasePath() {
+        return BASE_URL;
+    }
+
     private void defineInternalError(Service service) {
         service.get(BASE_URL + INTERNAL_SERVER_ERROR,
             (req, res) -> {

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java
 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java
index e0d5b83..046005f 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java
@@ -63,7 +63,6 @@ public class HealthCheckRoutesTest {
     @Before
     public void setUp() throws Exception {
         healthChecks = new HashSet<>();
-
         webAdminServer = WebAdminUtils.createWebAdminServer(
             new DefaultMetricFactory(),
             new HealthCheckRoutes(healthChecks));

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java
index c735337..6bd321b 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java
@@ -67,7 +67,7 @@ import spark.Service;
 @Produces(JSON_CONTENT_TYPE)
 public class DLPConfigurationRoutes implements Routes {
 
-    static final String BASE_PATH = "/dlp/rules";
+    public static final String BASE_PATH = "/dlp/rules";
 
     private static final String DOMAIN_NAME = ":senderDomain";
     private static final String SPECIFIC_DLP_RULE_DOMAIN = BASE_PATH + 
SEPARATOR + DOMAIN_NAME;
@@ -86,6 +86,11 @@ public class DLPConfigurationRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return BASE_PATH;
+    }
+
+    @Override
     public void define(Service service) {
 
         defineStore(service);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
index 2502fa7..e74484c 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainMappingsRoutes.java
@@ -64,7 +64,7 @@ import spark.Service;
 @Path(DOMAIN_MAPPINGS)
 @Produces("application/json")
 public class DomainMappingsRoutes implements Routes {
-    static final String DOMAIN_MAPPINGS = "/domainMappings";
+    public static final String DOMAIN_MAPPINGS = "/domainMappings";
     private static final String FROM_DOMAIN = "fromDomain";
     private static final String SPECIFIC_MAPPING_PATH = SEPARATOR + "/{" + 
FROM_DOMAIN + "}";
     private static final String SPECIFIC_MAPPING = DOMAIN_MAPPINGS + SEPARATOR 
+ ":" + FROM_DOMAIN;
@@ -79,6 +79,11 @@ public class DomainMappingsRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return DOMAIN_MAPPINGS;
+    }
+
+    @Override
     public void define(final Service service) {
         service.get(DOMAIN_MAPPINGS, this::getAllMappings, jsonTransformer);
         service.get(SPECIFIC_MAPPING, this::getMapping, jsonTransformer);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
index 673ec80..321b2c7 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DomainsRoutes.java
@@ -78,6 +78,11 @@ public class DomainsRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return DOMAINS;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/ForwardRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/ForwardRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/ForwardRoutes.java
index 086d4f0..cbc0749 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/ForwardRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/ForwardRoutes.java
@@ -108,6 +108,11 @@ public class ForwardRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return ROOT_PATH;
+    }
+
+    @Override
     public void define(Service service) {
         service.get(ROOT_PATH, this::listForwards, jsonTransformer);
         service.get(FORWARD_ADDRESS_PATH, this::listForwardDestinations, 
jsonTransformer);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/GroupsRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/GroupsRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/GroupsRoutes.java
index 24ac5ec..06723eb 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/GroupsRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/GroupsRoutes.java
@@ -109,6 +109,11 @@ public class GroupsRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return ROOT_PATH;
+    }
+
+    @Override
     public void define(Service service) {
         service.get(ROOT_PATH, this::listGroups, jsonTransformer);
         service.get(GROUP_ADDRESS_PATH, this::listGroupMembers, 
jsonTransformer);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/SieveQuotaRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/SieveQuotaRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/SieveQuotaRoutes.java
index 26f5a0c..d0d8cc5 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/SieveQuotaRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/SieveQuotaRoutes.java
@@ -59,7 +59,7 @@ import spark.Service;
 @Produces("application/json")
 public class SieveQuotaRoutes implements Routes {
 
-    static final String ROOT_PATH = "/sieve/quota";
+    public static final String ROOT_PATH = "/sieve/quota";
     public static final String DEFAULT_QUOTA_PATH = ROOT_PATH + SEPARATOR + 
"default";
     private static final String USER_ID = "userId";
     private static final String USER_SIEVE_QUOTA_PATH = 
Joiner.on(SEPARATOR).join(ROOT_PATH, "users", ":" + USER_ID);
@@ -78,6 +78,11 @@ public class SieveQuotaRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return ROOT_PATH;
+    }
+
+    @Override
     public void define(Service service) {
         defineGetGlobalSieveQuota(service);
         defineUpdateGlobalSieveQuota(service);

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java
 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java
index dc16425..aa373a6 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java
@@ -77,6 +77,11 @@ public class UserRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return USERS;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java
 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java
index 5228655..9bc2aa0 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java
@@ -83,7 +83,6 @@ class DLPConfigurationRoutesTest {
                 .build();
     }
 
-
     @BeforeEach
     void setup() throws Exception {
         DNSService dnsService = mock(DNSService.class);
@@ -100,7 +99,6 @@ class DLPConfigurationRoutesTest {
         createServer(dlpStore, domainList);
     }
 
-
     @Nested
     class DefineStore {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
index 112e436..300d884 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
@@ -71,7 +71,9 @@ class DomainMappingsRoutesTest {
     private WebAdminServer webAdminServer;
 
     private void createServer(DomainMappingsRoutes domainMappingsRoutes) 
throws Exception {
-        webAdminServer = WebAdminUtils.createWebAdminServer(new 
DefaultMetricFactory(), domainMappingsRoutes);
+        webAdminServer = WebAdminUtils.createWebAdminServer(
+                new DefaultMetricFactory(),
+                domainMappingsRoutes);
         webAdminServer.configure(NO_CONFIGURATION);
         webAdminServer.await();
 
@@ -94,6 +96,10 @@ class DomainMappingsRoutesTest {
     }
 
     @Nested
+    class Authentication {
+    }
+
+    @Nested
     class NormalBehaviour {
 
         @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
index 153c9a4..991b678 100644
--- 
a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
@@ -122,7 +122,6 @@ class GroupsRoutesTest {
                 .body(is("[]"));
         }
 
-
         @Test
         void getShouldNotResolveRecurseGroups() throws Exception {
             when().put(GROUP1 + SEPARATOR + USER_A);
@@ -371,7 +370,6 @@ class GroupsRoutesTest {
                 .containsEntry("message", "Server doesn't own the domain: 
unregisteredDomain");
         }
 
-
         @Test
         void putUserInGroupShouldNotAllowUserShadowing() throws 
UsersRepositoryException {
             usersRepository.addUser(USER_A, "whatever");

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/DomainQuotaRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/DomainQuotaRoutes.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/DomainQuotaRoutes.java
index b028946..8c33381 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/DomainQuotaRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/DomainQuotaRoutes.java
@@ -65,7 +65,8 @@ import spark.Service;
 public class DomainQuotaRoutes implements Routes {
 
     private static final String DOMAIN = "domain";
-    static final String QUOTA_ENDPOINT = "/quota/domains/:" + DOMAIN;
+    public static final String BASE_PATH = "/quota/domains";
+    static final String QUOTA_ENDPOINT = BASE_PATH + "/:" + DOMAIN;
     private static final String COUNT_ENDPOINT = QUOTA_ENDPOINT + "/count";
     private static final String SIZE_ENDPOINT = QUOTA_ENDPOINT + "/size";
 
@@ -86,6 +87,11 @@ public class DomainQuotaRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return QUOTA_ENDPOINT;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/GlobalQuotaRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/GlobalQuotaRoutes.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/GlobalQuotaRoutes.java
index b96927e..623ded1 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/GlobalQuotaRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/GlobalQuotaRoutes.java
@@ -58,7 +58,7 @@ import spark.Service;
 @Produces("application/json")
 public class GlobalQuotaRoutes implements Routes {
 
-    /* for @Path annotation */ static final String QUOTA_ENDPOINT = "/quota";
+    public static final String QUOTA_ENDPOINT = "/quota";
     private static final String COUNT_ENDPOINT = QUOTA_ENDPOINT + "/count";
     private static final String SIZE_ENDPOINT = QUOTA_ENDPOINT + "/size";
 
@@ -75,6 +75,11 @@ public class GlobalQuotaRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return QUOTA_ENDPOINT;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
index 0c3b30c..97303c8 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
@@ -71,6 +71,11 @@ public class UserMailboxesRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return USER_MAILBOXES_BASE;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserQuotaRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserQuotaRoutes.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserQuotaRoutes.java
index 3024d72..11e4166 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserQuotaRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserQuotaRoutes.java
@@ -75,7 +75,7 @@ public class UserQuotaRoutes implements Routes {
     private static final String MIN_OCCUPATION_RATIO = "minOccupationRatio";
     private static final String MAX_OCCUPATION_RATIO = "maxOccupationRatio";
     private static final String DOMAIN = "domain";
-    static final String USERS_QUOTA_ENDPOINT = "/quota/users";
+    public static final String USERS_QUOTA_ENDPOINT = "/quota/users";
     private static final String QUOTA_ENDPOINT = USERS_QUOTA_ENDPOINT + "/:" + 
USER;
     private static final String COUNT_ENDPOINT = QUOTA_ENDPOINT + "/count";
     private static final String SIZE_ENDPOINT = QUOTA_ENDPOINT + "/size";
@@ -95,6 +95,11 @@ public class UserQuotaRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return USERS_QUOTA_ENDPOINT;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
index 48b4534..48032b0 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
@@ -130,7 +130,6 @@ class GlobalQuotaRoutesTest {
         
assertThat(maxQuotaManager.getGlobalMaxMessage()).contains(QuotaCount.unlimited());
     }
 
-
     @Test
     void putCountShouldAcceptValidValue() throws Exception {
         given()

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
index df649d0..af9f1aa 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
@@ -57,6 +57,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 import com.google.common.base.Strings;
+
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
 import io.restassured.path.json.JsonPath;

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/WebAdminQuotaSearchTestSystem.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/WebAdminQuotaSearchTestSystem.java
 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/WebAdminQuotaSearchTestSystem.java
index 9a791c0..49c70e4 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/WebAdminQuotaSearchTestSystem.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/WebAdminQuotaSearchTestSystem.java
@@ -32,6 +32,7 @@ import org.apache.james.webadmin.service.UserQuotaService;
 import org.apache.james.webadmin.utils.JsonTransformer;
 
 import com.google.common.collect.ImmutableSet;
+
 import io.restassured.specification.RequestSpecification;
 
 public class WebAdminQuotaSearchTestSystem {

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailqueue/src/main/java/org/apache/james/webadmin/routes/MailQueueRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailqueue/src/main/java/org/apache/james/webadmin/routes/MailQueueRoutes.java
 
b/server/protocols/webadmin/webadmin-mailqueue/src/main/java/org/apache/james/webadmin/routes/MailQueueRoutes.java
index 2f5b6fd..7fe0788 100644
--- 
a/server/protocols/webadmin/webadmin-mailqueue/src/main/java/org/apache/james/webadmin/routes/MailQueueRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailqueue/src/main/java/org/apache/james/webadmin/routes/MailQueueRoutes.java
@@ -105,6 +105,11 @@ public class MailQueueRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return BASE_URL;
+    }
+
+    @Override
     public void define(Service service) {
         defineListQueues(service);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailqueue/src/test/java/org/apache/james/webadmin/routes/MailQueueRoutesTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailqueue/src/test/java/org/apache/james/webadmin/routes/MailQueueRoutesTest.java
 
b/server/protocols/webadmin/webadmin-mailqueue/src/test/java/org/apache/james/webadmin/routes/MailQueueRoutesTest.java
index 1811b83..5e0fc82 100644
--- 
a/server/protocols/webadmin/webadmin-mailqueue/src/test/java/org/apache/james/webadmin/routes/MailQueueRoutesTest.java
+++ 
b/server/protocols/webadmin/webadmin-mailqueue/src/test/java/org/apache/james/webadmin/routes/MailQueueRoutesTest.java
@@ -60,6 +60,7 @@ import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
 import com.github.steveash.guavate.Guavate;
+
 import io.restassured.RestAssured;
 import io.restassured.builder.RequestSpecBuilder;
 import io.restassured.http.ContentType;

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
 
b/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
index a6f9740..5260653 100644
--- 
a/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
@@ -99,6 +99,11 @@ public class MailRepositoriesRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return MAIL_REPOSITORIES;
+    }
+
+    @Override
     public void define(Service service) {
         this.service = service;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/61b72f1c/server/protocols/webadmin/webadmin-swagger/src/main/java/org/apache/james/webadmin/swagger/routes/SwaggerRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-swagger/src/main/java/org/apache/james/webadmin/swagger/routes/SwaggerRoutes.java
 
b/server/protocols/webadmin/webadmin-swagger/src/main/java/org/apache/james/webadmin/swagger/routes/SwaggerRoutes.java
index 59ddc3f..678fcf0 100644
--- 
a/server/protocols/webadmin/webadmin-swagger/src/main/java/org/apache/james/webadmin/swagger/routes/SwaggerRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-swagger/src/main/java/org/apache/james/webadmin/swagger/routes/SwaggerRoutes.java
@@ -21,14 +21,14 @@ package org.apache.james.webadmin.swagger.routes;
 
 import javax.inject.Inject;
 
-import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.PublicRoutes;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.apache.james.webadmin.swagger.SwaggerParser;
 import org.eclipse.jetty.http.HttpStatus;
 
 import spark.Service;
 
-public class SwaggerRoutes implements Routes {
+public class SwaggerRoutes implements PublicRoutes {
     public static final String SWAGGER_ENDPOINT = "/james-swagger";
     private static final String APP_PACKAGE = 
"org.apache.james.webadmin.routes";
     private final WebAdminConfiguration webAdminConfiguration;
@@ -39,6 +39,11 @@ public class SwaggerRoutes implements Routes {
     }
 
     @Override
+    public String getBasePath() {
+        return SWAGGER_ENDPOINT;
+    }
+
+    @Override
     public void define(Service service) {
         service.get(SWAGGER_ENDPOINT, (request, response) -> {
             response.status(HttpStatus.OK_200);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to