I try to write custom authentication provider for LDAP-authentication using silex documentation - Defining a custom Authentication Provider.
But if I look into $app['security.authentication_providers']
there are two providers. One that I defined App\LdapAuthenticationProvider
and one Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider
And when I try to authorize user I get error because there is call of a App\LdapUserProvider::loadUserByUsername()
from class DaoAuthenticationProvider.
If I would have only one provider in $app['security.authentication_providers']
I think I should not get error because my LDAP-provider do not call loadUserByUsername.
Here is dump of $app['security.authentication_providers']
array (size=2)
0 => object(App\LdapAuthenticationProvider)[194]
private 'userProvider' =>
object(App\LdapUserProvider)[176]
private 'ldap' => resource(57, ldap link)
private 'defaultRoles' =>
array (size=1)
...
private 'providerKey' => string 'default' (length=7)
1 => object(Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider)[195]
private 'encoderFactory' =>
object(Symfony\Component\Security\Core\Encoder\EncoderFactory)[197]
private 'encoders' =>
array (size=1)
...
private 'userProvider' =>
object(App\LdapUserProvider)[176]
private 'ldap' => resource(57, ldap link)
private 'defaultRoles' =>
array (size=1)
...
private 'hideUserNotFoundExceptions' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => boolean true
private 'userChecker' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => object(Symfony\Component\Security\Core\User\UserChecker)[196]
private 'providerKey' (Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider) => string 'default' (length=7)
So, does anybody know why there are extra provider and how can I get rid of it?
There are code for bootstraping application, LdapAuthenticationListener and LdapAuthenticationProvider.