[10/22] james-project git commit: JAMES-1958 Enable HTTPS through configuration

2017-03-15 Thread btellier
JAMES-1958 Enable HTTPS through configuration


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

Branch: refs/heads/master
Commit: 3ac2368bf86ad6c607b6a31dc5eddf7ff160a197
Parents: ef84ed7
Author: benwa 
Authored: Wed Mar 8 16:26:19 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../destination/conf/webadmin.properties| 13 +++-
 .../destination/conf/webadmin.properties| 13 +++-
 .../modules/server/WebAdminServerModule.java| 22 
 .../apache/james/webadmin/WebAdminServer.java   |  8 +++
 4 files changed, 54 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/3ac2368b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
index 70a6cb9..3a1e755 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
@@ -19,4 +19,15 @@
 #  DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
 
 enabled=true
-port=8000
\ No newline at end of file
+port=8000
+
+# Defaults to false
+https.enabled=false
+
+# Compulsory when enabling HTTPS
+#https.keystore=/path/to/keystore
+#https.password=password
+
+# Optional when enabling HTTPS (self signed)
+#https.trust.keystore
+#https.trust.password
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/3ac2368b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
index 70a6cb9..3a1e755 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
@@ -19,4 +19,15 @@
 #  DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
 
 enabled=true
-port=8000
\ No newline at end of file
+port=8000
+
+# Defaults to false
+https.enabled=false
+
+# Compulsory when enabling HTTPS
+#https.keystore=/path/to/keystore
+#https.password=password
+
+# Optional when enabling HTTPS (self signed)
+#https.trust.keystore
+#https.trust.password
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/3ac2368b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 8495797..29c6223 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -32,6 +32,7 @@ import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.PropertiesProvider;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.FixedPort;
+import org.apache.james.webadmin.HttpsConfiguration;
 import org.apache.james.webadmin.Routes;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.apache.james.webadmin.WebAdminServer;
@@ -72,6 +73,7 @@ public class WebAdminServerModule extends AbstractModule {
 return WebAdminConfiguration.builder()
 .enable(configurationFile.getBoolean("enabled", false))
 .port(new FixedPort(configurationFile.getInt("port", 
WebAdminServer.DEFAULT_PORT)))
+.https(readHttpsConfiguration(configurationFile))
 .build();
 } catch (FileNotFoundException e) {
 return WebAdminConfiguration.builder()
@@ -80,6 +82,26 @@ public class WebAdminServerModule extends AbstractModule {
 }
 }
 
