getUseTls() 공개 메소드

Get whether TLS will be used for the connection or not.
public getUseTls ( ) : boolean
리턴 boolean
예제 #1
0
 /**
  * Makes the initial connection to LDAP, sets connection options, and starts TLS if specified.
  *
  * @param null|string $server
  * @throws LdapConnectionException
  */
 protected function initiateLdapConnection($server = null)
 {
     list($ldapUrl, $server) = $this->getLdapUrl($server);
     $this->connection = @ldap_connect($ldapUrl);
     if (!$this->connection) {
         throw new LdapConnectionException(sprintf("Failed to initiate LDAP connection with URI: %s", $ldapUrl));
     }
     foreach ($this->config->getLdapOptions() as $option => $value) {
         if (!ldap_set_option($this->connection, $option, $value)) {
             throw new LdapConnectionException("Failed to set LDAP connection option.");
         }
     }
     if ($this->config->getUseTls() && !@ldap_start_tls($this->connection)) {
         throw new LdapConnectionException(sprintf("Failed to start TLS: %s", $this->getLastError()), $this->getExtendedErrorNumber());
     }
     $this->server = $server;
 }