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

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

commit bb1fd290fa100bf733539effdca051057a10305f
Author: Gautier DI FOLCO <[email protected]>
AuthorDate: Fri May 17 08:21:09 2019 +0200

    JAMES-1975 Add DKIM integration test
---
 pom.xml                                            |   5 +
 server/container/guice/cassandra-guice/pom.xml     |   4 +
 .../org/apache/james/CassandraJamesServerMain.java |   4 +-
 server/container/guice/jpa-guice/pom.xml           |   4 +
 .../java/org/apache/james/JPAJamesServerMain.java  |   4 +-
 server/container/guice/jpa-smtp-common/pom.xml     |   4 +
 .../java/org/apache/james/JPAJamesServerMain.java  |   3 +-
 server/container/guice/memory-guice/pom.xml        |  12 +-
 .../org/apache/james/MemoryJamesServerMain.java    |   4 +-
 .../apache/james/mailets/DKIMIntegrationTest.java  | 159 +++++++++++++++++++++
 .../transport/mailets/ExtractAttributeStub.java    |  50 +++++++
 server/mailet/mailets-guice/pom.xml                |  47 ++++++
 .../configuration/MailetsConfigurationModule.java  |  33 +++++
 server/pom.xml                                     |   1 +
 14 files changed, 326 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 670f5c2..eda4654 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1560,6 +1560,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-mailets-guice</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-memory-guice</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/container/guice/cassandra-guice/pom.xml 
b/server/container/guice/cassandra-guice/pom.xml
index 206e9bd..cbbddc0 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -83,6 +83,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-mailets-guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             
<artifactId>apache-james-mailbox-quota-search-elasticsearch</artifactId>
         </dependency>
         <dependency>
diff --git 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index d7f5ddd..ddab14f 100644
--- 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -19,6 +19,7 @@
 
 package org.apache.james;
 
+import org.apache.james.mailets.configuration.MailetsConfigurationModule;
 import org.apache.james.modules.BlobExportMechanismModule;
 import org.apache.james.modules.MailboxModule;
 import org.apache.james.modules.activemq.ActiveMQQueueModule;
@@ -131,7 +132,8 @@ public class CassandraJamesServerMain {
         CASSANDRA_SERVER_CORE_MODULE,
         CASSANDRA_MAILBOX_MODULE,
         PROTOCOLS,
-        PLUGINS);
+        PLUGINS,
+        new MailetsConfigurationModule());
 
     public static void main(String[] args) throws Exception {
         Configuration configuration = Configuration.builder()
diff --git a/server/container/guice/jpa-guice/pom.xml 
b/server/container/guice/jpa-guice/pom.xml
index 0340513..d10f37a 100644
--- a/server/container/guice/jpa-guice/pom.xml
+++ b/server/container/guice/jpa-guice/pom.xml
@@ -147,6 +147,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-mailets-guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-testing</artifactId>
             <scope>test</scope>
         </dependency>
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 30a6322..b036a22 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
@@ -19,6 +19,7 @@
 
 package org.apache.james;
 
+import org.apache.james.mailets.configuration.MailetsConfigurationModule;
 import org.apache.james.modules.MailboxModule;
 import org.apache.james.modules.activemq.ActiveMQQueueModule;
 import org.apache.james.modules.data.JPADataModule;
@@ -95,7 +96,8 @@ public class JPAJamesServerMain {
 
         GuiceJamesServer server = 
GuiceJamesServer.forConfiguration(configuration)
                     .combineWith(JPA_MODULE_AGGREGATE,
-                            new JMXServerModule());
+                            new JMXServerModule(),
+                            new MailetsConfigurationModule());
         server.start();
     }
 
diff --git a/server/container/guice/jpa-smtp-common/pom.xml 
b/server/container/guice/jpa-smtp-common/pom.xml
index 522f208..a4e6dc0 100644
--- a/server/container/guice/jpa-smtp-common/pom.xml
+++ b/server/container/guice/jpa-smtp-common/pom.xml
@@ -74,6 +74,10 @@
             <artifactId>james-server-jpa-common-guice</artifactId>
         </dependency>
         <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-mailets-guice</artifactId>
+        </dependency>
+        <dependency>
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>
         </dependency>
diff --git 
a/server/container/guice/jpa-smtp-common/src/main/java/org/apache/james/JPAJamesServerMain.java
 
b/server/container/guice/jpa-smtp-common/src/main/java/org/apache/james/JPAJamesServerMain.java
index 3fd88a9..d2238d1 100644
--- 
a/server/container/guice/jpa-smtp-common/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ 
b/server/container/guice/jpa-smtp-common/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -19,6 +19,7 @@
 
 package org.apache.james;
 
