Security/LdapGuardAuthenticator.php
public function getUser($credentials, UserProviderInterface $userProvider)
    {
        $domain = $this->ldap->getDomainContext();

        try {
            $credDomain = isset($credentials['ldap_domain']) ? $credentials['ldap_domain'] : '';
            $this->switchDomainIfNeeded($credDomain);
            $this->setLdapCredentialsIfNeeded($credentials['username'], $credentials['password'], $userProvider);
            $user = $userProvider->loadUserByUsername($credentials['username']);
            $this->userChecker->checkPreAuth($user);

            return $user;
        } catch (UsernameNotFoundException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (BadCredentialsException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (LdapConnectionException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (\Exception $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } finally {
            $this->switchDomainBackIfNeeded($domain);
        }
    }
public function getUser($credentials, UserProviderInterface $userProvider)
    {
        $domain = $this->ldap->getDomainContext();

        try {
            $credDomain = isset($credentials['ldap_domain']) ? $credentials['ldap_domain'] : '';
            $this->switchDomainIfNeeded($credDomain);
            $this->setLdapCredentialsIfNeeded($credentials['username'], $credentials['password'], $userProvider);
            $user = $userProvider->loadUserByUsername($credentials['username']);
            $this->userChecker->checkPreAuth($user);

            return $user;
        } catch (UsernameNotFoundException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (BadCredentialsException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (LdapConnectionException $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } catch (\Exception $e) {
            $this->hideOrThrow($e, $this->options['hide_user_not_found_exceptions']);
        } finally {
            $this->switchDomainBackIfNeeded($domain);
        }
    }
{@inheritdoc}