vttranlina commented on a change in pull request #788:
URL: https://github.com/apache/james-project/pull/788#discussion_r769362494
##########
File path:
server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -549,6 +549,65 @@ void capabilityShouldAdvertiseLoginOnUnEncryptedChannel()
throws Exception {
}
}
+ @Nested
+ class AuthenticationRequireSSL {
+ IMAPServer imapServer;
+
+ @AfterEach
+ void tearDown() {
+ if (imapServer!=null){
+ imapServer.destroy();
+ }
+ }
+ @Test
+ void loginShouldFailWhenRequireSSLAndPlainAuthNotEnabled() throws
Exception {
+ imapServer =
createImapServer("imapServerPlainAuthDisabledAndRequireSSL.xml");
+ int port = imapServer.getListenAddresses().get(0).getPort();
+
+ assertThatThrownBy(() ->
+ testIMAPClient.connect("127.0.0.1", port)
+ .login(USER.asString(), USER_PASS))
+ .hasMessage("Login failed");
+
+ }
+
+ @Test
+ void loginShouldSuccessWhenRequireSSLAndPlainAuthEnabled() throws
Exception {
+ imapServer =
createImapServer("imapServerPlainAuthEnabledAndRequireSSL.xml");
Review comment:
it not pass
##########
File path:
server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -549,6 +549,65 @@ void capabilityShouldAdvertiseLoginOnUnEncryptedChannel()
throws Exception {
}
}
+ @Nested
+ class AuthenticationRequireSSL {
+ IMAPServer imapServer;
+
+ @AfterEach
+ void tearDown() {
+ if (imapServer!=null){
+ imapServer.destroy();
+ }
+ }
+ @Test
+ void loginShouldFailWhenRequireSSLAndPlainAuthNotEnabled() throws
Exception {
+ imapServer =
createImapServer("imapServerPlainAuthDisabledAndRequireSSL.xml");
+ int port = imapServer.getListenAddresses().get(0).getPort();
+
+ assertThatThrownBy(() ->
+ testIMAPClient.connect("127.0.0.1", port)
+ .login(USER.asString(), USER_PASS))
+ .hasMessage("Login failed");
+
+ }
+
+ @Test
+ void loginShouldSuccessWhenRequireSSLAndPlainAuthEnabled() throws
Exception {
+ imapServer =
createImapServer("imapServerPlainAuthEnabledAndRequireSSL.xml");
+ int port = imapServer.getListenAddresses().get(0).getPort();
+
+ assertThatCode(() ->
+ testIMAPClient.connect("127.0.0.1", port)
+ .login(USER.asString(), USER_PASS)
+ .append("INBOX", SMALL_MESSAGE))
+ .doesNotThrowAnyException();
+ }
+
+ @Test
+ void loginShouldSuccessWhenNOTRequireSSLAndPlainAuthNotEnabled()
throws Exception {
Review comment:
it not pass
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]