Example #1
0
 /**
  * Binds to the Ldap connection
  *
  * @param string $name     Bind rdn (Default: null)
  * @param string $password Bind password (Default: null)
  *
  * @return void
  *
  * @throws Toyota\Component\Ldap\Exception\BindException if binding fails
  */
 public function bind($name = null, $password = null)
 {
     if (strlen(trim($name)) > 0) {
         $password = null === $password ? '' : $password;
         $this->connection->bind($name, $password);
         $this->isBound = true;
         return;
     }
     if ($this->configuration['bind_anonymous']) {
         $this->connection->bind();
         $this->isBound = true;
         return;
     }
     $this->connection->bind($this->configuration['bind_dn'], $this->configuration['bind_password']);
     $this->isBound = true;
 }