You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/12/03 04:13:19 UTC

[GitHub] [james-project] Arsnael commented on a change in pull request #770: JAMES-3636 Unit tests for plainAuthDisallowed

Arsnael commented on a change in pull request #770:
URL: https://github.com/apache/james-project/pull/770#discussion_r761634686



##########
File path: server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -397,6 +397,76 @@ void largeAppendsShouldBeRejected() {
         }
     }
 
+    @Nested
+    class PlainAuthDisallowed {
+        IMAPServer imapServer;
+        private int port;
+
+        @BeforeEach
+        void beforeEach() throws Exception {
+            imapServer = createImapServer("imapServerPlainAuthDisallowed.xml");
+            port = imapServer.getListenAddresses().get(0).getPort();
+        }
+
+        @AfterEach
+        void tearDown() {
+            imapServer.destroy();
+        }
+
+        @Test
+        void loginShouldFailOnUnEncryptedChannel() {
+            assertThatThrownBy(() ->
+                testIMAPClient.connect("127.0.0.1", port)
+                    .login(USER.asString(), USER_PASS))
+                .hasMessage("Login failed");
+        }
+
+        @Test
+        void capabilityShouldNotAdvertiseLoginOnUnEncryptedChannel() throws Exception {
+            testIMAPClient.connect("127.0.0.1", port);
+
+
+            assertThat(testIMAPClient.capability())
+                .contains("LOGINDISABLED")
+                .doesNotContain("AUTH=PLAIN");
+        }
+    }
+
+    @Nested
+    class PlainAuthDisallowedSSL {

Review comment:
       Isn't that nested class the exact same as the one above? I don't see the SSL difference here... Shouldn't you test the PlainAuthAllowed isntead?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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