From 5d1b7f958c12b7b8d64baeedfad64a0c6c5ba403 Mon Sep 17 00:00:00 2001 From: Philippe Milot Date: Thu, 18 May 2017 10:01:11 -0400 Subject: [PATCH 1/5] Updated code example for LDAP integration The LdapClient class mentioned in the code example has been deprecated. The update example, uses the Ldap class directly, as is recommended in the deprecation notice. --- security/ldap.rst | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/security/ldap.rst b/security/ldap.rst index c516d350bfa..940a3d45f33 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -49,8 +49,8 @@ The providers are configured to use a default service named ``ldap``, but you can override this setting in the security component's configuration. -An LDAP client can be simply configured, using the following service -definition: +An LDAP client can be simply configured using the built-in :phpext:`ldap` PHP +extension with the following service definition: .. configuration-block:: @@ -59,13 +59,17 @@ definition: # app/config/services.yml services: ldap: - class: Symfony\Component\Ldap\LdapClient - arguments: - - my-server # host - - 389 # port - - 3 # version - - false # SSL - - true # TLS + class: Symfony\Component\Ldap\Ldap + arguments: ['@ext_ldap_adapter'] + ext_ldap_adapter: + class: Symfony\Component\Ldap\Adapter\ExtLdap\Adapter + arguments: + - host: my-server + port: 389 + encryption: tls + options: + protocol_version: 3 + referrals: false .. code-block:: xml @@ -76,12 +80,19 @@ definition: xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - my-server - 389 - 3 - false - true + + + + + + my-server + 389 + tls + + 3 + false + + @@ -89,18 +100,23 @@ definition: .. code-block:: php // app/config/services.php - use Symfony\Component\Ldap\LdapClient; + use Symfony\Component\Ldap\Ldap; + use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter; use Symfony\Component\DependencyInjection\Definition; + $container->register('ldap', Ldap::class) + ->addArgument(new Reference('ext_ldap_adapter')); + $container - ->setDefinition('ldap', new Definition(LdapClient::class, array( - 'my-server', - 389, - 3, - false, - true, - - )); + ->setDefinition('ext_ldap_adapter, new Definition(Ldap::class, array( + 'host' => 'my-server', + 'port' => 389, + 'encryption' => 'tls', + 'options' => array( + 'protocol_version' => 3, + 'referrals' => false + ) + ))); Fetching Users Using the LDAP User Provider ------------------------------------------- From efca30d6e0fd6374bd346ab80ec60f2eb322d4ea Mon Sep 17 00:00:00 2001 From: Philippe Milot Date: Thu, 18 May 2017 10:16:34 -0400 Subject: [PATCH 2/5] Fix invalid RST role --- security/ldap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/ldap.rst b/security/ldap.rst index 940a3d45f33..4bddb741565 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -49,7 +49,7 @@ The providers are configured to use a default service named ``ldap``, but you can override this setting in the security component's configuration. -An LDAP client can be simply configured using the built-in :phpext:`ldap` PHP +An LDAP client can be simply configured using the built-in ``ldap`` PHP extension with the following service definition: .. configuration-block:: From 66415e1d405919323dc25f7f967502fb8c9e02c1 Mon Sep 17 00:00:00 2001 From: Philippe Milot Date: Thu, 18 May 2017 10:41:36 -0400 Subject: [PATCH 3/5] Fix a syntax issue in LDAP PHP code example --- security/ldap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/ldap.rst b/security/ldap.rst index 4bddb741565..a585d874230 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -108,7 +108,7 @@ extension with the following service definition: ->addArgument(new Reference('ext_ldap_adapter')); $container - ->setDefinition('ext_ldap_adapter, new Definition(Ldap::class, array( + ->setDefinition('ext_ldap_adapter', new Definition(Ldap::class, array( 'host' => 'my-server', 'port' => 389, 'encryption' => 'tls', From afa741a0768735f79f3a5a3c62dcadf5c08ce255 Mon Sep 17 00:00:00 2001 From: Philippe Milot Date: Mon, 22 May 2017 13:04:17 -0400 Subject: [PATCH 4/5] Convert accidental tabs to spaces --- security/ldap.rst | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/security/ldap.rst b/security/ldap.rst index a585d874230..d33da03dbc7 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -62,14 +62,14 @@ extension with the following service definition: class: Symfony\Component\Ldap\Ldap arguments: ['@ext_ldap_adapter'] ext_ldap_adapter: - class: Symfony\Component\Ldap\Adapter\ExtLdap\Adapter - arguments: - - host: my-server - port: 389 - encryption: tls - options: - protocol_version: 3 - referrals: false + class: Symfony\Component\Ldap\Adapter\ExtLdap\Adapter + arguments: + - host: my-server + port: 389 + encryption: tls + options: + protocol_version: 3 + referrals: false .. code-block:: xml @@ -84,15 +84,15 @@ extension with the following service definition: - - my-server - 389 - tls - - 3 - false - - + + my-server + 389 + tls + + 3 + false + + From 0f9bc5f3bfb79d52340a33c4ea814de6cb97aebf Mon Sep 17 00:00:00 2001 From: Philippe Milot Date: Fri, 26 May 2017 10:24:05 -0400 Subject: [PATCH 5/5] Fix class name in LDAP PHP code example --- security/ldap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/ldap.rst b/security/ldap.rst index d33da03dbc7..841a2ec7ba4 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -108,7 +108,7 @@ extension with the following service definition: ->addArgument(new Reference('ext_ldap_adapter')); $container - ->setDefinition('ext_ldap_adapter', new Definition(Ldap::class, array( + ->setDefinition('ext_ldap_adapter', new Definition(Adapter::class, array( 'host' => 'my-server', 'port' => 389, 'encryption' => 'tls',