This is an automated email from the ASF dual-hosted git repository.

vishalsuvagia pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1e04da6248 Revert "AMBARI-26304 : User authentication fails for 
previously sync'd LDAP / AD based users"
1e04da6248 is described below

commit 1e04da624849123e91b3733b95f4575bc7a13f86
Author: Vishal Suvagia <[email protected]>
AuthorDate: Mon Feb 3 12:05:35 2025 +0530

    Revert "AMBARI-26304 : User authentication fails for previously sync'd LDAP 
/ AD based users"
    
    This reverts commit 9ea678128c59d1fc3627e106713ede8b39cba326.
---
 .../ambari/server/orm/entities/UserAuthenticationEntity.java      | 8 +++-----
 .../org/apache/ambari/server/security/authorization/Users.java    | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserAuthenticationEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserAuthenticationEntity.java
index 0795655cf3..a2324ea588 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserAuthenticationEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserAuthenticationEntity.java
@@ -105,11 +105,9 @@ public class UserAuthenticationEntity {
   }
 
   public String getAuthenticationKey() {
-    if (getAuthenticationType().equals(UserAuthenticationType.LOCAL)) {
-      int firstCommaIndex = authenticationKey.indexOf(",");
-      if (firstCommaIndex != -1) {
-        return authenticationKey.substring(0, firstCommaIndex);
-      }
+    int firstCommaIndex = authenticationKey.indexOf(",");
+    if (firstCommaIndex != -1) {
+      return authenticationKey.substring(0, firstCommaIndex);
     }
     return authenticationKey;
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
index 52368a6281..9e0650bb58 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
@@ -1266,7 +1266,7 @@ public class Users {
         
userAuthenticationEntity.updateAuthenticationKey(passwordEncoder.encode(newKey),
 configuration.getPasswordPolicyHistoryCount());
       } else {
         // If we get here the authenticated user is authorized to change the 
key for the subject.
-        userAuthenticationEntity.setAuthenticationKey(newKey);
+        userAuthenticationEntity.updateAuthenticationKey(newKey, 
configuration.getPasswordPolicyHistoryCount());
       }
 
       userAuthenticationDAO.merge(userAuthenticationEntity);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to