AMBARI-19692. LDAP regression in Ambari 2.4: Login alias is not resolved during authentication (oleewere)
Change-Id: I91da4344bc8cbfdb4863c973312c75ac21464066 Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/18e58ffb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/18e58ffb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/18e58ffb Branch: refs/heads/branch-dev-patch-upgrade Commit: 18e58ffb3759819155261f7e3e68491f330ecd02 Parents: dab389d Author: oleewere <oleew...@gmail.com> Authored: Tue Jan 24 15:24:59 2017 +0100 Committer: oleewere <oleew...@gmail.com> Committed: Wed Jan 25 12:07:36 2017 +0100 ---------------------------------------------------------------------- .../authorization/AmbariLdapAuthenticationProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/18e58ffb/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java index 552be1e..a35e7eb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java @@ -194,18 +194,18 @@ public class AmbariLdapAuthenticationProvider implements AuthenticationProvider } private Integer getUserId(Authentication authentication) { - String userName = authentication.getName(); + String userName = AuthorizationHelper.resolveLoginAliasToUserName(authentication.getName()); UserEntity userEntity = userDAO.findLdapUserByName(userName); // lookup is case insensitive, so no need for string comparison if (userEntity == null) { - LOG.info("user not found "); + LOG.info("user not found ('{}')", userName); throw new InvalidUsernamePasswordCombinationException(); } if (!userEntity.getActive()) { - LOG.debug("User account is disabled"); + LOG.debug("User account is disabled ('{}')", userName); throw new InvalidUsernamePasswordCombinationException(); }