morningman commented on code in PR #19959:
URL: https://github.com/apache/doris/pull/19959#discussion_r1208035247


##########
fe/fe-core/src/main/java/org/apache/doris/ldap/LdapAuthenticate.java:
##########
@@ -64,11 +66,15 @@ public static boolean authenticate(ConnectContext context, 
String password, Stri
         String remoteIp = context.getMysqlChannel().getRemoteIp();
         UserIdentity tempUserIdentity = 
UserIdentity.createAnalyzedUserIdentWithIp(qualifiedUser, remoteIp);
         // Search the user in doris.
-        UserIdentity userIdentity = 
Env.getCurrentEnv().getAuth().getCurrentUserIdentity(tempUserIdentity);
-        if (userIdentity == null) {
+        List<UserIdentity> userIdentities = Env.getCurrentEnv().getAuth()
+                .getUserIdentityForLdap(qualifiedUser, remoteIp);
+        UserIdentity userIdentity;
+        if (userIdentities.isEmpty()) {
             userIdentity = tempUserIdentity;
             LOG.debug("User:{} does not exists in doris, login as temporary 
users.", userName);
             context.setIsTempUser(true);
+        } else {
+            userIdentity = userIdentities.get(0);

Review Comment:
   Why using the first one? Or is it just an arbitrary selection?



-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to