Permalink
Browse files

Merge branch '1.5.x' into 1.6.x

  • Loading branch information...
1 parent 7226e32 commit 3e622f8879e2112f321cc9c615446d24cd360316 @Maks3w committed Jun 5, 2012
View
2 .gitignore
@@ -1,5 +1,7 @@
phpunit.xml
Tests/autoload.php
+
+.idea
nbproject
catalog.xml
View
10 CHANGELOG.md
@@ -1,6 +1,16 @@
Changelog
=========
+### v1.5.2 (2012-02-18)
+
+* Add support for Composer package manager now you can find this bundle in http://www.packagist.org
+* [Security] Sanitize user input.
+* Other fixes in sync with Symfony updates.
+
+### v1.5.1 (2012-02-06)
+
+* [Security] Prevent accidental information disclosure
+
### v1.5.0 (2012-01-29)
* Enhancement release
View
4 Driver/LdapConnection.php
@@ -30,10 +30,10 @@ public function search($baseDn, $filter, array $attributes = array())
$entries = ldap_get_entries($this->ldap_res, $search);
if (is_array($entries)) {
return $entries;
- } else {
- return false;
}
}
+
+ return false;
}
public function bind($user_dn, $password)
View
8 Ldap/LdapManager.php
@@ -58,9 +58,9 @@ public function findUserBy(array $criteria)
/**
* Build Ldap filter
- *
- * @param array $criteria
- *
+ *
+ * @param array $criteria
+ * @param string $condition
* @return string
*/
private function buildFilter(array $criteria, $condition = '&')
@@ -109,7 +109,7 @@ public function bind(LdapUserInterface $user, $password)
/**
* Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
*
- * Any control characters with an ACII code < 32 as well as the characters with special meaning in
+ * Any control characters with an ASCII code < 32 as well as the characters with special meaning in
* LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
* backslash followed by two hex digits representing the hexadecimal value of the character.
* @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
View
8 Ldap/LdapManagerInterface.php
@@ -11,31 +11,31 @@
* Find a user by its username.
*
* @param string $username
- * @return UserInterface or null if user does not exist
+ * @return \Symfony\Component\Security\Core\User\UserInterface or null if user does not exist
*/
function findUserByUsername($username);
/**
* Finds one user by the given criteria.
*
* @param array $criteria
- * @return UserInterface
+ * @return \Symfony\Component\Security\Core\User\UserInterface
*/
function findUserBy(array $criteria);
/**
* Bind the user on ldap
*
* @param LdapUserInterface $user
- * @param string password
+ * @param string $password
* @return Boolean
*/
function bind(LdapUserInterface $user, $password);
/**
* Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
*
- * Any control characters with an ACII code < 32 as well as the characters with special meaning in
+ * Any control characters with an ASCII code < 32 as well as the characters with special meaning in
* LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
* backslash followed by two hex digits representing the hexadecimal value of the character.
* @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
View
8 Model/LdapUserInterface.php
@@ -5,16 +5,16 @@
interface LdapUserInterface
{
/**
- * Set Ldap Distinguised Name
+ * Set Ldap Distinguished Name
*
- * @param string Distinguised Name
+ * @param string $dn Distinguished Name
*/
function setDn($dn);
/**
- * Get Ldap Distinguised Name
+ * Get Ldap Distinguished Name
*
- * @return string Distinguised Name
+ * @return string Distinguished Name
*/
function getDn();
}
View
5 README.md
@@ -15,7 +15,10 @@ Features included:
**Note:** This bundle cannot work as standalone at this moment and requires an User Manager like `FOSUserBundle`
-**Caution:** This bundles is developed in sync with [symfony's repository](https://github.com/symfony/symfony)
+**Versions and compatibilities:**
+- 1.5.x is compatible with Symfony 2.0.x and is recommended for stable projects.
+- 1.6.x is compatible with Symfony 2.1.x and has the same features than 1.5.x
+- 2.0.x is actually compatible with Symfony 2.0.x and have new features. This version is actually under development and is subject to changes.
[![Build Status](https://secure.travis-ci.org/Maks3w/FR3DLdapBundle.png?branch=master)](http://travis-ci.org/Maks3w/FR3DLdapBundle)
View
2 Resources/doc/cookbook/validator.md
@@ -37,4 +37,4 @@ to the correct one.
</constraint-mapping>
```
-NOTE: At the moment of write this receipe, the validator only can check uniqueness with the username attribute
+NOTE: At the moment of write this recipe, the validator only can check uniqueness with the username attribute
View
4 Resources/doc/index.md
@@ -80,7 +80,7 @@ fr3d_ldap:
user:
baseDn: ou=users, dc=host, dc=foo
filter: (&(ObjectClass=Person))
- attributes: # Expecify ldap attributes mapping [ldap attribute, user object method]
+ attributes: # Specify ldap attributes mapping [ldap attribute, user object method]
# - { ldap_attr: uid, user_method: setUsername } # Default
# - { ldap_attr: cn, user_method: setName } # Optional
# - { ldap_attr: ..., user_method: ... } # Optional
@@ -113,7 +113,7 @@ security:
### 6. Implement LdapUserInterface on your User Class
-It's necesary implement `FR3D\LdapBundle\Model\LdapUserInterface` on your `User` for manipulate the ldap object Distinguished Name (DN)
+It's necessary implement `FR3D\LdapBundle\Model\LdapUserInterface` on your `User` for manipulate the ldap object Distinguished Name (DN)
OPTIONAL: You could persist $dn attribute for speedup authentication process.
View
2 Security/Authentication/LdapAuthenticationProvider.php
@@ -21,7 +21,7 @@ class LdapAuthenticationProvider extends UserAuthenticationProvider
private $userProvider;
/**
- * @var LdapManager
+ * @var LdapManagerInterface
*/
private $ldapManager;
View
3 Tests/DependencyInjection/FR3DLdapExtensionTest.php
@@ -8,6 +8,9 @@
class FR3DLdapExtensionTest extends \PHPUnit_Framework_TestCase
{
+ /** @var ContainerBuilder */
+ public $container;
+
public function testConfigurationNamespace()
{
$container = new ContainerBuilder();
View
4 Tests/Ldap/LdapManagerTest.php
@@ -8,12 +8,12 @@
class LdapManagerTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \FR3D\LdapBundle\Driver\LdapConnectionInterface
+ * @var \FR3D\LdapBundle\Driver\LdapConnectionInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $connection;
/**
- * @var \FR3D\LdapBundle\Model\UserManagerInterface
+ * @var \FR3D\LdapBundle\Model\UserManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $userManager;
View
30 Tests/Security/Authentication/LdapAuthenticationProviderTest.php
@@ -3,9 +3,9 @@
namespace FR3D\LdapBundle\Tests\Security\Authentication;
use FR3D\LdapBundle\Security\Authentication\LdapAuthenticationProvider;
+use FR3D\LdapBundle\Tests\TestUser;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
-use FR3D\LdapBundle\Tests\TestUser;
class LdapAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
{
@@ -15,12 +15,12 @@ class LdapAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
protected $ldapAuthenticationProvider;
/**
- * @var UserProviderInterface
+ * @var \Symfony\Component\Security\Core\User\UserProviderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $userProvider;
/**
- * @var \FR3D\LdapBundle\Ldap\LdapManagerInterface
+ * @var \FR3D\LdapBundle\Ldap\LdapManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $ldapManager;
@@ -32,16 +32,16 @@ protected function setUp()
{
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$providerKey = 'provider_key';
- $this->userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
- $this->ldapManager = $this->getMock('FR3D\LdapBundle\Ldap\LdapManagerInterface');
+ $this->userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
+ $this->ldapManager = $this->getMock('FR3D\LdapBundle\Ldap\LdapManagerInterface');
$hideUserNotFoundExceptions = false;
$this->ldapAuthenticationProvider = new LdapAuthenticationProvider($userChecker, $providerKey, $this->userProvider, $this->ldapManager, $hideUserNotFoundExceptions);
}
public function testRetrieveUser()
{
- $method = $this->setMethodAccesible('retrieveUser');
+ $method = $this->setMethodAccessible('retrieveUser');
$username = 'test_username';
$user = new TestUser();
$token = new UsernamePasswordToken($username, 'password', 'provider_key', array());
@@ -59,7 +59,7 @@ public function testRetrieveUser()
*/
public function testRetrieveUserNotFound()
{
- $method = $this->setMethodAccesible('retrieveUser');
+ $method = $this->setMethodAccessible('retrieveUser');
$username = 'notfound_username';
$token = new UsernamePasswordToken($username, 'password', 'provider_key', array());
@@ -73,7 +73,7 @@ public function testRetrieveUserNotFound()
public function testCheckAuthenticationKnownUser()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'bad_username';
$password = 'password';
$user = new TestUser();
@@ -97,7 +97,7 @@ public function testCheckAuthenticationKnownUser()
*/
public function testCheckAuthenticationKnownUserCredentialsChanged()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'bad_username';
$password = 'other_password';
$user = new TestUser();
@@ -116,7 +116,7 @@ public function testCheckAuthenticationKnownUserCredentialsChanged()
public function testCheckAuthenticationUnknownUser()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'test_username';
$password = 'password';
$user = new TestUser();
@@ -142,7 +142,7 @@ public function testCheckAuthenticationUnknownUser()
*/
public function testCheckAuthenticationUnknownUserUsernameNotFound()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'bad_username';
$password = 'password';
$user = new TestUser();
@@ -162,7 +162,7 @@ public function testCheckAuthenticationUnknownUserUsernameNotFound()
*/
public function testCheckAuthenticationUnknownUserBadCredentials()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'test_username';
$password = 'bad_password';
$user = new TestUser();
@@ -186,7 +186,7 @@ public function testCheckAuthenticationUnknownUserBadCredentials()
*/
public function testCheckAuthenticationUnknownUserPasswordEmpty()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'test_username';
$password = '';
$user = new TestUser();
@@ -204,7 +204,7 @@ public function testCheckAuthenticationUnknownUserPasswordEmpty()
public function testCheckAuthenticationUnknownUserWithoutDn()
{
- $method = $this->setMethodAccesible('checkAuthentication');
+ $method = $this->setMethodAccessible('checkAuthentication');
$username = 'test_username';
$password = 'password';
$userOriginal = new TestUser();
@@ -234,7 +234,7 @@ public function testCheckAuthenticationUnknownUserWithoutDn()
$this->assertTrue(true);
}
- private function setMethodAccesible($name)
+ private function setMethodAccessible($name)
{
$reflectionClass = new \ReflectionClass('FR3D\LdapBundle\Security\Authentication\LdapAuthenticationProvider');
$method = $reflectionClass->getMethod($name);
View
2 Tests/Security/User/LdapUserProviderTest.php
@@ -9,7 +9,7 @@
class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \FR3D\LdapBundle\Ldap\LdapManager
+ * @var \FR3D\LdapBundle\Ldap\LdapManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $ldapManager;
View
4 Tests/Validator/UniqueValidatorTest.php
@@ -17,9 +17,13 @@
class UniqueValidatorTest extends \PHPUnit_Framework_TestCase
{
+ /** @var UniqueValidator */
private $validator;
+ /** @var \FR3D\LdapBundle\Ldap\LdapManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
private $ldapManagerMock;
+ /** @var Unique */
private $constraint;
+ /** @var TestUser */
private $user;
public function setUp()
View
4 Validator/UniqueValidator.php
@@ -40,8 +40,8 @@ public function __construct(LdapManagerInterface $ldapManager)
/**
* Checks if the passed value is valid.
*
- * @param mixed $value The value that should be validated
- * @param Constraint $constraint The constrain for the validation
+ * @param UserInterface $value The value that should be validated
+ * @param Constraint $constraint The constrain for the validation
*
* @return Boolean Whether or not the value is valid
*
View
16 composer.json
@@ -3,13 +3,17 @@
"type": "symfony-bundle",
"description": "This package provide users and authentication services based on LDAP directories for Symfony2 framework",
"keywords": ["ldap", "authentication"],
- "version": "1.6.0",
"license": "MIT",
+ "homepage": "https://github.com/Maks3w/FR3DLdapBundle",
"authors": [
{
"name": "Maks3w"
}
],
+ "support": {
+ "issues": "https://github.com/Maks3w/FR3DLdapBundle/issues",
+ "source": "https://github.com/Maks3w/FR3DLdapBundle"
+ },
"require": {
"php": ">=5.3.2",
"ext-ldap": "*",
@@ -18,16 +22,18 @@
"symfony/security": "2.1.*",
"symfony/security-bundle": "2.1.*"
},
- "recommend": {
+ "require-dev": {
"symfony/class-loader": "2.1.*",
"symfony/validator": "2.1.*"
},
"suggest": {
- "symfony/framework-bundle": "2.1.*",
- "friendsofsymfony/user-bundle": "*"
+ "symfony/validator": "Allow pre-validate for existing users before register new ones",
+ "friendsofsymfony/user-bundle": "Integrate authentication and management for DB users, useful for unmanaged LDAP servers"
},
"autoload": {
- "psr-0": { "FR3D\\LdapBundle": "" }
+ "psr-0": {
+ "FR3D\\LdapBundle": ""
+ }
},
"target-dir": "FR3D/LdapBundle"
}
View
3 phpunit.xml.dist
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
-
<testsuites>
<testsuite name="FR3DLdapBundle test suite">
<directory suffix="Test.php">./Tests</directory>
@@ -18,4 +17,4 @@
</exclude>
</whitelist>
</filter>
-</phpunit>
+</phpunit>

0 comments on commit 3e622f8

Please sign in to comment.