JWuCines commented on code in PR #19432:
URL: https://github.com/apache/druid/pull/19432#discussion_r3209546331


##########
extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/validator/LDAPCredentialsValidator.java:
##########
@@ -237,22 +243,92 @@ SearchResult getLdapUserObject(BasicAuthLDAPConfig 
ldapConfig, DirContext contex
           ldapConfig.getBaseDn(),
           StringUtils.format(ldapConfig.getUserSearch(), encodedUsername),
           sc);
+      final SearchResult userResult;
       try {
         if (!results.hasMore()) {
           return null;
         }
-        return results.next();
+        userResult = results.next();
       }
       finally {
         results.close();
       }
+
+      // Some LDAP servers do not return memberOf in search results. When 
memberOf is
+      // absent and group search configuration is provided, fall back to a 
reverse
+      // group lookup.
+      if (ldapConfig.isGroupSearchConfigured() && 
!hasMemberOfAttribute(userResult)) {

Review Comment:
   Moved the reverse group lookup after the password verification: 
https://github.com/apache/druid/pull/19432/changes/a81ccf777cc8586da25a72cf9119adb566928da6#diff-472b992d587115d723b9c3027bcf078d0ee88bea6d389bb0ec2724b1a0ee8b0fR209



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

Reply via email to