+import org.apache.james.mailets.configuration.MailetsConfigurationModule;
 import org.apache.james.modules.activemq.ActiveMQQueueModule;
 import org.apache.james.modules.data.JPADataModule;
 import org.apache.james.modules.data.JPAEntityManagerModule;
@@ -62,7 +63,7 @@ public class JPAJamesServerMain {
             .build();
 
         GuiceJamesServer server = 
GuiceJamesServer.forConfiguration(configuration)
-                    .combineWith(JPA_SERVER_MODULE, PROTOCOLS);
+                    .combineWith(JPA_SERVER_MODULE, PROTOCOLS, new 
MailetsConfigurationModule());
         server.start();
     }
 
diff --git a/server/container/guice/memory-guice/pom.xml 
b/server/container/guice/memory-guice/pom.xml
index c69c31f..a3a9fb8 100644
--- a/server/container/guice/memory-guice/pom.xml
+++ b/server/container/guice/memory-guice/pom.xml
@@ -98,10 +98,6 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            
<artifactId>james-server-mailbox-plugin-deleted-messages-vault-guice</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-guice-common</artifactId>
         </dependency>
         <dependency>
@@ -174,6 +170,14 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            
<artifactId>james-server-mailbox-plugin-deleted-messages-vault-guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-mailets-guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-mailrepository-memory</artifactId>
         </dependency>
         <dependency>
diff --git 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
index 18f4394..73d33d2 100644
--- 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
+++ 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
@@ -23,6 +23,7 @@ import java.util.Optional;
 
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.james.jwt.JwtConfiguration;
+import org.apache.james.mailets.configuration.MailetsConfigurationModule;
 import org.apache.james.modules.BlobExportMechanismModule;
 import org.apache.james.modules.BlobMemoryModule;
 import org.apache.james.modules.MailboxModule;
