Skip to content

Commit 0c00784

Browse files
committed
minor #20292 [Ldap] Add support for sasl_bind and whoami LDAP operations (javiereguiluz)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Ldap] Add support for `sasl_bind` and `whoami` LDAP operations Fixes #20179. `@manu0401` if you can, please review this proposal. Thanks. Commits ------- 03922de [Ldap] Add support for `sasl_bind` and `whoami` LDAP operations
2 parents a8a70b9 + 03922de commit 0c00784

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

components/ldap.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ distinguished name (DN) and the password of a user::
7474

7575
When the LDAP server allows unauthenticated binds, a blank password will always be valid.
7676

77+
You can also use the :method:`Symfony\\Component\\Ldap\\Ldap::saslBind` method
78+
for binding to an LDAP server using `SASL`_::
79+
80+
// this method defines other optional arguments like $mech, $realm, $authcId, etc.
81+
$ldap->saslBind($dn, $password);
82+
83+
After binding to the LDAP server, you can use the :method:`Symfony\\Component\\Ldap\\Ldap::whoami`
84+
method to get the distinguished name (DN) of the authenticated and authorized user.
85+
86+
.. versionadded:: 7.2
87+
88+
The ``saslBind()`` and ``whoami()`` methods were introduced in Symfony 7.2.
89+
7790
Once bound (or if you enabled anonymous authentication on your
7891
LDAP server), you may query the LDAP server using the
7992
:method:`Symfony\\Component\\Ldap\\Ldap::query` method::
@@ -183,3 +196,5 @@ Possible operation types are ``LDAP_MODIFY_BATCH_ADD``, ``LDAP_MODIFY_BATCH_REMO
183196
``LDAP_MODIFY_BATCH_REMOVE_ALL``, ``LDAP_MODIFY_BATCH_REPLACE``. Parameter
184197
``$values`` must be ``NULL`` when using ``LDAP_MODIFY_BATCH_REMOVE_ALL``
185198
operation type.
199+
200+
.. _`SASL`: https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer

0 commit comments

Comments
 (0)