1717use Symfony \Component \Security \Core \User \UserProviderInterface ;
1818use Symfony \Component \Security \Core \Authentication \Provider \LdapBindAuthenticationProvider ;
1919
20- class MapbenderLdapBindAuthenticationProvider extends LdapBindAuthenticationProvider
20+ class MapbenderLdapBindAuthenticationProvider extends LdapBindAuthenticationProvider
2121{
2222 private $ encoderFactory ;
2323
@@ -30,8 +30,7 @@ public function __construct(UserProviderInterface $userProvider,
3030 $ userQuery ,
3131 $ searchDn , $ searchPassword )
3232 {
33- parent ::__construct ( $ userProvider , $ userChecker , $ providerKey , $ ldap , $ dnString , true , $ searchDn , $ searchPassword );
34-
33+ parent ::__construct ($ userProvider , $ userChecker , $ providerKey , $ ldap , $ dnString , true , $ searchDn , $ searchPassword );
3534 $ this ->encoderFactory = $ encoderFactory ;
3635
3736 // support Mapbender < 3.2.x (Symfony 2.8)
@@ -40,28 +39,16 @@ public function __construct(UserProviderInterface $userProvider,
4039 }
4140 }
4241
43-
44-
4542 /**
4643 * {@inheritdoc}
4744 */
4845 protected function checkAuthentication (UserInterface $ user , UsernamePasswordToken $ token )
4946 {
50-
5147 $ password = $ token ->getCredentials ();
52- try {
48+ try {
5349 parent ::checkAuthentication ($ user , $ token );
54- } catch (BadCredentialsException $ e ){
55-
56- try {
57- if (!$ this ->encoderFactory ->getEncoder ($ user )->isPasswordValid ($ user ->getPassword (), $ password , $ user ->getSalt ())) {
58- throw new BadCredentialsException ('The presented password is invalid. ' );
59- }
60- } catch (\Exception $ e ){
61- throw new BadCredentialsException ('The presented password is invalid. ' );
62- }
50+ } catch (BadCredentialsException $ e ) {
51+ throw new BadCredentialsException ('The presented password is invalid: ' . $ e ->getMessage ());
6352 }
6453 }
65-
66-
6754}
0 commit comments