@@ -123,7 +124,8 @@ public class MemoryJamesServerMain {
         IN_MEMORY_SERVER_MODULE,
         PROTOCOLS,
         JMAP,
-        WEBADMIN);
+        WEBADMIN,
+        new MailetsConfigurationModule());
 
     public static void main(String[] args) throws Exception {
         Configuration configuration = Configuration.builder()
diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
new file mode 100644
index 0000000..79bb150
--- /dev/null
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
@@ -0,0 +1,159 @@
+/****************************************************************
+ * 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.mailets;
+
+import static org.apache.james.mailets.configuration.Constants.DEFAULT_DOMAIN;
+import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
+import static org.apache.james.mailets.configuration.Constants.PASSWORD;
+import static 
org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.jdkim.MockPublicKeyRecordRetriever;
+import org.apache.james.jdkim.api.PublicKeyRecordRetriever;
+import org.apache.james.jdkim.mailets.DKIMSign;
+import org.apache.james.jdkim.mailets.DKIMVerify;
+import org.apache.james.mailets.configuration.CommonProcessors;
+import org.apache.james.mailets.configuration.MailetConfiguration;
+import org.apache.james.mailets.configuration.MailetContainer;
+import org.apache.james.mailets.configuration.ProcessorConfiguration;
+import org.apache.james.modules.protocols.ImapGuiceProbe;
+import org.apache.james.modules.protocols.SmtpGuiceProbe;
+import org.apache.james.probe.DataProbe;
+import org.apache.james.transport.mailets.ExtractAttributeStub;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.utils.DataProbeImpl;
+import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.SMTPMessageSender;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+
+public class DKIMIntegrationTest {
+
+    private static final String FROM_LOCAL_PART = "fromUser";
+    private static final String FROM = FROM_LOCAL_PART + "@" + DEFAULT_DOMAIN;
+    private static final String RECIPIENT_LOCAL_PART = "touser";
+    private static final String RECIPIENT = RECIPIENT_LOCAL_PART + "@" + 
DEFAULT_DOMAIN;
+
+    private static final String TESTING_PEM = "-----BEGIN RSA PRIVATE 
KEY-----\r\n" +
+            
"MIICXAIBAAKBgQDYDaYKXzwVYwqWbLhmuJ66aTAN8wmDR+rfHE8HfnkSOax0oIoT\r\n" +
+            
"M5zquZrTLo30870YMfYzxwfB6j/Nz3QdwrUD/t0YMYJiUKyWJnCKfZXHJBJ+yfRH\r\n" +
+            
"r7oW+UW3cVo9CG2bBfIxsInwYe175g9UjyntJpWueqdEIo1c2bhv9Mp66QIDAQAB\r\n" +
+            
"AoGBAI8XcwnZi0Sq5N89wF+gFNhnREFo3rsJDaCY8iqHdA5DDlnr3abb/yhipw0I\r\n" +
+            
"/1HlgC6fIG2oexXOXFWl+USgqRt1kTt9jXhVFExg8mNko2UelAwFtsl8CRjVcYQO\r\n" +
+            
"cedeH/WM/mXjg2wUqqZenBmlKlD6vNb70jFJeVaDJ/7n7j8BAkEA9NkH2D4Zgj/I\r\n" +
+            
"OAVYccZYH74+VgO0e7VkUjQk9wtJ2j6cGqJ6Pfj0roVIMUWzoBb8YfErR8l6JnVQ\r\n" +
+            
"bfy83gJeiQJBAOHk3ow7JjAn8XuOyZx24KcTaYWKUkAQfRWYDFFOYQF4KV9xLSEt\r\n" +
+            
"ycY0kjsdxGKDudWcsATllFzXDCQF6DTNIWECQEA52ePwTjKrVnLTfCLEG4OgHKvl\r\n" +
+            
"Zud4amthwDyJWoMEH2ChNB2je1N4JLrABOE+hk+OuoKnKAKEjWd8f3Jg/rkCQHj8\r\n" +
+            
"mQmogHqYWikgP/FSZl518jV48Tao3iXbqvU9Mo2T6yzYNCCqIoDLFWseNVnCTZ0Q\r\n" +
+            
"b+IfiEf1UeZVV5o4J+ECQDatNnS3V9qYUKjj/krNRD/U0+7eh8S2ylLqD3RlSn9K\r\n" +
+            "tYGRMgAtUXtiOEizBH6bd/orzI9V9sw8yBz+ZqIH25Q=\r\n" +
+            "-----END RSA PRIVATE KEY-----\r\n";
+    private static final MailetConfiguration DKIMSIGN_MAILET = 
MailetConfiguration.builder()
+            .matcher(All.class)
+            .mailet(DKIMSign.class)
+            .addProperty(
+                    "signatureTemplate",
+                    "v=1; s=selector; d=example.com; 
h=from:to:received:received; a=rsa-sha256; bh=; b=;")
+            .addProperty("privateKey", TESTING_PEM)
+            .build();
+    private static final MailetConfiguration DKIMVERIFY_MAILET = 
MailetConfiguration.builder()
+            .matcher(All.class)
+            .mailet(DKIMVerify.class)
+            .build();
+    private static final MailetConfiguration STUB_MAILET = 
MailetConfiguration.builder()
+        .matcher(All.class)
+        .mailet(ExtractAttributeStub.class)
+        .addProperty("attributeName", DKIMVerify.DKIM_AUTH_RESULT.asString())
+        .build();
+
+    private static final PublicKeyRecordRetriever 
MOCK_PUBLIC_KEY_RECORD_RETRIEVER = new MockPublicKeyRecordRetriever(
+            "v=DKIM1; k=rsa; 
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYDaYKXzwVYwqWbLhmuJ66aTAN8wmDR+rfHE8HfnkSOax0oIoTM5zquZrTLo30870YMfYzxwfB6j/Nz3QdwrUD/t0YMYJiUKyWJnCKfZXHJBJ+yfRHr7oW+UW3cVo9CG2bBfIxsInwYe175g9UjyntJpWueqdEIo1c2bhv9Mp66QIDAQAB;",
+            "selector", "example.com");
+
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    @Rule
+    public IMAPMessageReader imapMessageReader = new IMAPMessageReader();
+    @Rule
+    public SMTPMessageSender messageSender = new 
SMTPMessageSender(DEFAULT_DOMAIN);
+
+    private TemporaryJamesServer jamesServer;
+    private DataProbe dataProbe;
+    private List<Optional<String>> dkimAuthResults;
+
+    @Before
+    public void setup() throws Exception {
+        dkimAuthResults = new ArrayList<>();
+        ExtractAttributeStub.setDkimAuthResultInspector(value -> 
dkimAuthResults.add(value.map(result -> (String) result)));
+        MailetContainer.Builder mailetContainer = 
TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
+                .putProcessor(ProcessorConfiguration.transport()
+                        .addMailet(DKIMSIGN_MAILET)
+                        .addMailet(DKIMVERIFY_MAILET)
+                        .addMailet(STUB_MAILET)
+                        .addMailetsFrom(CommonProcessors.transport()));
+
+        jamesServer = TemporaryJamesServer
+            .builder()
+            .withBase(Modules.combine(
+                MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE,
+                binder -> 
binder.bind(PublicKeyRecordRetriever.class).toInstance(MOCK_PUBLIC_KEY_RECORD_RETRIEVER)))
+            .withMailetContainer(mailetContainer)
+            .build(temporaryFolder);
+
+        dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+        dataProbe.addDomain(DEFAULT_DOMAIN);
+
+        dataProbe.addUser(RECIPIENT, PASSWORD);
+    }
+
+    @After
+    public void tearDown() {
+        jamesServer.shutdown();
+    }
+
+    @Test
+    public void incomingMessageShouldBeReceivedSignedAndChecked() throws 
Exception {
+        messageSender.connect(LOCALHOST_IP, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+            .sendMessage(FROM, RECIPIENT);
+
+        imapMessageReader.connect(LOCALHOST_IP, 
jamesServer.getProbe(ImapGuiceProbe.class).getImapPort())
+            .login(RECIPIENT, PASSWORD)
+            .select(IMAPMessageReader.INBOX)
+            .awaitMessage(awaitAtMostOneMinute);
+
+        assertThat(dkimAuthResults)
+                .hasSize(1);
+        assertThat(dkimAuthResults.get(0))
+                .hasValueSatisfying(result -> 
assertThat(result).startsWith("pass"));
+
+        assertThat(imapMessageReader.readFirstMessageHeaders())
+                .contains("DKIM-Signature");
+    }
+}
diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ExtractAttributeStub.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ExtractAttributeStub.java
new file mode 100644
index 0000000..b5aecc0
--- /dev/null
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ExtractAttributeStub.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.transport.mailets;
+
+import org.apache.mailet.AttributeName;
+import org.apache.mailet.AttributeUtils;
+import org.apache.mailet.Mail;
+import org.apache.mailet.base.GenericMailet;
+
+import javax.mail.MessagingException;
+
+import java.util.Optional;
+import java.util.function.Consumer;
+
+public class ExtractAttributeStub extends GenericMailet {
+
+    private static Consumer<Optional<?>> dkimAuthResultInspector;
+    private AttributeName name;
+
+    @Override
+    public void init() {
+        name = AttributeName.of(getInitParameter("attributeName"));
+    }
+
+    @Override
+    public void service(Mail mail) throws MessagingException {
+        
dkimAuthResultInspector.accept(AttributeUtils.getAttributeValueFromMail(mail, 
name));
+    }
+
+    public static void setDkimAuthResultInspector(Consumer<Optional<?>> 
inspector) {
+        dkimAuthResultInspector = inspector;
+    }
+}
diff --git a/server/mailet/mailets-guice/pom.xml 
b/server/mailet/mailets-guice/pom.xml
new file mode 100644
index 0000000..f91b437
--- /dev/null
+++ b/server/mailet/mailets-guice/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.james</groupId>
+        <artifactId>james-server</artifactId>
+        <version>3.4.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>james-server-mailets-guice</artifactId>
+    <packaging>bundle</packaging>
+
+    <name>Apache James :: Server :: Mailets Guice</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.james.jdkim</groupId>
+            <artifactId>apache-jdkim-library</artifactId>
+            <version>0.2</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git 
a/server/mailet/mailets-guice/src/main/java/org/apache/james/mailets/configuration/MailetsConfigurationModule.java
 
b/server/mailet/mailets-guice/src/main/java/org/apache/james/mailets/configuration/MailetsConfigurationModule.java
new file mode 100644
index 0000000..8c54221
--- /dev/null
+++ 
b/server/mailet/mailets-guice/src/main/java/org/apache/james/mailets/configuration/MailetsConfigurationModule.java
@@ -0,0 +1,33 @@
+/****************************************************************
+ * 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.mailets.configuration;
+
+import org.apache.james.jdkim.api.PublicKeyRecordRetriever;
+import org.apache.james.jdkim.impl.DNSPublicKeyRecordRetriever;
+import org.apache.james.jdkim.impl.MultiplexingPublicKeyRecordRetriever;
+
+import com.google.inject.AbstractModule;
+
+public class MailetsConfigurationModule extends AbstractModule {
+    @Override
+    public void configure() {
+        bind(PublicKeyRecordRetriever.class).toInstance(new 
MultiplexingPublicKeyRecordRetriever("dns", new DNSPublicKeyRecordRetriever()));
+    }
+}
diff --git a/server/pom.xml b/server/pom.xml
index 0d82ea6..025a57e 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -77,6 +77,7 @@
         <module>mailet/mailetcontainer-api</module>
         <module>mailet/mailetcontainer-camel</module>
         <module>mailet/mailets</module>
+        <module>mailet/mailets-guice</module>
 
         <module>mailrepository/deleted-messages-vault-repository</module>
         <module>mailrepository/mailrepository-api</module>


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

Reply via email to