title: How to extend LdapUserProvider and use a custom LDAP user provider in Symfony?
body: <p>I'm struggeling to replace the LdapUserProvider.  </p>
  
  <p>I created my own provider (App\Security\MyLdapUserProvider based on LdapUserProvider but retrieves more information) and my own UserInterface (App\Security\MyUser) with more attributes to store the data.</p>
  
  <p>In the end I want to retrieve the groups and the displayName of the user.</p>
  
  <p>Here is my config:</p>
  
  <p>services.yaml:  </p>
  
  <pre><code># add more service definitions when explicit configuration is needed
  # please note that last definitions always *replace* previous ones
  Symfony\Component\Ldap\Ldap:
      arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']
  Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
      arguments:
          - host: 10.106.1.1
            port: 389
            #encryption: tls
            options:
                protocol_version: 3
                referrals: false
  </code></pre>
  
  <p>security.yaml:    </p>
  
  <pre><code>providers:
      #in_memory: { memory: ~ }
      my_ldap:
          ldap:
              service: Symfony\Component\Ldap\Ldap
              base_dn: "dc=XXXXXX,dc=com"
              search_dn: "CN=XXXXXXXXXX,OU=LDAP,OU=Services Accounts,OU=Administration,DC=XXXXXXXXX,DC=com"
              search_password: "ergergergergerg"
              default_roles: ROLE_USER
              filter: "({uid_key}={username})"
              uid_key: samAccountName
              #password_attribute: displayName
  firewalls:
      dev:
          pattern: ^/(_(profiler|wdt)|css|images|js)/
          security: false
  
      main:
          pattern: ^/
          security: true
          anonymous: true
          provider: my_ldap
          form_login_ldap:
              login_path: /login
              check_path: /login
              service: Symfony\Component\Ldap\Ldap
              dn_string: 'dc=XXXXXX,dc=com'
              query_string: '(samAccountName={username})'
          logout:
              path:   /logout
              target: /
  </code></pre>
  
  <p>Where can I tell the security provider to use my own ldap provider instead of the default one ?  </p>
  
  <p>Symfony processes are still a bit complicated to me so if someone can take time to explain..</p>
  
  <p>Symfony docs is an endless loop of redirecting between CustomUserProvider > Ldap config > CustomeUSerProvider...</p>