Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Jun 5, 2012
1 parent 60d69b8 commit c992e28
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Driver/LdapConnection.php
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions Ldap/LdapManager.php
Expand Up @@ -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 = '&')
Expand Down Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions Ldap/LdapManagerInterface.php
Expand Up @@ -11,31 +11,31 @@ interface LdapManagerInterface
* 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>
Expand Down
8 changes: 4 additions & 4 deletions Model/LdapUserInterface.php
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ Features included:

**Note:** This bundle cannot work as standalone at this moment and requires an User Manager like `FOSUserBundle`

**Versions and compatibilites:**
**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.
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/cookbook/validator.md
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Resources/doc/index.md
Expand Up @@ -104,7 +104,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
Expand Down Expand Up @@ -137,7 +137,7 @@ security:

### 7. 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.

Expand Down
2 changes: 1 addition & 1 deletion Security/Authentication/LdapAuthenticationProvider.php
Expand Up @@ -21,7 +21,7 @@ class LdapAuthenticationProvider extends UserAuthenticationProvider
private $userProvider;

/**
* @var LdapManager
* @var LdapManagerInterface
*/
private $ldapManager;

Expand Down
3 changes: 3 additions & 0 deletions Tests/DependencyInjection/FR3DLdapExtensionTest.php
Expand Up @@ -8,6 +8,9 @@
class FR3DLdapExtensionTest extends \PHPUnit_Framework_TestCase
{

/** @var ContainerBuilder */
public $container;

public function testConfigurationNamespace()
{
$container = new ContainerBuilder();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Ldap/LdapManagerTest.php
Expand Up @@ -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;

Expand Down
30 changes: 15 additions & 15 deletions Tests/Security/Authentication/LdapAuthenticationProviderTest.php
Expand Up @@ -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
{
Expand All @@ -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;

Expand All @@ -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());
Expand All @@ -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());

Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Security/User/LdapUserProviderTest.php
Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions Tests/Validator/UniqueValidatorTest.php
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Validator/UniqueValidator.php
Expand Up @@ -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
*
Expand Down
3 changes: 1 addition & 2 deletions 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>
Expand All @@ -18,4 +17,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>

0 comments on commit c992e28

Please sign in to comment.