@Test
public void testAuthenticateLoginAlias() throws Exception {

  // Given
  assertNull("User already exists in DB", userDAO.findLdapUserByName("allowedUser@ambari.apache.org"));
  users.createUser("allowedUser@ambari.apache.org", "password", UserType.LDAP, true, false);
  Authentication authentication = new UsernamePasswordAuthenticationToken("allowedUser@ambari.apache.org", "password");
  configuration.setProperty(Configuration.LDAP_ALT_USER_SEARCH_ENABLED.getKey(), "true");
  // When
  Authentication result = authenticationProvider.authenticate(authentication);
  // Then
  assertTrue(result.isAuthenticated());
}