LdapTools\DomainConfiguration::getEncoding PHP Method

getEncoding() public method

Get the encoding type to use.
public getEncoding ( ) : string
return string
    public function getEncoding()
    {
        return $this->config['encoding'];
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Binds to LDAP with the supplied credentials or anonymously if specified.
  *
  * @param string $username The username to bind with.
  * @param string $password The password to bind with.
  * @param bool $anonymous Whether this is an anonymous bind attempt.
  * @throws LdapBindException
  */
 protected function bind($username, $password, $anonymous = false)
 {
     if ($anonymous) {
         $this->isBound = @ldap_bind($this->connection);
     } else {
         $this->isBound = @ldap_bind($this->connection, LdapUtilities::encode($username, $this->config->getEncoding()), LdapUtilities::encode($password, $this->config->getEncoding()));
     }
     if (!$this->isBound) {
         throw new LdapBindException(sprintf('Unable to bind to LDAP: %s', $this->getLastError()), $this->getExtendedErrorNumber());
     }
 }