You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/02/14 12:05:51 UTC

[06/12] james-project git commit: JAMES-1930 Introduce MTP AUTHENTICATE PLAIN tests

JAMES-1930 Introduce MTP AUTHENTICATE PLAIN tests


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

Branch: refs/heads/master
Commit: 200460cf3cefb401991cc401b07793b8119e26b9
Parents: bdf8932
Author: Raphael Ouazana <ra...@linagora.com>
Authored: Thu Feb 9 17:46:48 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Feb 14 11:29:30 2017 +0100

----------------------------------------------------------------------
 .../cassandra/CassandraMailboxTest.java         |  2 +
 .../imapmailbox/suite/AuthenticatePlain.java    | 54 +++++++++++++++++++
 .../james/imap/scripts/AuthenticatePlain.test   | 56 ++++++++++++++++++++
 3 files changed, 112 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/200460cf/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/CassandraMailboxTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/CassandraMailboxTest.java b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/CassandraMailboxTest.java
index 2c43665..cc4d60d 100644
--- a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/CassandraMailboxTest.java
+++ b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/CassandraMailboxTest.java
@@ -21,6 +21,7 @@ package org.apache.james.mpt.imapmailbox.cassandra;
 
 import org.apache.james.mpt.imapmailbox.AbstractMailboxTest;
 import org.apache.james.mpt.imapmailbox.suite.MailboxWithLongNameError;
+import org.apache.james.mpt.imapmailbox.suite.AuthenticatePlain;
 import org.apache.james.mpt.imapmailbox.suite.AuthenticatedState;
 import org.apache.james.mpt.imapmailbox.suite.ConcurrentSessions;
 import org.apache.james.mpt.imapmailbox.suite.Events;
@@ -49,6 +50,7 @@ import org.junit.runners.Suite.SuiteClasses;
 @GuiceModules({ CassandraMailboxTestModule.class })
 @SuiteClasses({
     AuthenticatedState.class,
+    AuthenticatePlain.class,
     ConcurrentSessions.class,
     Events.class,
     Expunge.class,

http://git-wip-us.apache.org/repos/asf/james-project/blob/200460cf/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
new file mode 100644
index 0000000..58a9892
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.suite;
+
+import java.util.Locale;
+
+import javax.inject.Inject;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.base.BaseNonAuthenticatedState;
+import org.junit.Test;
+
+public class AuthenticatePlain extends BaseNonAuthenticatedState {
+    
+    @Inject
+    private static ImapHostSystem system;
+
+    
+    public AuthenticatePlain() throws Exception {
+        super(system);
+    }
+
+    @Test
+    public void testAuthenticatePlainUS() throws Exception {
+        scriptTest("AuthenticatePlain", Locale.US);
+    }
+
+    @Test
+    public void testAuthenticatePlainITALY() throws Exception {
+        scriptTest("AuthenticatePlain", Locale.ITALY);
+    }
+
+    @Test
+    public void testAuthenticatePlainKOREA() throws Exception {
+        scriptTest("AuthenticatePlain", Locale.KOREA);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/200460cf/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/AuthenticatePlain.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/AuthenticatePlain.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/AuthenticatePlain.test
new file mode 100644
index 0000000..8408748
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/AuthenticatePlain.test
@@ -0,0 +1,56 @@
+################################################################
+# 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.                                           #
+################################################################
+
+# Correct user with correct password can authenticate with delegation part missing
+C: abcd AUTHENTICATE "PLAIN" {24+}
+# imapuser\0password
+C: aW1hcHVzZXIAcGFzc3dvcmQ=
+S: abcd OK AUTHENTICATE completed.
+
+REINIT
+
+# Correct user with correct password can authenticate with empty delegation part
+C: abcd AUTHENTICATE "PLAIN" {24+}
+# \0imapuser\0password
+C: AGltYXB1c2VyAHBhc3N3b3Jk
+S: abcd OK AUTHENTICATE completed.
+
+REINIT
+
+# Correct user with bad password cannot authenticate
+C: abcd AUTHENTICATE "PLAIN" {28+}
+# \0imapuser\0badpassword
+C: AGltYXB1c2VyAGJhZHBhc3N3b3Jk
+S: abcd NO AUTHENTICATE failed. Authentication failed.
+
+REINIT
+
+# Bad user cannot authenticate
+C: abcd AUTHENTICATE "PLAIN" {24+}
+# \0baduser\0password
+C: AGJhZHVzZXIAcGFzc3dvcmQ=
+S: abcd NO AUTHENTICATE failed. Authentication failed.
+
+REINIT
+
+# Correct user with correct password can authenticate with any delegation part
+C: abcd AUTHENTICATE "PLAIN" {36+}
+# delegate\0imapuser\0password
+C: ZGVsZWdhdGUAaW1hcHVzZXIAcGFzc3dvcmQ=
+S: abcd OK AUTHENTICATE completed.


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