From 21c3f5d40d2f0493d7878f2abaf5b773f2cd21a0 Mon Sep 17 00:00:00 2001 From: David Patzke Date: Fri, 15 Feb 2019 09:32:06 +0100 Subject: [PATCH] Add try and catch block to catch missing encoder on LDAPUser --- .../MapbenderLdapBindAuthenticationProvider.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Security/Provider/MapbenderLdapBindAuthenticationProvider.php b/Security/Provider/MapbenderLdapBindAuthenticationProvider.php index 50a4e51..47aa223 100644 --- a/Security/Provider/MapbenderLdapBindAuthenticationProvider.php +++ b/Security/Provider/MapbenderLdapBindAuthenticationProvider.php @@ -8,7 +8,6 @@ namespace Mapbender\LDAPBundle\Security\Provider; - use Symfony\Component\Ldap\Exception\ConnectionException; use Symfony\Component\Ldap\LdapClientInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; @@ -18,7 +17,6 @@ use Symfony\Component\Security\Core\User\UserCheckerInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; - use Symfony\Component\Security\Core\Authentication\Provider\LdapBindAuthenticationProvider; class MapbenderLdapBindAuthenticationProvider extends LdapBindAuthenticationProvider @@ -53,14 +51,14 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke parent::checkAuthentication($user, $token); } catch(BadCredentialsException $e){ + try { if (!$this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $password, $user->getSalt())) { throw new BadCredentialsException('The presented password is invalid.'); } - + } catch (\Exception $e){ + throw new BadCredentialsException('The presented password is invalid.'); + } } - - - }