diff --git a/src/DependencyInjection/DbpRelayLdapPersonProviderExtension.php b/src/DependencyInjection/DbpRelayLdapPersonProviderExtension.php index e9feca9ba75dc00131a2dd97d7cdd232890f3c78..5c16e41b3a5380ec383e35fa181429357aa70701 100644 --- a/src/DependencyInjection/DbpRelayLdapPersonProviderExtension.php +++ b/src/DependencyInjection/DbpRelayLdapPersonProviderExtension.php @@ -20,7 +20,7 @@ class DbpRelayLdapPersonProviderExtension extends ConfigurableExtension $loader->load('services.yaml'); // Inject the config value into the UCardService service - $definition = $container->getDefinition('Dbp\Relay\LdapPersonProviderBundle\Service\UCardService'); + $definition = $container->getDefinition('Dbp\Relay\LdapPersonProviderBundle\Service\LDAPApi'); $definition->addMethodCall('setConfig', [$mergedConfig]); } diff --git a/src/Service/LDAPApi.php b/src/Service/LDAPApi.php index a1fbc76695e8865534e42471009c02e2e4422f4c..d4ba9e551ad1864bf3052c8fa66325e646729e3e 100644 --- a/src/Service/LDAPApi.php +++ b/src/Service/LDAPApi.php @@ -96,6 +96,17 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface $this->birthdayAttributeName = $this->params->get('app.ldap.attributes.birthday') ?? ''; } + public function setConfig(array $config) + { + $this->providerConfig = [ + 'hosts' => [$config['host'] ?? ''], + 'base_dn' => $config['base_dn'] ?? '', + 'username' => $config['username'] ?? '', + 'password' => $config['password'] ?? '', + 'use_tls' => true, + ]; + } + public function setDeploymentEnvironment(string $env) { $this->deploymentEnv = $env;