diff --git a/src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php b/src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php
index a5defb14a59363da74aaf0b5409daec3a9bd5eaa..790027bbbea2ce82969f2c4fdd0c40e0949d7181 100644
--- a/src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php
+++ b/src/UnicaenAuthentification/Provider/Identity/LdapServiceFactory.php
@@ -30,7 +30,8 @@ class LdapServiceFactory implements FactoryInterface
 
         $simpleIdentityProvider->setDefaultRole($config['default_role']);
         $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']);
-        $usernamefield = $config['unicaen-auth']['local']['ldap']['username'];
+        
+        $usernamefield = $container->get('Config')['unicaen-auth']['local']['ldap']['username'];
         $simpleIdentityProvider->setUsernamefield($usernamefield);
 
         return $simpleIdentityProvider;
diff --git a/src/UnicaenAuthentification/Service/UserContextFactory.php b/src/UnicaenAuthentification/Service/UserContextFactory.php
index 5f857a17b4f11778cb2b9f69cb125c73a33c263f..1dcd52cfcc207062c58527fd0b3eb1d5e42e22d6 100644
--- a/src/UnicaenAuthentification/Service/UserContextFactory.php
+++ b/src/UnicaenAuthentification/Service/UserContextFactory.php
@@ -32,7 +32,7 @@ class UserContextFactory
         // mais c'est impossible pour l'instant car il y a un cycle dans les dépendances entre services qui
         // provoque une boucle infinie.
         //
-        $usernamefield = $config['unicaen-auth']['local']['ldap']['username'];
+        $usernamefield = $container->get('Config')['unicaen-auth']['local']['ldap']['username'];
         $service->setUsernamefield($usernamefield);
         return $service;
     }