Skip to content

Commit

Permalink
Add try and catch block to catch missing encoder on LDAPUser
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPatzke committed Feb 15, 2019
1 parent 312d939 commit 21c3f5d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Security/Provider/MapbenderLdapBindAuthenticationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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.');
}
}



}


Expand Down

0 comments on commit 21c3f5d

Please sign in to comment.