I would like to add some code inside the function authenticate() of the Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager.
I tried to create a child bundle of the security bundle.
And i redefined the service for security.authentication.manager in this bundle like that
<!-- Authentication related services -->
<service id="security.authentication.manager" class="%security.authentication.manager.class%" public="false">
<argument type="collection" />
</service>
But when i relad the page, the framework throw an exception: InvalidArgumentException: You must at least add one authentication provider.
I suppose it’s becaue the dependecies are created inside the parent bundle configuation.
What i must do to get it work without redefine the whole security bundle ?
Thank you.
Ok, I found that the best way is to create my own a factory, that extends the formFactory of symfony2
Then i must create my own AuthentificationProvider that extend the DaoAuthenticationProvider and declare it as abstract service.
Then create the service inside the factory via the method createAuthProvider() and replace the parameters we need.