Skip to content

Commit 351f128

Browse files
committed
minor #7950 use Ldap instead of the deprecated LdapClient (xabbuh, javiereguiluz)
This PR was merged into the 3.2 branch. Discussion ---------- use Ldap instead of the deprecated LdapClient Commits ------- 2b990f4 Fixed code indentation e38e58c use Ldap instead of the deprecated LdapClient
2 parents 54b4bb0 + 2b990f4 commit 351f128

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

components/ldap.rst

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ You can install the component in 2 different ways:
2020
Usage
2121
-----
2222

23-
The :class:`Symfony\\Component\\Ldap\\LdapClient` class provides methods
24-
to authenticate and query against an LDAP server.
23+
The :class:`Symfony\\Component\\Ldap\\Ldap` class provides methods to authenticate
24+
and query against an LDAP server.
2525

26-
The :class:`Symfony\\Component\\Ldap\\LdapClient` class can be configured
26+
The ``Ldap`` class uses an :class:`Symfony\\Component\\Ldap\\Adapter\\AdapterInterface`
27+
to communicate with an LDAP server. The :class:`adapter <Symfony\\Component\\Ldap\\Adapter\\ExtLdap\\Adapter>`
28+
for PHP's built-in LDAP extension, for example, can be configured
2729
using the following options:
2830

2931
``host``
@@ -47,24 +49,32 @@ using the following options:
4749

4850
For example, to connect to a start-TLS secured LDAP server::
4951

50-
use Symfony\Component\Ldap\LdapClient;
51-
52-
$ldap = new LdapClient('my-server', 389, 3, false, true);
53-
54-
The :method:`Symfony\\Component\\Ldap\\LdapClient::bind` method
52+
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
53+
use Symfony\Component\Ldap\Ldap;
54+
55+
$adapter = new Adapter(array(
56+
'host' => 'my-server',
57+
'port' => 389,
58+
'encryption' => 'tls',
59+
'options' => array(
60+
'protocol_version' => 3,
61+
'referrals' => false,
62+
),
63+
));
64+
$ldap = new Ldap($adapter);
65+
66+
The :method:`Symfony\\Component\\Ldap\\Ldap::bind` method
5567
authenticates a previously configured connection using both the
5668
distinguished name (DN) and the password of a user::
5769

58-
use Symfony\Component\Ldap\LdapClient;
5970
// ...
6071

6172
$ldap->bind($dn, $password);
6273

6374
Once bound (or if you enabled anonymous authentication on your
6475
LDAP server), you may query the LDAP server using the
65-
:method:`Symfony\\Component\\Ldap\\LdapClient::find` method::
76+
:method:`Symfony\\Component\\Ldap\\Ldap::find` method::
6677

67-
use Symfony\Component\Ldap\LdapClient;
6878
// ...
6979

7080
$ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');

0 commit comments

Comments
 (0)