+private HttpsConfiguration readHttpsConfiguration(PropertiesConfiguration 
configurationFile) {
+boolean enabled = configurationFile.getBoolean("https.enabled", 
DEFAULT_HTTPS_DISABLED());
+if (enabled) {
+return HttpsConfiguration.builder()
+.enabled

[16/22] james-project git commit: JAMES-1960 Extract default configuration values in constants

2017-03-15 Thread btellier
JAMES-1960 Extract default configuration values in constants


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

Branch: refs/heads/master
Commit: 642be79f3f8e702db50c63c58add7128075a0aba
Parents: 3dfb05f
Author: benwa 
Authored: Mon Mar 13 15:24:00 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 .../modules/server/WebAdminServerModule.java| 30 +++-
 1 file changed, 17 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/642be79f/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 1532471..c100dcb 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -56,7 +56,15 @@ import com.google.inject.multibindings.Multibinder;
 
 public class WebAdminServerModule extends AbstractModule {
 
-public static final boolean DEFAULT_JWT_DISABLED = false;
+private static final boolean DEFAULT_JWT_DISABLED = false;
+private static final boolean DEFAULT_DISABLED = false;
+private static final String DEFAULT_NO_CORS_ORIGIN = null;
+private static final boolean DEFAULT_CORS_DISABLED = false;
+private static final String DEFAULT_NO_KEYSTORE = null;
+private static final boolean DEFAULT_HTTPS_DISABLED = false;
+private static final String DEFAULT_NO_PASSWORD = null;
+private static final String DEFAULT_NO_TRUST_KEYSTORE = null;
+private static final String DEFAULT_NO_TRUST_PASSWORD = null;
 
 @Override
 protected void configure() {
@@ -77,11 +85,11 @@ public class WebAdminServerModule extends AbstractModule {
 try {
 PropertiesConfiguration configurationFile = 
propertiesProvider.getConfiguration("webadmin");
 return WebAdminConfiguration.builder()
-.enable(configurationFile.getBoolean("enabled", false))
+.enable(configurationFile.getBoolean("enabled", 
DEFAULT_DISABLED))
 .port(new FixedPort(configurationFile.getInt("port", 
WebAdminServer.DEFAULT_PORT)))
 .https(readHttpsConfiguration(configurationFile))
-.enableCORS(configurationFile.getBoolean("cors.enable", false))
-.urlCORSOrigin(configurationFile.getString("cors.origin", 
null))
+.enableCORS(configurationFile.getBoolean("cors.enable", 
DEFAULT_CORS_DISABLED))
+.urlCORSOrigin(configurationFile.getString("cors.origin", 
DEFAULT_NO_CORS_ORIGIN))
 .build();
 } catch (FileNotFoundException e) {
 return WebAdminConfiguration.builder()
@@ -105,14 +113,14 @@ public class WebAdminServerModule extends AbstractModule {
 }
 
 private HttpsConfiguration readHttpsConfiguration(PropertiesConfiguration 
configurationFile) {
-boolean enabled = configurationFile.getBoolean("https.enabled", 
DEFAULT_HTTPS_DISABLED());
+boolean enabled = configurationFile.getBoolean("https.enabled", 
DEFAULT_HTTPS_DISABLED);
 if (enabled) {
 return HttpsConfiguration.builder()
 .enabled()
-.raw(configurationFile.getString("https.keystore", null),
-configurationFile.getString("https.password", null),
-configurationFile.getString("https.trust.keystore", null),
-configurationFile.getString("https.trust.password", null))
+.raw(configurationFile.getString("https.keystore", 
DEFAULT_NO_KEYSTORE),
+configurationFile.getString("https.password", 
DEFAULT_NO_PASSWORD),
+configurationFile.getString("https.trust.keystore", 
DEFAULT_NO_TRUST_KEYSTORE),
+configurationFile.getString("https.trust.password", 
DEFAULT_NO_TRUST_PASSWORD))
 .build();
 }
 return HttpsConfiguration.builder()
@@ -120,10 +128,6 @@ public class WebAdminServerModule extends AbstractModule {
 .build();
 }
 
-private boolean DEFAULT_HTTPS_DISABLED() {
-return false;
-}
-
 @Singleton
 public static class Web

[22/22] james-project git commit: JAMES-1950 Move TimeMetric inside the JamesSpoolerWorker service

2017-03-15 Thread btellier
JAMES-1950 Move TimeMetric inside the JamesSpoolerWorker service

Measuring time out of the worker service don't make sense. Even if we loose 
time for the DeQueue time.


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

Branch: refs/heads/master
Commit: a00d5e4fd18da4866606ff41fefe10e9d5336943
Parents: 33b74fb
Author: benwa 
Authored: Wed Mar 15 10:38:58 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 16:57:31 2017 +0700

--
 .../org/apache/james/mailetcontainer/impl/JamesMailSpooler.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/a00d5e4f/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
--
diff --git 
a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
 
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
index 2875a00..896a7db 100644
--- 
a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
+++ 
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailSpooler.java
@@ -155,13 +155,13 @@ public class JamesMailSpooler implements Runnable, 
Disposable, Configurable, Log
 while (active.get()) {
 
 final MailQueueItem queueItem;
-TimeMetric timeMetric = metricFactory.timer(SPOOL_PROCESSING);
 try {
 queueItem = queue.deQueue();
 workerService.execute(new Runnable() {
 
 @Override
 public void run() {
+TimeMetric timeMetric = 
metricFactory.timer(SPOOL_PROCESSING);
 try {
 numActive.incrementAndGet();
 
@@ -195,6 +195,7 @@ public class JamesMailSpooler implements Runnable, 
Disposable, Configurable, Log
 } finally {
 processingActive.decrementAndGet();
 numActive.decrementAndGet();
+timeMetric.stopAndPublish();
 }
 
 }
@@ -206,8 +207,6 @@ public class JamesMailSpooler implements Runnable, 
Disposable, Configurable, Log
 }
 } catch (InterruptedException interrupted) {
 //MailSpooler is stopping
-} finally {
-timeMetric.stopAndPublish();
 }
 }
 logger.info("Stop {} : {}", getClass().getName(), 
Thread.currentThread().getName());


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



[20/22] james-project git commit: JAMES-1950 Add time measurement for JMS queues

2017-03-15 Thread btellier
JAMES-1950 Add time measurement for JMS queues


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

Branch: refs/heads/master
Commit: e8b94d178a0e23be25b7681900972b1bac48f543
Parents: a00d5e4
Author: benwa 
Authored: Wed Mar 15 10:44:50 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 16:57:31 2017 +0700

--
 .../james/queue/activemq/ActiveMQMailQueue.java   | 10 +-
 .../queue/activemq/ActiveMQMailQueueFactory.java  |  2 +-
 .../james/queue/activemq/ActiveMQMailQueueTest.java   |  6 ++
 .../java/org/apache/james/queue/jms/JMSMailQueue.java | 14 +++---
 .../apache/james/queue/jms/JMSMailQueueFactory.java   |  2 +-
 .../james/queue/jms/AbstractJMSMailQueueTest.java |  5 ++---
 6 files changed, 22 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/e8b94d17/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
--
diff --git 
a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
 
b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
index 8a80ad3..56c25c1 100644
--- 
a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
+++ 
b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
@@ -43,7 +43,7 @@ import org.apache.activemq.util.JMSExceptionSupport;
 import org.apache.james.core.MimeMessageCopyOnWriteProxy;
 import org.apache.james.core.MimeMessageInputStream;
 import org.apache.james.core.MimeMessageSource;
-import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.apache.james.queue.jms.JMSMailQueue;
@@ -93,8 +93,8 @@ public class ActiveMQMailQueue extends JMSMailQueue 
implements ActiveMQSupport {
  * Construct a {@link ActiveMQMailQueue} which only use {@link BlobMessage}
  * 
  */
-public ActiveMQMailQueue(ConnectionFactory connectionFactory, 
MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, String queuename, 
Metric enqueuedMailsMetric, Logger logger) {
-this(connectionFactory, mailQueueItemDecoratorFactory, queuename, 
true, enqueuedMailsMetric, logger);
+public ActiveMQMailQueue(ConnectionFactory connectionFactory, 
MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, String queuename, 
MetricFactory metricFactory, Logger logger) {
+this(connectionFactory, mailQueueItemDecoratorFactory, queuename, 
true, metricFactory, logger);
 }
 
 /**
@@ -105,8 +105,8 @@ public class ActiveMQMailQueue extends JMSMailQueue 
implements ActiveMQSupport {
  * @param useBlob
  * @param logger
  */
-public ActiveMQMailQueue(ConnectionFactory connectionFactory, 
MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, String queuename, 
boolean useBlob, Metric enqueuedMailsMetric, Logger logger) {
-super(connectionFactory, mailQueueItemDecoratorFactory, queuename, 
enqueuedMailsMetric, logger);
+public ActiveMQMailQueue(ConnectionFactory connectionFactory, 
MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, String queuename, 
boolean useBlob, MetricFactory metricFactory, Logger logger) {
+super(connectionFactory, mailQueueItemDecoratorFactory, queuename, 
metricFactory, logger);
 this.useBlob = useBlob;
 }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/e8b94d17/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueFactory.java
--
diff --git 
a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueFactory.java
 
b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueFactory.java
index 9646a29..5653066 100644
--- 
a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueFactory.java
+++ 
b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueFactory.java
@@ -50,6 +50,6 @@ public class ActiveMQMailQueueFactory extends 
JMSMailQueueFactory {
 
 @Override
 protected MailQueue createMailQueue(String name) {
-return new ActiveMQMailQueue(connectionFactory, 
mailQueueItemDecoratorFactory, name, useBlob, 
metricFactory.generate("enqueuedMails:

[02/22] james-project git commit: JAMES-1958 Define a configuration object for WebAdmin server

2017-03-15 Thread btellier
JAMES-1958 Define a configuration object for WebAdmin server


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

Branch: refs/heads/master
Commit: 6ae498a7c98ae9f61a2e51cf56c71f8fe6ee571b
Parents: 9d99b73
Author: benwa 
Authored: Wed Mar 8 14:09:26 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:52 2017 +0700

--
 server/protocols/webadmin/pom.xml   |  5 +
 .../org/apache/james/webadmin/FixedPort.java| 16 
 .../james/webadmin/WebAdminConfiguration.java   | 96 
 .../apache/james/webadmin/FixedPortTest.java|  7 ++
 .../webadmin/WebAdminConfigurationTest.java | 74 +++
 5 files changed, 198 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/6ae498a7/server/protocols/webadmin/pom.xml
--
diff --git a/server/protocols/webadmin/pom.xml 
b/server/protocols/webadmin/pom.xml
index 02cba3e..8ae6689 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -231,6 +231,11 @@
 slf4j-api
 
 
+nl.jqno.equalsverifier
+equalsverifier
+1.7.6
+
+
 org.slf4j
 slf4j-simple
 test

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ae498a7/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java
index e977f09..7ada8a1 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.webadmin;
 
+import java.util.Objects;
+
 import com.google.common.base.Preconditions;
 
 public class FixedPort implements Port {
@@ -35,4 +37,18 @@ public class FixedPort implements Port {
 return port;
 }
 
+@Override
+public final boolean equals(Object o) {
+if (o instanceof FixedPort) {
+FixedPort that = (FixedPort) o;
+
+return Objects.equals(this.port, that.port);
+}
+return false;
+}
+
+@Override
+public final int hashCode() {
+return Objects.hash(port);
+}
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/6ae498a7/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
new file mode 100644
index 000..b21749c
--- /dev/null
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
@@ -0,0 +1,96 @@
+/
+ * 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;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+
+public class

[13/22] james-project git commit: JAMES-1958 Port should be optional in WebAdminConfiguration

2017-03-15 Thread btellier
JAMES-1958 Port should be optional in WebAdminConfiguration


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

Branch: refs/heads/master
Commit: 553ba8570195770e3060ba8c343d60d93b8aa7ff
Parents: 20e362b
Author: benwa 
Authored: Mon Mar 13 17:37:38 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 .../apache/james/webadmin/WebAdminConfiguration.java| 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/553ba857/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
index 339b213..115aaef 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
@@ -37,7 +37,7 @@ public class WebAdminConfiguration {
 
 public static class Builder {
 private Optional enabled = Optional.empty();
-private Port port;
+private Optional port = Optional.empty();
 private Optional enableCORS = Optional.empty();
 private Optional httpsConfiguration = 
Optional.empty();
 private Optional urlCORSOrigin = Optional.empty();
@@ -48,7 +48,7 @@ public class WebAdminConfiguration {
 }
 
 public Builder port(Port port) {
-this.port = port;
+this.port = Optional.of(port);
 return this;
 }
 
@@ -84,7 +84,7 @@ public class WebAdminConfiguration {
 
 public WebAdminConfiguration build() {
 Preconditions.checkState(enabled.isPresent(), "You need to 
explicitly enable or disable WebAdmin server");
-Preconditions.checkState(!enabled.get() || port != null, "You need 
to specify a port for WebAdminConfiguration");
+Preconditions.checkState(!enabled.get() || port.isPresent(), "You 
need to specify a port for WebAdminConfiguration");
 return new WebAdminConfiguration(enabled.get(),
 port,
 httpsConfiguration.orElse(
@@ -97,13 +97,13 @@ public class WebAdminConfiguration {
 }
 
 private final boolean enabled;
-private final Port port;
+private final Optional port;
 private final TlsConfiguration tlsConfiguration;
 private final boolean enableCORS;
 private final String urlCORSOrigin;
 
 @VisibleForTesting
-WebAdminConfiguration(boolean enabled, Port port, TlsConfiguration 
tlsConfiguration, boolean enableCORS, String urlCORSOrigin) {
+WebAdminConfiguration(boolean enabled, Optional port, 
TlsConfiguration tlsConfiguration, boolean enableCORS, String urlCORSOrigin) {
 this.enabled = enabled;
 this.port = port;
 this.tlsConfiguration = tlsConfiguration;
@@ -120,7 +120,7 @@ public class WebAdminConfiguration {
 }
 
 public Port getPort() {
-return port;
+return port.orElseThrow(() -> new IllegalStateException("No port was 
specified"));
 }
 
 public TlsConfiguration getTlsConfiguration() {


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



[08/22] james-project git commit: JAMES-1959 Add integration test for JWT

2017-03-15 Thread btellier
JAMES-1959 Add integration test for JWT


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

Branch: refs/heads/master
Commit: 0b5d95bea7488cc7e96b50e8513ecc85c298a0ee
Parents: 8c9805d
Author: benwa 
Authored: Thu Mar 9 16:23:39 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../integration/JwtFilterIntegrationTest.java   | 136 +++
 .../src/test/resources/jwt_publickey|   9 ++
 2 files changed, 145 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/0b5d95be/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
--
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
new file mode 100644
index 000..06fc77c
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
@@ -0,0 +1,136 @@
+/
+ * 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 com.jayway.restassured.RestAssured.given;
+import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
+import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.james.webadmin.Constants.SEPARATOR;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Optional;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.jwt.JwtConfiguration;
+import org.apache.james.utils.DataProbeImpl;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.webadmin.authentication.AuthenticationFilter;
+import org.apache.james.webadmin.authentication.JwtFilter;
+import org.apache.james.webadmin.routes.DomainRoutes;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import com.google.common.base.Charsets;
+import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.response.Header;
+
+public class JwtFilterIntegrationTest {
+
+private static final String DOMAIN = "domain";
+private static final String SPECIFIC_DOMAIN = DomainRoutes.DOMAINS + 
SEPARATOR + DOMAIN;
+private static final String VALID_TOKEN_ADMIN_TRUE = 
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbkBvcGVuL" +
+
"XBhYXMub3JnIiwiYWRtaW4iOnRydWUsImlhdCI6MTQ4OTAzODQzOH0.rgxCkdWEa-92a4R-72a9Z49k4LRvQDShgci5Y7qWRUP9IGJCK-lMkrHF"
 +
+
"4H0a6L87BYppxVW701zaZ6dNxRMvHnjLBBWnPsC2B0rkkr2hEL2zfz7sb-iNGV-J4ICx97t8-TfQ5rz3VOX0FwdusPL_rJtmlGEGRivPkR6_aBe1"
 +
+
"kQnvMlwpqF_3ox58EUqYJk6lK_6rjKEV3Xfre31IMpuQUy6c7TKc95sL2-13cknelTierBEmZ00RzTtv9SHIEfzZTfaUK2Wm0PvnQjmU2nIdEvU"
 +
+"EqE-jrM3yYXcQzoO-YTQnEhdl-iqbCfmEpYkl2Bx3eIq7gRxxnr7BPsX6HrCB0w";
+private static final String VALID_TOKEN_ADMIN_FALSE = 
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbkBvcGVu" +
+
"LXBhYXMub3JnIiwiYWRtaW4iOmZhbHNlLCJpYXQiOjE0ODkwNDA4Njd9.reQc3DiVvbQHF08oW

[11/22] james-project git commit: JAMES-1960 Allow CORS request on WebAdmin (configuration defined)

2017-03-15 Thread btellier
JAMES-1960 Allow CORS request on WebAdmin (configuration defined)


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

Branch: refs/heads/master
Commit: 1463487763dc70f801922067a1d5e7b0f933bd6f
Parents: 0b5d95b
Author: benwa 
Authored: Thu Mar 9 14:40:56 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:26 2017 +0700

--
 .../destination/conf/webadmin.properties|  6 +-
 .../destination/conf/webadmin.properties|  6 +-
 .../modules/server/WebAdminServerModule.java|  2 +
 .../org/apache/james/webadmin/CORSFilter.java   | 40 +++
 .../james/webadmin/WebAdminConfiguration.java   | 49 --
 .../apache/james/webadmin/WebAdminServer.java   | 30 ++---
 .../webadmin/authentication/JwtFilter.java  | 15 +++--
 .../apache/james/webadmin/routes/CORSRoute.java | 42 
 .../webadmin/WebAdminConfigurationTest.java | 70 +++-
 9 files changed, 236 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/14634877/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
index a9aced0..38e2ba0 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
@@ -33,4 +33,8 @@ https.enabled=false
 #https.trust.password
 
 # Defaults to false
-#jwt.enabled=true
\ No newline at end of file
+#jwt.enabled=true
+
+# Defaults to false
+#cors.enable=true
+#cors.origin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/14634877/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
index a9aced0..38e2ba0 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
@@ -33,4 +33,8 @@ https.enabled=false
 #https.trust.password
 
 # Defaults to false
-#jwt.enabled=true
\ No newline at end of file
+#jwt.enabled=true
+
+# Defaults to false
+#cors.enable=true
+#cors.origin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/14634877/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 68e1b43..1532471 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -80,6 +80,8 @@ public class WebAdminServerModule extends AbstractModule {
 .enable(configurationFile.getBoolean("enabled", false))
 .port(new FixedPort(configurationFile.getInt("port", 
WebAdminServer.DEFAULT_PORT)))
 .https(readHttpsConfiguration(configurationFile))
+.enableCORS(configurationFile.getBoolean("cors.enable", false))
+.urlCORSOrigin(configurationFile.getString("cors.origin", 
null))
 .build();
 } catch (FileNotFoundException e) {
 return WebAdminConfiguration.builder()

http://git-wip-us.apache.org/repos/asf/james-project/blob/14634877/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java
new file mode 100644
index 000..c4cfb29
--- /dev/null
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java
@@ -0,0 +1,40 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or 

[05/22] james-project git commit: JAMES-1959 Disable JWT authentication on JPA

2017-03-15 Thread btellier
JAMES-1959 Disable JWT authentication on JPA


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

Branch: refs/heads/master
Commit: 8c9805d4b844280c8462d954ceefb3256337a197
Parents: 3d327f7
Author: benwa 
Authored: Thu Mar 9 14:53:49 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../org/apache/james/JPAJamesServerMain.java|  4 ++-
 .../james/modules/server/NoJwtModule.java   | 36 
 2 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/8c9805d4/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
--
diff --git 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index 4235822..4514fba 100644
--- 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -32,6 +32,7 @@ import 
org.apache.james.modules.protocols.ProtocolHandlerModule;
 import org.apache.james.modules.protocols.SMTPServerModule;
 import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.NoJwtModule;
 import org.apache.james.modules.server.QuotaModule;
 import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
 import org.apache.james.modules.server.WebAdminServerModule;
@@ -57,7 +58,8 @@ public class JPAJamesServerMain {
 new QuotaModule(),
 new ActiveMQQueueModule(),
 new RawPostDequeueDecoratorModule(),
-new MailboxModule());
+new MailboxModule(),
+new NoJwtModule());
 
 public static void main(String[] args) throws Exception {
 GuiceJamesServer server = new GuiceJamesServer()

http://git-wip-us.apache.org/repos/asf/james-project/blob/8c9805d4/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java
--
diff --git 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java
 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java
new file mode 100644
index 000..10d3754
--- /dev/null
+++ 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java
@@ -0,0 +1,36 @@
+/
+ * 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.modules.server;
+
+import java.util.Optional;
+
+import org.apache.james.jwt.JwtConfiguration;
+import org.apache.james.webadmin.authentication.AuthenticationFilter;
+import org.apache.james.webadmin.authentication.NoAuthenticationFilter;
+
+import com.google.inject.AbstractModule;
+
+public class NoJwtModule extends AbstractModule {
+
+@Override
+protected void configure() {
+bind(JwtConfiguration.class).toInstance(new 
JwtConfiguration(Optional.empty()));
+}
+}


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



[07/22] james-project git commit: JAMES-1958 Add a HttpsConfiguration

2017-03-15 Thread btellier
JAMES-1958 Add a HttpsConfiguration


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

Branch: refs/heads/master
Commit: ef84ed711275c5d7ecdab05fc2e54e5955381ca3
Parents: da41f83
Author: benwa 
Authored: Wed Mar 8 15:14:15 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../james/webadmin/HttpsConfiguration.java  | 148 +++
 .../james/webadmin/WebAdminConfiguration.java   |  21 ++-
 .../james/webadmin/HttpsConfigurationTest.java  | 101 +
 .../webadmin/WebAdminConfigurationTest.java |  20 ++-
 4 files changed, 286 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/ef84ed71/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
new file mode 100644
index 000..3c6a49e
--- /dev/null
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
@@ -0,0 +1,148 @@
+/
+ * 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;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+
+public class HttpsConfiguration {
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private Optional enabled = Optional.empty();
+private String keystoreFilePath;
+private String keystorePassword;
+private String truststoreFilePath;
+private String truststorePassword;
+
+public Builder enable(boolean isEnabled) {
+this.enabled = Optional.of(isEnabled);
+return this;
+}
+
+public Builder enabled() {
+return enable(true);
+}
+
+public Builder disabled() {
+return enable(false);
+}
+
+public Builder raw(String keystoreFilePath,
+   String keystorePassword,
+   String truststoreFilePath,
+   String truststorePassword){
+Preconditions.checkNotNull(keystoreFilePath);
+Preconditions.checkNotNull(keystorePassword);
+
+this.keystoreFilePath = keystoreFilePath;
+this.keystorePassword = keystorePassword;
+this.truststoreFilePath = truststoreFilePath;
+this.truststorePassword = truststorePassword;
+return this;
+}
+
+public Builder selfSigned(String keystoreFilePath, String 
keystorePassword){
+Preconditions.checkNotNull(keystoreFilePath);
+Preconditions.checkNotNull(keystorePassword);
+
+this.enabled = Optional.of(true);
+this.keystoreFilePath = keystoreFilePath;
+this.keystorePassword = keystorePassword;
+return this;
+}
+
+public HttpsConfiguration build() {
+Preconditions.checkState(enabled.isPresent(), "You need to specify 
if https is enabled");
+Preconditions.checkState(!enabled.get() || 
hasKeystoreInformation(), "If enabled, you need to provide keystore 
information");
+

[14/22] james-project git commit: JAMES-1958 Adding defaults configurations for WebAdmin and Tls

2017-03-15 Thread btellier
JAMES-1958 Adding defaults configurations for WebAdmin and Tls


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

Branch: refs/heads/master
Commit: fd82c99ed86ecbd766cc49a1895640e1691e01da
Parents: 553ba85
Author: benwa 
Authored: Mon Mar 13 17:48:30 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 .../apache/james/modules/server/WebAdminServerModule.java   | 9 +++--
 .../java/org/apache/james/webadmin/TlsConfiguration.java| 4 
 .../org/apache/james/webadmin/WebAdminConfiguration.java| 8 
 .../main/java/org/apache/james/webadmin/WebAdminServer.java | 5 +
 4 files changed, 16 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/fd82c99e/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 0af2cce..4695bdd 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.modules.server;
 
+import static 
org.apache.james.webadmin.WebAdminConfiguration.DISABLED_CONFIGURATION;
 import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
 
 import java.io.FileNotFoundException;
@@ -96,9 +97,7 @@ public class WebAdminServerModule extends AbstractModule {
 .build();
 } catch (FileNotFoundException e) {
 LOGGER.info("No webadmin.properties file. Disabling WebAdmin 
interface.");
-return WebAdminConfiguration.builder()
-.disabled()
-.build();
+return DISABLED_CONFIGURATION;
 }
 }
 
@@ -127,9 +126,7 @@ public class WebAdminServerModule extends AbstractModule {
 configurationFile.getString("https.trust.password", 
DEFAULT_NO_TRUST_PASSWORD))
 .build();
 }
-return TlsConfiguration.builder()
-.disabled()
-.build();
+return TlsConfiguration.DEFAULT_DISABLE;
 }
 
 @Singleton

http://git-wip-us.apache.org/repos/asf/james-project/blob/fd82c99e/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
index 78cc209..81ecb66 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
@@ -27,6 +27,10 @@ import com.google.common.base.Preconditions;
 
 public class TlsConfiguration {
 
+public static final TlsConfiguration DEFAULT_DISABLE = 
TlsConfiguration.builder()
+.disabled()
+.build();
+
 public static Builder builder() {
 return new Builder();
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/fd82c99e/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
index 115aaef..c61ae86 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java
@@ -31,6 +31,14 @@ public class WebAdminConfiguration {
 public static final boolean DEFAULT_CORS_DISABLED = false;
 public static final String CORS_ALL_ORIGINS = "*";
 
+public static final WebAdminConfiguration TESTING_CONFIGURATION = 
WebAdminConfiguration.builder()
+.enabled()
+.port(new RandomPort())
+.build();
+public static final WebAdminConfiguration DISABLED_CONFIGURATION = 
WebAdminConfiguration.builder()
+.disabled()
+.build();
+

[18/22] james-project git commit: JAMES-1958 Improve WebAdminConfiguration and TlsConfiguration

2017-03-15 Thread btellier
JAMES-1958 Improve WebAdminConfiguration and TlsConfiguration


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

Branch: refs/heads/master
Commit: ca04fd6e3d314c042975263874245bed68bb893f
Parents: ef119a4
Author: benwa 
Authored: Tue Mar 14 15:53:29 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:32 2017 +0700

--
 .../modules/server/WebAdminServerModule.java| 12 +++
 .../apache/james/webadmin/TlsConfiguration.java | 38 +++-
 .../james/webadmin/WebAdminConfiguration.java   | 26 --
 .../apache/james/webadmin/WebAdminServer.java   |  4 +--
 .../james/webadmin/TlsConfigurationTest.java| 19 ++
 .../webadmin/WebAdminConfigurationTest.java | 31 ++--
 6 files changed, 60 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/ca04fd6e/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 4695bdd..9c449a3 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -24,6 +24,7 @@ import static 
org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
 
 import java.io.FileNotFoundException;
 import java.util.List;
+import java.util.Optional;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
@@ -91,7 +92,7 @@ public class WebAdminServerModule extends AbstractModule {
 return WebAdminConfiguration.builder()
 .enable(configurationFile.getBoolean("enabled", 
DEFAULT_DISABLED))
 .port(new FixedPort(configurationFile.getInt("port", 
WebAdminServer.DEFAULT_PORT)))
-.https(readHttpsConfiguration(configurationFile))
+.tls(readHttpsConfiguration(configurationFile))
 .enableCORS(configurationFile.getBoolean("cors.enable", 
DEFAULT_CORS_DISABLED))
 .urlCORSOrigin(configurationFile.getString("cors.origin", 
DEFAULT_NO_CORS_ORIGIN))
 .build();
@@ -115,18 +116,17 @@ public class WebAdminServerModule extends AbstractModule {
 }
 }
 
-private TlsConfiguration readHttpsConfiguration(PropertiesConfiguration 
configurationFile) {
+private Optional 
readHttpsConfiguration(PropertiesConfiguration configurationFile) {
 boolean enabled = configurationFile.getBoolean("https.enabled", 
DEFAULT_HTTPS_DISABLED);
 if (enabled) {
-return TlsConfiguration.builder()
-.enabled()
+return Optional.of(TlsConfiguration.builder()
 .raw(configurationFile.getString("https.keystore", 
DEFAULT_NO_KEYSTORE),
 configurationFile.getString("https.password", 
DEFAULT_NO_PASSWORD),
 configurationFile.getString("https.trust.keystore", 
DEFAULT_NO_TRUST_KEYSTORE),
 configurationFile.getString("https.trust.password", 
DEFAULT_NO_TRUST_PASSWORD))
-.build();
+.build());
 }
-return TlsConfiguration.DEFAULT_DISABLE;
+return Optional.empty();
 }
 
 @Singleton

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca04fd6e/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
index 81ecb66..d549ea3 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java
@@ -20,41 +20,22 @@
 package org.apache.james.webadmin;
 
 import java.util.Objects;
-import java.util.Optional;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 
 public class TlsConfiguration {
 
-public static final TlsConfiguration DEFAULT_DISABLE = 
TlsConfigura

[17/22] james-project git commit: JAMES-1958 Adding a log message when WebAdmin configuration file is absent

2017-03-15 Thread btellier
JAMES-1958 Adding a log message when WebAdmin configuration file is absent


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

Branch: refs/heads/master
Commit: 20e362bfcde3c83f4a51feef6bb97427d74d4473
Parents: 9db1633
Author: benwa 
Authored: Mon Mar 13 17:34:31 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 .../org/apache/james/modules/server/WebAdminServerModule.java| 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/20e362bf/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 431d0d5..0af2cce 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -44,6 +44,8 @@ import org.apache.james.webadmin.routes.DomainRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
 import org.apache.james.webadmin.utils.JsonTransformer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
@@ -56,6 +58,7 @@ import com.google.inject.multibindings.Multibinder;
 
 public class WebAdminServerModule extends AbstractModule {
 
+private static final Logger LOGGER = 
LoggerFactory.getLogger(WebAdminServerModule.class);
 private static final boolean DEFAULT_JWT_DISABLED = false;
 private static final boolean DEFAULT_DISABLED = false;
 private static final String DEFAULT_NO_CORS_ORIGIN = null;
@@ -92,6 +95,7 @@ public class WebAdminServerModule extends AbstractModule {
 .urlCORSOrigin(configurationFile.getString("cors.origin", 
DEFAULT_NO_CORS_ORIGIN))
 .build();
 } catch (FileNotFoundException e) {
+LOGGER.info("No webadmin.properties file. Disabling WebAdmin 
interface.");
 return WebAdminConfiguration.builder()
 .disabled()
 .build();


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



[21/22] james-project git commit: JAMES-1950 Add time metrics on Remote Mail delivering

2017-03-15 Thread btellier
JAMES-1950 Add time metrics on Remote Mail delivering


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

Branch: refs/heads/master
Commit: 33b74fbca401d8aa78c8d931497fff5862b2240e
Parents: ca04fd6
Author: benwa 
Authored: Wed Mar 15 10:27:24 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 16:57:31 2017 +0700

--
 .../james/transport/mailets/RemoteDelivery.java|  7 +++
 .../mailets/remoteDelivery/DeliveryRunnable.java   | 17 +
 .../remoteDelivery/DeliveryRunnableTest.java   |  8 +++-
 3 files changed, 23 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/33b74fbc/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
--
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
index 006c6bc..1019e30 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
@@ -126,13 +126,12 @@ public class RemoteDelivery extends GenericMailet {
 DO_NOT_START_THREADS
 }
 
-private static final String OUTGOING_MAILS = "outgoingMails";
 public static final String NAME_JUNCTION = "-to-";
 
 private final DNSService dnsServer;
 private final DomainList domainList;
 private final MailQueueFactory queueFactory;
-private final Metric outgoingMailsMetric;
+private final MetricFactory metricFactory;
 private final AtomicBoolean isDestroyed;
 private final THREAD_STATE startThreads;
 
@@ -150,7 +149,7 @@ public class RemoteDelivery extends GenericMailet {
 this.dnsServer = dnsServer;
 this.domainList = domainList;
 this.queueFactory = queueFactory;
-this.outgoingMailsMetric = metricFactory.generate(OUTGOING_MAILS);
+this.metricFactory = metricFactory;
 this.isDestroyed = new AtomicBoolean(false);
 this.startThreads = startThreads;
 }
@@ -177,7 +176,7 @@ public class RemoteDelivery extends GenericMailet {
 new DeliveryRunnable(queue,
 configuration,
 dnsServer,
-outgoingMailsMetric,
+metricFactory,
 logger,
 getMailetContext(),
 new Bouncer(configuration, getMailetContext(), logger),

http://git-wip-us.apache.org/repos/asf/james-project/blob/33b74fbc/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/DeliveryRunnable.java
--
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/DeliveryRunnable.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/DeliveryRunnable.java
index a7cf23b..b34f3af 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/DeliveryRunnable.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/DeliveryRunnable.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.api.TimeMetric;
 import org.apache.james.queue.api.MailPrioritySupport;
 import org.apache.james.queue.api.MailQueue;
 import org.apache.mailet.Mail;
@@ -44,34 +46,38 @@ public class DeliveryRunnable implements Runnable {
 }
 };
 public static final AtomicBoolean DEFAULT_NOT_STARTED = new 
AtomicBoolean(false);
+private static final String OUTGOING_MAILS = "outgoingMails";
+public static final String REMOTE_DELIVERY_TRIAL = "RemoteDeliveryTrial";
 
 private final MailQueue queue;
 private final RemoteDeliveryConfiguration configuration;
 private final Metric outgoingMailsMetric;
+private final MetricFactory metricFactory;
 private final Logger logger;
 private final Bouncer bouncer;
 private final MailDelivrer mailDelivrer;
 private final AtomicBoolean isDestroyed;
 private final Supplier dateSupplier;
 
-public DeliveryRunnable(MailQueue queue, RemoteDeliveryConfiguration 
confi

[06/22] james-project git commit: JAMES-1959 Implement a Jwt authentication filter for webAdmin

2017-03-15 Thread btellier
JAMES-1959 Implement a Jwt authentication filter for 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/3d327f72
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3d327f72
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3d327f72

Branch: refs/heads/master
Commit: 3d327f720772a841844cb2f1033830c13d8e63ac
Parents: f1a087f
Author: benwa 
Authored: Wed Mar 8 17:54:58 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../destination/conf/webadmin.properties|   5 +-
 .../destination/conf/webadmin.properties|   5 +-
 .../modules/server/WebAdminServerModule.java|  20 +++
 .../org/apache/james/jwt/JwtTokenVerifier.java  |  33 -
 .../apache/james/jwt/JwtTokenVerifierTest.java  |  63 +++---
 server/protocols/webadmin/pom.xml   |   4 +
 .../apache/james/webadmin/WebAdminServer.java   |  10 +-
 .../authentication/AuthenticationFilter.java|  25 
 .../webadmin/authentication/JwtFilter.java  |  73 +++
 .../authentication/NoAuthenticationFilter.java  |  31 +
 .../webadmin/authentication/JwtFilterTest.java  | 124 +++
 11 files changed, 364 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/3d327f72/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
index 3a1e755..a9aced0 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/webadmin.properties
@@ -30,4 +30,7 @@ https.enabled=false
 
 # Optional when enabling HTTPS (self signed)
 #https.trust.keystore
-#https.trust.password
\ No newline at end of file
+#https.trust.password
+
+# Defaults to false
+#jwt.enabled=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d327f72/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
--
diff --git 
a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties 
b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
index 3a1e755..a9aced0 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/webadmin.properties
@@ -30,4 +30,7 @@ https.enabled=false
 
 # Optional when enabling HTTPS (self signed)
 #https.trust.keystore
-#https.trust.password
\ No newline at end of file
+#https.trust.password
+
+# Defaults to false
+#jwt.enabled=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d327f72/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index 29c6223..68e1b43 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -26,6 +26,7 @@ import java.util.List;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.jwt.JwtTokenVerifier;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.utils.ConfigurationPerformer;
 import org.apache.james.utils.GuiceProbe;
@@ -36,6 +37,9 @@ import org.apache.james.webadmin.HttpsConfiguration;
 import org.apache.james.webadmin.Routes;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.apache.james.webadmin.WebAdminServer;
+import org.apache.james.webadmin.authentication.AuthenticationFilter;
+import org.apache.james.webadmin.authentication.JwtFilter;
+import org.apache.james.webadmin.authentication.NoAuthenticationFilter;
 import org.apache.james.webadmin.routes.DomainRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
@@ -52,6 +56,8 @@ import com.google.inject.multibindings.Multibinder;
 
 public class WebAdminServerModule extends AbstractModule {
 
+public static final boolean DEFAULT_JWT_DISABLED = false;
+
 @

[09/22] james-project git commit: JAMES-1959 Extract JWT to an other maven project

2017-03-15 Thread btellier
JAMES-1959 Extract JWT to an other maven project


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

Branch: refs/heads/master
Commit: f1a087fa60217383969f2a281703f8cf0e0d8efb
Parents: 3ac2368
Author: benwa 
Authored: Wed Mar 8 17:25:54 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:53 2017 +0700

--
 .../java/org/apache/james/jmap/JMAPModule.java  |   7 +
 server/pom.xml  |   6 +
 server/protocols/jmap/pom.xml   |   4 +
 .../james/jmap/JWTAuthenticationStrategy.java   |   2 +-
 .../james/jmap/crypto/JwtTokenVerifier.java |  63 -
 .../crypto/MissingOrInvalidKeyException.java|  22 --
 .../james/jmap/crypto/PublicKeyProvider.java|  44 
 .../james/jmap/crypto/PublicKeyReader.java  |  56 -
 .../jmap/JWTAuthenticationStrategyTest.java |   2 +-
 .../james/jmap/crypto/JwtTokenVerifierTest.java | 124 --
 .../jmap/crypto/PublicKeyProviderTest.java  |  74 --
 .../james/jmap/crypto/PublicKeyReaderTest.java  |  62 -
 server/protocols/jwt/pom.xml| 245 +++
 .../org/apache/james/jwt/JwtConfiguration.java  |  34 +++
 .../org/apache/james/jwt/JwtTokenVerifier.java  |  63 +
 .../james/jwt/MissingOrInvalidKeyException.java |  22 ++
 .../org/apache/james/jwt/PublicKeyProvider.java |  44 
 .../org/apache/james/jwt/PublicKeyReader.java   |  56 +
 .../apache/james/jwt/JwtTokenVerifierTest.java  | 119 +
 .../apache/james/jwt/PublicKeyProviderTest.java |  67 +
 .../apache/james/jwt/PublicKeyReaderTest.java   |  62 +
 21 files changed, 731 insertions(+), 447 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/f1a087fa/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
--
diff --git 
a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
 
b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
index 7269cb1..eca11aa 100644
--- 
a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
+++ 
b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
@@ -34,6 +34,7 @@ import org.apache.james.jmap.utils.HtmlTextExtractor;
 import org.apache.james.jmap.utils.MailboxBasedHtmlTextExtractor;
 import org.apache.james.jmap.utils.SystemMailboxesProvider;
 import org.apache.james.jmap.utils.SystemMailboxesProviderImpl;
+import org.apache.james.jwt.JwtConfiguration;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManager.SearchCapabilities;
@@ -89,6 +90,12 @@ public class JMAPModule extends AbstractModule {
 .build();
 }
 
+@Provides
+@Singleton
+JwtConfiguration providesJwtConfiguration(JMAPConfiguration 
jmapConfiguration) {
+return new JwtConfiguration(jmapConfiguration.getJwtPublicKeyPem());
+}
+
 private Optional loadPublicKey(FileSystem fileSystem, 
Optional jwtPublickeyPemUrl) {
 return jwtPublickeyPemUrl.map(Throwing.function(url -> 
FileUtils.readFileToString(fileSystem.getFile(url;
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f1a087fa/server/pom.xml
--
diff --git a/server/pom.xml b/server/pom.xml
index 4ceaa15..4b7d969 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -109,6 +109,7 @@
 protocols/webadmin-integration-test
 
 testing
+protocols/jwt
 
 
 
@@ -807,6 +808,11 @@
 
 
 org.apache.james
+james-server-jwt
+${project.version}
+
+
+org.apache.james
 james-server-protocols-lmtp
 ${project.version}
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f1a087fa/server/protocols/jmap/pom.xml
--
diff --git a/server/protocols/jmap/pom.xml b/server/protocols/jmap/pom.xml
index 152dc79..287e428 100644
--- a/server/protocols/jmap/pom.xml
+++ b/server/protocols/jmap/pom.xml
@@ -217,6 +217,10 @@
 
 
 org.apache.james
+james-server-jwt
+
+
+org.apache.james
 james-server-lifecycle-api
   

[01/22] james-project git commit: JAMES-1958 Rely on this configuration object to start WebAdmin server

2017-03-15 Thread btellier
Repository: james-project
Updated Branches:
  refs/heads/master a43fbd41b -> e8b94d178


JAMES-1958 Rely on this configuration object to start WebAdmin server


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

Branch: refs/heads/master
Commit: da41f83ee2d33942c4090ab2b7c0ee104c26e8bd
Parents: 6ae498a
Author: benwa 
Authored: Wed Mar 8 14:25:58 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:52 2017 +0700

--
 .../modules/server/WebAdminServerModule.java| 29 
 .../WebAdminConfigurationModule.java| 19 -
 .../apache/james/webadmin/WebAdminServer.java   | 27 --
 3 files changed, 29 insertions(+), 46 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/da41f83e/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index a9aed5c..8495797 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -20,21 +20,20 @@
 package org.apache.james.modules.server;
 
 import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
-import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_ENABLED;
-import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_PORT;
 
 import java.io.FileNotFoundException;
 import java.util.List;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.utils.ConfigurationPerformer;
 import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.PropertiesProvider;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.FixedPort;
-import org.apache.james.webadmin.Port;
 import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.WebAdminConfiguration;
 import org.apache.james.webadmin.WebAdminServer;
 import org.apache.james.webadmin.routes.DomainRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
@@ -49,7 +48,6 @@ import com.google.inject.Provides;
 import com.google.inject.Scopes;
 import com.google.inject.Singleton;
 import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Named;
 
 public class WebAdminServerModule extends AbstractModule {
 
@@ -68,22 +66,17 @@ public class WebAdminServerModule extends AbstractModule {
 }
 
 @Provides
-@Named(WEBADMIN_PORT)
-public Port provideWebAdminPort(PropertiesProvider propertiesProvider) 
throws Exception {
+public WebAdminConfiguration 
provideWebAdminConfiguration(PropertiesProvider propertiesProvider) throws 
Exception {
 try {
-return new 
FixedPort(propertiesProvider.getConfiguration("webadmin").getInt("port", 
WebAdminServer.DEFAULT_PORT));
+PropertiesConfiguration configurationFile = 
propertiesProvider.getConfiguration("webadmin");
+return WebAdminConfiguration.builder()
+.enable(configurationFile.getBoolean("enabled", false))
+.port(new FixedPort(configurationFile.getInt("port", 
WebAdminServer.DEFAULT_PORT)))
+.build();
 } catch (FileNotFoundException e) {
-return new FixedPort(WebAdminServer.DEFAULT_PORT);
-}
-}
-
-@Provides
-@Named(WEBADMIN_ENABLED)
-public boolean provideWebAdminEnabled(PropertiesProvider 
propertiesProvider) throws Exception {
-try {
-return 
propertiesProvider.getConfiguration("webadmin").getBoolean("enabled", false);
-} catch (FileNotFoundException e) {
-return false;
+return WebAdminConfiguration.builder()
+.disabled()
+.build();
 }
 }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/da41f83e/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminConfigurationModule.java
--
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache

[04/22] james-project git commit: JAMES-1961 Increase Spark version to get logs for 500

2017-03-15 Thread btellier
JAMES-1961 Increase Spark version to get logs for 500


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

Branch: refs/heads/master
Commit: 0fc16af0c1ad4d2d902eb74236c9b2e5a980cee2
Parents: a43fbd4
Author: benwa 
Authored: Thu Mar 9 16:16:48 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:52 2017 +0700

--
 server/protocols/webadmin/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/0fc16af0/server/protocols/webadmin/pom.xml
--
diff --git a/server/protocols/webadmin/pom.xml 
b/server/protocols/webadmin/pom.xml
index 3f9bae4..02cba3e 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -193,7 +193,7 @@
 
 com.sparkjava
 spark-core
-2.5
+2.5.5
 
 
 de.bechte.junit


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



[12/22] james-project git commit: JAMES-1958 Rename HttpsConfiguration to TlsConfiguration

2017-03-15 Thread btellier
JAMES-1958 Rename HttpsConfiguration to TlsConfiguration


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

Branch: refs/heads/master
Commit: 9db1633a54787945706da2a4b3edd746f4757f74
Parents: 642be79
Author: benwa 
Authored: Mon Mar 13 17:31:26 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 .../modules/server/WebAdminServerModule.java|   8 +-
 .../james/webadmin/HttpsConfiguration.java  | 148 ---
 .../apache/james/webadmin/TlsConfiguration.java | 148 +++
 .../james/webadmin/WebAdminConfiguration.java   |  22 +--
 .../apache/james/webadmin/WebAdminServer.java   |  16 +-
 .../james/webadmin/HttpsConfigurationTest.java  | 101 -
 .../james/webadmin/TlsConfigurationTest.java| 101 +
 .../webadmin/WebAdminConfigurationTest.java |  16 +-
 8 files changed, 278 insertions(+), 282 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/9db1633a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
--
diff --git 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
index c100dcb..431d0d5 100644
--- 
a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ 
b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -33,7 +33,7 @@ import org.apache.james.utils.GuiceProbe;
 import org.apache.james.utils.PropertiesProvider;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.FixedPort;
-import org.apache.james.webadmin.HttpsConfiguration;
+import org.apache.james.webadmin.TlsConfiguration;
 import org.apache.james.webadmin.Routes;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.apache.james.webadmin.WebAdminServer;
@@ -112,10 +112,10 @@ public class WebAdminServerModule extends AbstractModule {
 }
 }
 
-private HttpsConfiguration readHttpsConfiguration(PropertiesConfiguration 
configurationFile) {
+private TlsConfiguration readHttpsConfiguration(PropertiesConfiguration 
configurationFile) {
 boolean enabled = configurationFile.getBoolean("https.enabled", 
DEFAULT_HTTPS_DISABLED);
 if (enabled) {
-return HttpsConfiguration.builder()
+return TlsConfiguration.builder()
 .enabled()
 .raw(configurationFile.getString("https.keystore", 
DEFAULT_NO_KEYSTORE),
 configurationFile.getString("https.password", 
DEFAULT_NO_PASSWORD),
@@ -123,7 +123,7 @@ public class WebAdminServerModule extends AbstractModule {
 configurationFile.getString("https.trust.password", 
DEFAULT_NO_TRUST_PASSWORD))
 .build();
 }
-return HttpsConfiguration.builder()
+return TlsConfiguration.builder()
 .disabled()
 .build();
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/9db1633a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
deleted file mode 100644
index 3c6a49e..000
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/HttpsConfiguration.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/
- * 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 wri

[19/22] james-project git commit: JAMES-1958 Rely on AssertJ extractions when asserting big Pojo

2017-03-15 Thread btellier
JAMES-1958 Rely on AssertJ extractions when asserting big Pojo


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

Branch: refs/heads/master
Commit: ef119a44f2103d3073c6558c26f18f5b8791f9ef
Parents: fd82c99
Author: benwa 
Authored: Mon Mar 13 17:57:42 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:32 2017 +0700

--
 .../webadmin/WebAdminConfigurationTest.java | 74 ++--
 1 file changed, 38 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/ef119a44/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/WebAdminConfigurationTest.java
--
diff --git 
a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/WebAdminConfigurationTest.java
 
b/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/WebAdminConfigurationTest.java
index 48df15e..dd46f34 100644
--- 
a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/WebAdminConfigurationTest.java
+++ 
b/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/WebAdminConfigurationTest.java
@@ -46,11 +46,8 @@ public class WebAdminConfigurationTest {
 assertThat(WebAdminConfiguration.builder()
 .disabled()
 .build())
-.isEqualTo(new WebAdminConfiguration(false,
-null,
-TlsConfiguration.builder().disabled().build(),
-false,
-"*"));
+.extracting(WebAdminConfiguration::isEnabled)
+.containsExactly(false);
 }
 
 @Test
@@ -61,18 +58,26 @@ public class WebAdminConfigurationTest {
 }
 
 @Test
-public void builderShouldBuildRightObject() {
+public void builderShouldBuildWithRightPort() {
 assertThat(
 WebAdminConfiguration.builder()
 .enabled()
 .port(PORT)
 .build())
-.isEqualTo(new WebAdminConfiguration(
-true,
-PORT,
-TlsConfiguration.builder().disabled().build(),
-false,
-"*"));
+.extracting(WebAdminConfiguration::getPort)
+.containsExactly(PORT);
+}
+
+
+@Test
+public void builderShouldBuildWithEnable() {
+assertThat(
+WebAdminConfiguration.builder()
+.enabled()
+.port(PORT)
+.build())
+.extracting(WebAdminConfiguration::isEnabled)
+.containsExactly(true);
 }
 
 @Test
@@ -88,12 +93,8 @@ public class WebAdminConfigurationTest {
 .https(tlsConfiguration)
 .port(PORT)
 .build())
-.isEqualTo(new WebAdminConfiguration(
-true,
-PORT,
-tlsConfiguration,
-false,
-"*"));
+.extracting(WebAdminConfiguration::getTlsConfiguration)
+.containsExactly(tlsConfiguration);
 }
 
 @Test
@@ -104,12 +105,21 @@ public class WebAdminConfigurationTest {
 .port(PORT)
 .CORSenabled()
 .build())
-.isEqualTo(new WebAdminConfiguration(
-true,
-PORT,
-TlsConfiguration.builder().disabled().build(),
-true,
-"*"));
+.extracting(WebAdminConfiguration::isEnableCORS)
+.containsExactly(true);
+}
+
+
+@Test
+public void builderShouldAcceptAllOriginsByDefault() {
+assertThat(
+WebAdminConfiguration.builder()
+.enabled()
+.port(PORT)
+.CORSenabled()
+.build())
+.extracting(WebAdminConfiguration::getUrlCORSOrigin)
+.containsExactly("*");
 }
 
 @Test
@@ -120,12 +130,8 @@ public class WebAdminConfigurationTest {
 .port(PORT)
 .CORSdisabled()
 .build())
-.isEqualTo(new WebAdminConfiguration(
-true,
-PORT,
-TlsConfiguration.builder().disabled().build(),
-false,
-"*"));
+.extracting(WebAdminConfiguration::isEnableCORS)
+.containsExactly(false);
 }
 
 @Test
@@ -138,12 +144,8 @@ public class WebAdminConfigurationTest {
 .CORSenabled()
 .urlCORSOrigin(origin)
 .build())
-.isEqualTo(new WebAdminConfiguration(
-true,

[03/22] james-project git commit: JAMES-1959 Adding more logs when failed to read keys

2017-03-15 Thread btellier
JAMES-1959 Adding more logs when failed to read keys


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

Branch: refs/heads/master
Commit: 9d99b73afe994300b82fe320823f6107b17e646b
Parents: 0fc16af
Author: benwa 
Authored: Thu Mar 9 16:22:36 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:01:52 2017 +0700

--
 .../main/java/org/apache/james/jmap/crypto/PublicKeyReader.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/9d99b73a/server/protocols/jmap/src/main/java/org/apache/james/jmap/crypto/PublicKeyReader.java
--
diff --git 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/crypto/PublicKeyReader.java
 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/crypto/PublicKeyReader.java
index 25f2ed8..b695c26 100644
--- 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/crypto/PublicKeyReader.java
+++ 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/crypto/PublicKeyReader.java
@@ -35,7 +35,6 @@ public class PublicKeyReader {
 private static final Logger LOGGER = 
LoggerFactory.getLogger(PublicKeyReader.class);
 
 Optional fromPEM(Optional pemKey) {
-
 return pemKey
 .map(k -> new PEMParser(new PemReader(new StringReader(k
 .flatMap(this::publicKeyFrom);
@@ -47,6 +46,7 @@ public class PublicKeyReader {
 if (readPEM instanceof SubjectPublicKeyInfo) {
 return Optional.of(new 
JcaPEMKeyConverter().getPublicKey((SubjectPublicKeyInfo) readPEM));
 }
+LOGGER.warn("Key is not an instance of SubjectPublicKeyInfo but of 
" + readPEM);
 return Optional.empty();
 } catch (IOException e) {
 LOGGER.warn("Error when reading the PEM file", e);


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



[15/22] james-project git commit: JAMES-1962 Enable basic metric collection on WebAdmin

2017-03-15 Thread btellier
JAMES-1962 Enable basic metric collection on 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/3dfb05f3
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3dfb05f3
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3dfb05f3

Branch: refs/heads/master
Commit: 3dfb05f3ced89de75e9434c82d22d39a4df7d220
Parents: 1463487
Author: benwa 
Authored: Fri Mar 10 13:44:05 2017 +0700
Committer: benwa 
Committed: Wed Mar 15 09:02:31 2017 +0700

--
 server/protocols/webadmin/pom.xml   |  9 +
 .../apache/james/webadmin/WebAdminServer.java   | 23 +--
 .../james/webadmin/metric/MetricPostFilter.java | 37 ++
 .../james/webadmin/metric/MetricPreFilter.java  | 41 
 .../james/webadmin/routes/DomainRoutesTest.java |  5 ++-
 .../routes/UserMailboxesRoutesTest.java |  5 ++-
 .../james/webadmin/routes/UsersRoutesTest.java  |  5 ++-
 7 files changed, 119 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/3dfb05f3/server/protocols/webadmin/pom.xml
--
diff --git a/server/protocols/webadmin/pom.xml 
b/server/protocols/webadmin/pom.xml
index da9d076..3703c7a 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -178,6 +178,15 @@
 test
 
 
+org.apache.james
+metrics-api
+
+
+org.apache.james
+metrics-logger
+test
+
+
 com.fasterxml.jackson.core
 jackson-databind
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/3dfb05f3/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminServer.java
--
diff --git 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminServer.java
 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminServer.java
index 9c398b4..e3fb368 100644
--- 
a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminServer.java
+++ 
b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminServer.java
@@ -28,8 +28,12 @@ import javax.inject.Inject;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.webadmin.authentication.AuthenticationFilter;
 import org.apache.james.webadmin.authentication.NoAuthenticationFilter;
+import org.apache.james.webadmin.metric.MetricPostFilter;
+import org.apache.james.webadmin.metric.MetricPreFilter;
 import org.apache.james.webadmin.routes.CORSRoute;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,6 +41,9 @@ import org.slf4j.LoggerFactory;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableSet;
 
+import spark.Filter;
+import spark.Request;
+import spark.Response;
 import spark.Service;
 
 public class WebAdminServer implements Configurable {
@@ -49,24 +56,28 @@ public class WebAdminServer implements Configurable {
 private final Set routesList;
 private final Service service;
 private final AuthenticationFilter authenticationFilter;
+private final MetricFactory metricFactory;
 
 // Spark do not allow to retrieve allocated port when using a random port. 
Thus we generate the port.
 @Inject
-private WebAdminServer(WebAdminConfiguration configuration, Set 
routesList, AuthenticationFilter authenticationFilter) {
+private WebAdminServer(WebAdminConfiguration configuration, Set 
routesList, AuthenticationFilter authenticationFilter,
+   MetricFactory metricFactory) {
 this.configuration = configuration;
 this.routesList = routesList;
 this.authenticationFilter = authenticationFilter;
+this.metricFactory = metricFactory;
 this.service = Service.ignite();
 }
 
 @VisibleForTesting
-public WebAdminServer(Routes... routes) throws IOException {
+public WebAdminServer(MetricFactory metricFactory, Routes... routes) 
throws IOException {
 this(WebAdminConfiguration.builder()
 .enabled()
 .port(new RandomPort())
 .build(),
 ImmutableSet.copyOf(routes),
-new NoAuthenticationFilter());
+new NoAuth

[jira] [Resolved] (JAMES-1958) Allow optional http confirguration on webadmin

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit resolved JAMES-1958.
---
Resolution: Fixed

Merged with https://github.com/linagora/james-project/pull/688

> Allow optional http confirguration on webadmin
> --
>
> Key: JAMES-1958
> URL: https://issues.apache.org/jira/browse/JAMES-1958
> Project: James Server
>  Issue Type: Improvement
>Reporter: Tellier Benoit
>
> Spark-java supports https from JKS keystore.
> We can simply provide some configuration options for it : 
> ```
> # Defaults to false
> https.enabled=false
> # Compulsory when enabling HTTPS
> #https.keystore=/path/to/keystore
> #https.password=password
> # Optional when enabling HTTPS (self signed)
> #https.trust.keystore
> #https.trust.password
> ```
> Can be tested with a CURL request. For instance : 
> ```
> % curl -XGET -k https://127.0.0.1:34895/domains   
>  
> ["horizon","localhost.","127.0.0.1"]
> ```
> However, configuration is now very simple (isEnable + port) and we pass it 
> directly through constructor. We might need to rework configuration, and 
> extract it to an other object.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Closed] (JAMES-1958) Allow optional http confirguration on webadmin

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit closed JAMES-1958.
-

> Allow optional http confirguration on webadmin
> --
>
> Key: JAMES-1958
> URL: https://issues.apache.org/jira/browse/JAMES-1958
> Project: James Server
>  Issue Type: Improvement
>Reporter: Tellier Benoit
>
> Spark-java supports https from JKS keystore.
> We can simply provide some configuration options for it : 
> ```
> # Defaults to false
> https.enabled=false
> # Compulsory when enabling HTTPS
> #https.keystore=/path/to/keystore
> #https.password=password
> # Optional when enabling HTTPS (self signed)
> #https.trust.keystore
> #https.trust.password
> ```
> Can be tested with a CURL request. For instance : 
> ```
> % curl -XGET -k https://127.0.0.1:34895/domains   
>  
> ["horizon","localhost.","127.0.0.1"]
> ```
> However, configuration is now very simple (isEnable + port) and we pass it 
> directly through constructor. We might need to rework configuration, and 
> extract it to an other object.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Resolved] (JAMES-1959) Allow to configure JWT authentication from WebAdmin API

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit resolved JAMES-1959.
---
Resolution: Fixed

https://github.com/linagora/james-project/pull/688 solved  this

> Allow to configure JWT authentication from WebAdmin API
> ---
>
> Key: JAMES-1959
> URL: https://issues.apache.org/jira/browse/JAMES-1959
> Project: James Server
>  Issue Type: New Feature
>Reporter: Tellier Benoit
>
> We want the web application to be able to access James Admin API from the 
> internet.
> To do so, we need it to be secure.
> We will implement an optionnal mechanism for authentication based on JWT. We 
> will check the Bearer header, with configured public key, and ensure it 
> contains the claims admin=true.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Resolved] (JAMES-1960) CORS on WebAdmin API

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit resolved JAMES-1960.
---
Resolution: Fixed

https://github.com/linagora/james-project/pull/688 solved this

> CORS on WebAdmin API
> 
>
> Key: JAMES-1960
> URL: https://issues.apache.org/jira/browse/JAMES-1960
> Project: James Server
>  Issue Type: New Feature
>Reporter: Tellier Benoit
>
> Because we might want to access the WebAdmin API with JS from other 
> applications, we need to take care of CORS access.
> We want to :
>  - enable it from configuration
>  - specify the origin from configuration
> We followed this guide : https://sparktutorials.github.io/2016/05/01/cors.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Closed] (JAMES-1960) CORS on WebAdmin API

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit closed JAMES-1960.
-

> CORS on WebAdmin API
> 
>
> Key: JAMES-1960
> URL: https://issues.apache.org/jira/browse/JAMES-1960
> Project: James Server
>  Issue Type: New Feature
>Reporter: Tellier Benoit
>
> Because we might want to access the WebAdmin API with JS from other 
> applications, we need to take care of CORS access.
> We want to :
>  - enable it from configuration
>  - specify the origin from configuration
> We followed this guide : https://sparktutorials.github.io/2016/05/01/cors.html



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Closed] (JAMES-1959) Allow to configure JWT authentication from WebAdmin API

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit closed JAMES-1959.
-

> Allow to configure JWT authentication from WebAdmin API
> ---
>
> Key: JAMES-1959
> URL: https://issues.apache.org/jira/browse/JAMES-1959
> Project: James Server
>  Issue Type: New Feature
>Reporter: Tellier Benoit
>
> We want the web application to be able to access James Admin API from the 
> internet.
> To do so, we need it to be secure.
> We will implement an optionnal mechanism for authentication based on JWT. We 
> will check the Bearer header, with configured public key, and ensure it 
> contains the claims admin=true.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Closed] (JAMES-1962) WebAdmin should also rely on Metrics

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit closed JAMES-1962.
-

> WebAdmin should also rely on Metrics
> 
>
> Key: JAMES-1962
> URL: https://issues.apache.org/jira/browse/JAMES-1962
> Project: James Server
>  Issue Type: Improvement
>Reporter: Tellier Benoit
>
> This would allow to grap requests and response times from grafana.
> We will implement this with two filters :
>  - a first one that starts the metric Timer and attach it to the request
>  - a second one that read it from servlet request attributes, and publish the 
> result.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Resolved] (JAMES-1962) WebAdmin should also rely on Metrics

2017-03-15 Thread Tellier Benoit (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit resolved JAMES-1962.
---
Resolution: Fixed

https://github.com/linagora/james-project/pull/688 fixed this

> WebAdmin should also rely on Metrics
> 
>
> Key: JAMES-1962
> URL: https://issues.apache.org/jira/browse/JAMES-1962
> Project: James Server
>  Issue Type: Improvement
>Reporter: Tellier Benoit
>
> This would allow to grap requests and response times from grafana.
> We will implement this with two filters :
>  - a first one that starts the metric Timer and attach it to the request
>  - a second one that read it from servlet request attributes, and publish the 
> result.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1950) Statistics About perfs

2017-03-15 Thread Tellier Benoit (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15925898#comment-15925898
 ] 

Tellier Benoit commented on JAMES-1950:
---

https://github.com/linagora/james-project/pull/692 Added metrics on 
RemoteDelivery retries

> Statistics About perfs
> --
>
> Key: JAMES-1950
> URL: https://issues.apache.org/jira/browse/JAMES-1950
> Project: James Server
>  Issue Type: Improvement
>Reporter: Antoine Duprat
>
> Log duration of IMAP processors and JMAP methods.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1932) Mailet pipeline ui edition tool

2017-03-15 Thread SHRAVAN MURALI (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926356#comment-15926356
 ] 

SHRAVAN MURALI commented on JAMES-1932:
---

[~pramod94], are you sure that the outgoing email address is not from an 
external mail server ? 

If you've setup James in your local, then both the email addresses should 
belong to a mail server from the same network 

> Mailet pipeline ui edition tool
> ---
>
> Key: JAMES-1932
> URL: https://issues.apache.org/jira/browse/JAMES-1932
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James has to concept of mailet pipeline : for any incoming email, the email 
> is passing through the pipeline the is made of matchers and mailets. These 
> components allow to implement business rules based on some xml configuration 
> and some java component.
> That's a great strength of James and a lot of people use it for this 
> capability.
> Nevertheless, editing the pipeline and making tests is painful right now, you 
> are left finding solutions like "edit xml, launch server, send an email, read 
> logs".
> To ease adoption, we would like to make that process easy and fun by :
> * providing a web ui frontend to design the pipeline
> * given a set of emails, make it possible to visualise each email flow into 
> the mailet pipeline to test it
> * define a way to express the expected results to make sure people can save 
> their work into automated tests
> To implement that, the student must know enough about web frontend dev to 
> implement a pipeline designer and debugger.
> She or he will need to know some java to implement server side logic for :
> * make james accept to reconfigure its pipeline at runtime to take 
> modifications into account
> * design a protocol to stream debug data from a pipeline to the web ui and 
> implement it server-side in java
> * implement a junit runner to be able to run some special mailet tests based 
> on the work done in the web designer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1932) Mailet pipeline ui edition tool

2017-03-15 Thread SHRAVAN MURALI (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926384#comment-15926384
 ] 

SHRAVAN MURALI commented on JAMES-1932:
---

[~BTellier], my frontend code is supposed to go inside server/site right ? 

> Mailet pipeline ui edition tool
> ---
>
> Key: JAMES-1932
> URL: https://issues.apache.org/jira/browse/JAMES-1932
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James has to concept of mailet pipeline : for any incoming email, the email 
> is passing through the pipeline the is made of matchers and mailets. These 
> components allow to implement business rules based on some xml configuration 
> and some java component.
> That's a great strength of James and a lot of people use it for this 
> capability.
> Nevertheless, editing the pipeline and making tests is painful right now, you 
> are left finding solutions like "edit xml, launch server, send an email, read 
> logs".
> To ease adoption, we would like to make that process easy and fun by :
> * providing a web ui frontend to design the pipeline
> * given a set of emails, make it possible to visualise each email flow into 
> the mailet pipeline to test it
> * define a way to express the expected results to make sure people can save 
> their work into automated tests
> To implement that, the student must know enough about web frontend dev to 
> implement a pipeline designer and debugger.
> She or he will need to know some java to implement server side logic for :
> * make james accept to reconfigure its pipeline at runtime to take 
> modifications into account
> * design a protocol to stream debug data from a pipeline to the web ui and 
> implement it server-side in java
> * implement a junit runner to be able to run some special mailet tests based 
> on the work done in the web designer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1931) Implement a web ui for James administration

2017-03-15 Thread Pramod Dilshan (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926885#comment-15926885
 ] 

Pramod Dilshan commented on JAMES-1931:
---

Hi [~BTellier],

Thank you very much for your advice. 
I faced a problem that is when I run 'mvn install' command in the James Project 
I get the following error. Do you have an idea to overcome this?

Thanks,
Pramod Dilshan.

810c23f-3eac-4407-b8e8-fd971a258cae/dfscluster_36f639b4-2977-4cca-9279-6065331bb9a4/dfs/data/data2
[main] WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl - NameNode 
metrics system already initialized!
[main] WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl - Source name ugi 
already exists!
Running org.apache.james.mailbox.hbase.HBaseMailboxManagerTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 sec <<< 
FAILURE! - in org.apache.james.mailbox.hbase.HBaseMailboxManagerTest
initializationError(org.apache.james.mailbox.hbase.HBaseMailboxManagerTest)  
Time elapsed: 0.007 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class 
org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactoryTest


Results :

Tests in error: 
  HBaseMailboxManagerTest.initializationError » NoClassDefFound Could not 
initia...
  HBaseMailboxSessionMapperFactoryTest.testCreateMailboxMapper » NoClassDefFound
  HBaseMailboxSessionMapperFactoryTest.testCreateMessageMapper » NoClassDefFound
  HBaseMailboxSessionMapperFactoryTest.testCreateSubscriptionMapper » 
NoClassDefFound
  HBaseMailboxSessionMapperFactoryTest.testGetModSeqProvider » NoClassDefFound 
C...
  HBaseMailboxSessionMapperFactoryTest.testGetUidProvider » 
ExceptionInInitializer
  HBaseMailboxMapperTest.testMailboxMapperScenario » ExceptionInInitializer
  HBaseMailboxMessageMapperTest.testMessageMapperScenario » 
ExceptionInInitializer
  HBaseUidAndModSeqProviderTest.testHighestModSeq » NoClassDefFound Could not 
in...
  HBaseUidAndModSeqProviderTest.testLastUid » ExceptionInInitializer
  HBaseUidAndModSeqProviderTest.testNextModSeq » NoClassDefFound Could not 
initi...
  HBaseUidAndModSeqProviderTest.testNextUid » NoClassDefFound Could not 
initiali...
  HBaseSubscriptionMapperTest.testDelete » NoClassDefFound Could not initialize 
...
  HBaseSubscriptionMapperTest.testFindMailboxSubscriptionForUser » 
NoClassDefFound
  HBaseSubscriptionMapperTest.testFindSubscriptionsForUser » NoClassDefFound 
Cou...
  HBaseSubscriptionMapperTest.testSave » ExceptionInInitializer

Tests run: 32, Failures: 0, Errors: 16, Skipped: 0



> Implement a web ui for James administration
> ---
>
> Key: JAMES-1931
> URL: https://issues.apache.org/jira/browse/JAMES-1931
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James today provides a command line tool to do administration tasks like 
> creating a domain, listing users, setting quota, etc.
> It requires access to JMX port and even if lot of admins are confortable with 
> such tools, to make our user base broader, we probably should expose the same 
> commands in Rest and provide a fancy default web ui.
> The task would need some basic skills on frontend tools to design an 
> administration board, knowledge on what REST mean and enough Java 
> understanding to add commands to existing Rest backend.
> In the team, we have a strong focus on test (who want a mail server that is 
> not tested enough ?) so we will explain and/or teach the student how to have 
> the right test coverage of the features using modern tools like Cucumber, 
> Selenium, rest-assured, etc.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1932) Mailet pipeline ui edition tool

2017-03-15 Thread Pramod Dilshan (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15926893#comment-15926893
 ] 

Pramod Dilshan commented on JAMES-1932:
---

[~shravan97],

I sent mail from dils...@dilsoft.net to dils...@dilsoft.net. both user 
'dilshan' and domain 'dilsoft.net' is in the James server.
please see this link.
http://stackoverflow.com/questions/42769810/how-to-configure-thunderbird-for-james-mail-server-in-ubuntu
Thanks

> Mailet pipeline ui edition tool
> ---
>
> Key: JAMES-1932
> URL: https://issues.apache.org/jira/browse/JAMES-1932
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James has to concept of mailet pipeline : for any incoming email, the email 
> is passing through the pipeline the is made of matchers and mailets. These 
> components allow to implement business rules based on some xml configuration 
> and some java component.
> That's a great strength of James and a lot of people use it for this 
> capability.
> Nevertheless, editing the pipeline and making tests is painful right now, you 
> are left finding solutions like "edit xml, launch server, send an email, read 
> logs".
> To ease adoption, we would like to make that process easy and fun by :
> * providing a web ui frontend to design the pipeline
> * given a set of emails, make it possible to visualise each email flow into 
> the mailet pipeline to test it
> * define a way to express the expected results to make sure people can save 
> their work into automated tests
> To implement that, the student must know enough about web frontend dev to 
> implement a pipeline designer and debugger.
> She or he will need to know some java to implement server side logic for :
> * make james accept to reconfigure its pipeline at runtime to take 
> modifications into account
> * design a protocol to stream debug data from a pipeline to the web ui and 
> implement it server-side in java
> * implement a junit runner to be able to run some special mailet tests based 
> on the work done in the web designer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1931) Implement a web ui for James administration

2017-03-15 Thread Tellier Benoit (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15927289#comment-15927289
 ] 

Tellier Benoit commented on JAMES-1931:
---

run mvn clean install instead, please. I will try to reproduce.

> Implement a web ui for James administration
> ---
>
> Key: JAMES-1931
> URL: https://issues.apache.org/jira/browse/JAMES-1931
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James today provides a command line tool to do administration tasks like 
> creating a domain, listing users, setting quota, etc.
> It requires access to JMX port and even if lot of admins are confortable with 
> such tools, to make our user base broader, we probably should expose the same 
> commands in Rest and provide a fancy default web ui.
> The task would need some basic skills on frontend tools to design an 
> administration board, knowledge on what REST mean and enough Java 
> understanding to add commands to existing Rest backend.
> In the team, we have a strong focus on test (who want a mail server that is 
> not tested enough ?) so we will explain and/or teach the student how to have 
> the right test coverage of the features using modern tools like Cucumber, 
> Selenium, rest-assured, etc.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1931) Implement a web ui for James administration

2017-03-15 Thread Tellier Benoit (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15927321#comment-15927321
 ] 

Tellier Benoit commented on JAMES-1931:
---

Can not reproduce on my laptop. I guess my previous answer solves your problem. 

Cheers,

Benoit

> Implement a web ui for James administration
> ---
>
> Key: JAMES-1931
> URL: https://issues.apache.org/jira/browse/JAMES-1931
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James today provides a command line tool to do administration tasks like 
> creating a domain, listing users, setting quota, etc.
> It requires access to JMX port and even if lot of admins are confortable with 
> such tools, to make our user base broader, we probably should expose the same 
> commands in Rest and provide a fancy default web ui.
> The task would need some basic skills on frontend tools to design an 
> administration board, knowledge on what REST mean and enough Java 
> understanding to add commands to existing Rest backend.
> In the team, we have a strong focus on test (who want a mail server that is 
> not tested enough ?) so we will explain and/or teach the student how to have 
> the right test coverage of the features using modern tools like Cucumber, 
> Selenium, rest-assured, etc.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (JAMES-1932) Mailet pipeline ui edition tool

2017-03-15 Thread Tellier Benoit (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15927327#comment-15927327
 ] 

Tellier Benoit commented on JAMES-1932:
---

Hi Shravan,

site/* folders are for the Apache website code.

Let's not mix that... Please introduce a new mvn project in 
server/protocols/mailet-edition . Serve your code with an embedded server. 
Jetty (like JMAP) or Spark-java (like WebAdmin). Then you will need to wire it 
in the server/guice/protocols project in order to start it and start playing.

Let's wait other people answer about this. I believe that this pannel can also 
belong in WebAdmin... (Maybe on an other path than the Shravan code, to avoid 
much conflict).

> Mailet pipeline ui edition tool
> ---
>
> Key: JAMES-1932
> URL: https://issues.apache.org/jira/browse/JAMES-1932
> Project: James Server
>  Issue Type: Task
>Reporter: Matthieu Baechler
>  Labels: backend, frontend, gsoc2017, java, js, json, rest, sse
>
> James has to concept of mailet pipeline : for any incoming email, the email 
> is passing through the pipeline the is made of matchers and mailets. These 
> components allow to implement business rules based on some xml configuration 
> and some java component.
> That's a great strength of James and a lot of people use it for this 
> capability.
> Nevertheless, editing the pipeline and making tests is painful right now, you 
> are left finding solutions like "edit xml, launch server, send an email, read 
> logs".
> To ease adoption, we would like to make that process easy and fun by :
> * providing a web ui frontend to design the pipeline
> * given a set of emails, make it possible to visualise each email flow into 
> the mailet pipeline to test it
> * define a way to express the expected results to make sure people can save 
> their work into automated tests
> To implement that, the student must know enough about web frontend dev to 
> implement a pipeline designer and debugger.
> She or he will need to know some java to implement server side logic for :
> * make james accept to reconfigure its pipeline at runtime to take 
> modifications into account
> * design a protocol to stream debug data from a pipeline to the web ui and 
> implement it server-side in java
> * implement a junit runner to be able to run some special mailet tests based 
> on the work done in the web designer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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