Author: Chad Sikorra (Chad.Sikorra@gmail.com)
Inheritance: implements LdapTools\Operation\LdapOperationInterface, use trait LdapOperationTrait
Example #1
0
 function it_should_attempt_to_authenticate_a_username_and_password(LdapConnectionInterface $connection)
 {
     $operation = new AuthenticationOperation();
     $operation->setUsername('foo')->setPassword('bar');
     $response = new AuthenticationResponse(true);
     $domainConfig = new DomainConfiguration('example.local');
     $connection->getConfig()->willReturn($domainConfig);
     $connection->execute($operation)->willReturn($response);
     $this->beConstructedWith(new Configuration(), $connection);
     $this->authenticate('foo', 'bar')->shouldBeEqualTo(true);
 }
 /**
  * If the operation requested that the credentials be switched, then update the credential information in the
  * connections config. Otherwise it will switch again on other auth-attempts or re-connects.
  *
  * @param AuthenticationOperation $operation
  */
 protected function switchCredentials(AuthenticationOperation $operation)
 {
     $this->connection->getConfig()->setUsername($operation->getUsername());
     $this->connection->getConfig()->setPassword($operation->getPassword());
 }