Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 305abb8

Browse files
committed
Added documentation for the Ldap component
1 parent 5726c9b commit 305abb8

File tree

7 files changed

+594
-0
lines changed

7 files changed

+594
-0
lines changed

components/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The Components
2222
http_foundation/index
2323
http_kernel/index
2424
intl
25+
ldap
2526
options_resolver
2627
phpunit_bridge
2728
process

components/ldap.rst

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.. index::
2+
single: Ldap
3+
single: Components; Ldap
4+
5+
The Ldap Component
6+
==================
7+
8+
The Ldap component provides a means to connect to an LDAP server (OpenLDAP or Active Directory).
9+
10+
Installation
11+
------------
12+
13+
You can install the component in 2 different ways:
14+
15+
* :doc:`Install it via Composer </components/using_components>` (``symfony/ldap`` on `Packagist`_);
16+
* Use the official Git repository (https://github.com/symfony/ldap).
17+
18+
.. include:: /components/require_autoload.rst.inc
19+
20+
Usage
21+
-----
22+
23+
The :class:`Symfony\\Component\\Ldap\\LdapClient` class provides methods
24+
to authenticate and query against an LDAP server.
25+
26+
The :class:`Symfony\\Component\\Ldap\\LdapClient` class can be configured
27+
using the following options:
28+
29+
``host``
30+
IP or hostname of the LDAP server
31+
32+
``port``
33+
Port used to access the LDAP server
34+
35+
``version``
36+
The version of the LDAP protocol to use
37+
38+
``useSsl``
39+
Whether or not to secure the connection using SSL
40+
41+
``useStartTls``
42+
Whether or not to secure the connection using StartTLS
43+
44+
``optReferrals``
45+
Specifies whether to automatically follow referrals
46+
returned by the LDAP server
47+
48+
For example, to connect to a start-TLS secured LDAP server::
49+
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
55+
authenticates a previously configured connection using both the
56+
distinguished name (DN) and the password of a user::
57+
58+
use Symfony\Component\Ldap\LdapClient;
59+
// ...
60+
61+
$ldap->bind($dn, $password);
62+
63+
Once bound (or if you enabled anonymous authentication on your
64+
LDAP server), you may query the LDAP server using the
65+
:method:`Symfony\\Component\\Ldap\\LdapClient::find` method::
66+
67+
use Symfony\Component\Ldap\LdapClient;
68+
// ...
69+
70+
$ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
71+
72+
.. _Packagist: https://packagist.org/packages/symfony/ldap

components/map.rst.inc

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112

113113
* :doc:`/components/intl`
114114

115+
* **Ldap**
116+
117+
* :doc:`/components/ldap`
118+
115119
* **OptionsResolver**
116120

117121
* :doc:`/components/options_resolver`

cookbook/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
* :doc:`Security Authentication (Identifying/Logging in the User) </cookbook/security/index>`
165165

166166
* :doc:`/cookbook/security/form_login_setup`
167+
* :doc:`/cookbook/security/ldap`
167168
* :doc:`/cookbook/security/entity_provider`
168169
* :doc:`/cookbook/security/guard-authentication`
169170
* :doc:`/cookbook/security/remember_me`

cookbook/security/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Authentication (Identifying/Logging in the User)
88
:maxdepth: 2
99

1010
form_login_setup
11+
ldap
1112
entity_provider
1213
guard-authentication
1314
remember_me

0 commit comments

Comments
 (0)