ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stoa...@apache.org
Subject ambari git commit: AMBARI-16119. User imported from AD is unable to login to Ambari. (stoader)
Date Tue, 26 Apr 2016 19:16:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f9e70802c -> fee485798


AMBARI-16119. User imported from AD is unable to login to Ambari. (stoader)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fee48579
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fee48579
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fee48579

Branch: refs/heads/trunk
Commit: fee485798ea0f271f51a41d6e05386ed28b9b755
Parents: f9e7080
Author: Toader, Sebastian <stoader@hortonworks.com>
Authored: Tue Apr 26 21:15:54 2016 +0200
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Tue Apr 26 21:16:13 2016 +0200

----------------------------------------------------------------------
 .../security/authorization/AmbariAuthentication.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fee48579/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthentication.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthentication.java
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthentication.java
index 98b97b2..9b1939f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthentication.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthentication.java
@@ -192,11 +192,19 @@ public final class AmbariAuthentication implements Authentication {
 
     if (principal instanceof UserDetails) {
       UserDetails user = (UserDetails)principal;
+      String usernameOrig = user.getUsername();
+      String username = AuthorizationHelper.resolveLoginAliasToUserName(usernameOrig);
+
+      if (username.equals(usernameOrig))
+        return null; // create override only original username is a login alias
+
+
+      String userPassword = user.getPassword() != null ? user.getPassword() : "";
 
       principal =
         new User(
-          AuthorizationHelper.resolveLoginAliasToUserName(user.getUsername()),
-          user.getPassword(),
+          username,
+          userPassword,
           user.isEnabled(),
           user.isAccountNonExpired(),
           user.isCredentialsNonExpired(),


Mime
View raw message