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/10 10:56:41 UTC

[GitHub] [james-project] chibenwa commented on a change in pull request #788: [WIP] JAMES-3680 Disable authentication on un-encrypted channels

chibenwa commented on a change in pull request #788:
URL: https://github.com/apache/james-project/pull/788#discussion_r766585403



##########
File path: server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
##########
@@ -75,15 +76,58 @@
     private boolean compress;
     private int maxLineLength;
     private int inMemorySizeLimit;
-    private boolean plainAuthDisallowed;
     private int timeout;
     private int literalSizeLimit;
+    private AuthenticationConfiguration authenticationConfiguration;
 
     public static final int DEFAULT_MAX_LINE_LENGTH = 65536; // Use a big default
     public static final Size DEFAULT_IN_MEMORY_SIZE_LIMIT = Size.of(10L, Size.Unit.M); // Use 10MB as default
     public static final int DEFAULT_TIMEOUT = 30 * 60; // default timeout is 30 minutes
     public static final int DEFAULT_LITERAL_SIZE_LIMIT = 0;
 
+    public static class AuthenticationConfiguration {
+        private static final boolean REQUIRE_SSL_DEFAULT = true;
+        private static final boolean PLAIN_AUTH_ENABLED_DEFAULT = true;
+
+        public static AuthenticationConfiguration parse(HierarchicalConfiguration<ImmutableNode> configuration) {
+            return Optional.of(configuration.containsKey("auth"))
+                .filter(FunctionalUtils.identityPredicate())
+                .map(any -> configuration.configurationAt("auth"))
+                .map(authConfiguration -> parseAuth(configuration, authConfiguration))
+                .orElseGet(() -> new AuthenticationConfiguration(fallbackPlainAuthEnabled(configuration), REQUIRE_SSL_DEFAULT));

Review comment:
       config.getString("auth.requireSSL", null) 
   config.getString("auth.plainAuthEnabled", null)
   
   can likely do the job too and would be simpler.




-- 
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