Skip to content

[WIP] [Ldap] Marked the Ldap component as internal #16735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Symfony/Component/Ldap/Exception/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* ConnectionException is throw if binding to ldap can not be established.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @internal
*/
class ConnectionException extends \RuntimeException
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Ldap/Exception/LdapException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* LdapException is throw if php ldap module is not loaded.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @internal
*/
class LdapException extends \RuntimeException
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Ldap/LdapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Francis Besset <francis.besset@gmail.com>
* @author Charles Sarrazin <charles@sarraz.in>
*
* @internal
*/
class LdapClient implements LdapClientInterface
{
Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Component/Ldap/LdapClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Charles Sarrazin <charles@sarraz.in>
*
* @internal
*/
interface LdapClientInterface
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this change: using the ext-ldpa constants binds the interface to the extension, thus removes any genericness don't you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but these were only here for the ldap_escape polyfill.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas Moreover, we want to prevent people from being highly coupled to an interface which will introduce BC at a later time. We may reintroduce them at a later date.

const LDAP_ESCAPE_FILTER = 0x01;
const LDAP_ESCAPE_DN = 0x02;

/**
* Return a connection bound to the ldap.
*
Expand Down
10 changes: 7 additions & 3 deletions src/Symfony/Component/Ldap/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Ldap Component
=============
==============

A Ldap client for PHP on top of PHP's ldap extension.

This component also provides a stub for the missing
`ldap_escape` function in PHP versions lower than 5.6.
Disclaimer
----------

This component is currently marked as internal, as it
still needs some work. Breaking changes will be introduced
in the next minor version of Symfony.

Documentation
-------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
$password = $token->getCredentials();

try {
$username = $this->ldap->escape($username, '', LdapClientInterface::LDAP_ESCAPE_DN);
$username = $this->ldap->escape($username, '', LDAP_ESCAPE_DN);
$dn = str_replace('{username}', $username, $this->dnString);

$this->ldap->bind($dn, $password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function loadUserByUsername($username)
{
try {
$this->ldap->bind($this->searchDn, $this->searchPassword);
$username = $this->ldap->escape($username, '', LdapClientInterface::LDAP_ESCAPE_FILTER);
$username = $this->ldap->escape($username, '', LDAP_ESCAPE_FILTER);
$query = str_replace('{username}', $username, $this->defaultSearch);
$search = $this->ldap->find($this->baseDn, $query);
} catch (ConnectionException $e) {
Expand Down