symfony/symfony — pull request #5189 by lyrixx (2012-08-06 09:50:38+00:00)
Title: [WIP][2.2][Security] Added Ldap provider

Bug fix: no, but may be
Feature addition: yes
Backwards compatibility break: no, but may be
Symfony2 tests pass: no, not yet
Fixes the following tickets: -
Todo: Finish implementation, Add more tests. Fix \DependencyInjection\Security\Factory\*`
License of the code: MIT
Documentation PR: not available yet

Hello.

First, it will be useful to have this provider into the security component. Thanks to this, the feature will be available into silex application, and also drupal 8 and ezpublish 5.

I open a PR, but my work is not finished. It could be great to have an early feedback (not about CS, just about architecture)

I read the codebase of bundles available on http://knpbundles.com/search?q=ldap but there is some issues with these bundles:

* Dependency on `Zend\Ldap` (opensky)
* A global username / password account is not needed to check is a user is able to connect to ldap. (all bundle)
* The factory are no enough flexible.

Of course, I will rebase / squash all my commits before final merge (if happen).

I am really not sure about	f40c85b

I tried to keep the default workflow of the user authentification
But with ldap, we can not retrieve user password. The only way to check if a user is in a ldap server, and if he is able to connect to the ldap, it is to try to connect the user against the ldap.

Then, we have an issue in `src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/*Factory.php`.
For exemple in https://github.com/lyrixx/symfony/blob/1834aaa11a9342455eaf30f1c6cd7ef69f951bdb/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginFactory.php#L65 the `$provider` (AuthentificationProvider) is hardcoded. It should not be.
So, just for my test, i changed this value (this change breaks tests).
But we have to find a way to do this cleanly. How can we do that ?

* (A) Duplicate the factory (Not ok with that)
* (B) Add a new argument createAuthProvider
* ??

With A option, there will be lot of code.
With B option, we could add BC break.