mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Added support for STARTTLS with LDAP
New config value 'ldap.start-tls' (defaults to false) for STARTTLS support over LDAP
This commit is contained in:
parent
da6296a176
commit
c7c25e141a
2 changed files with 14 additions and 0 deletions
|
@ -712,6 +712,9 @@ return array(
|
|||
// The password of the LDAP anonymous user.
|
||||
'ldap.anonymous-user-password' => null,
|
||||
|
||||
// Whether to use STARTTLS
|
||||
'ldap.start-tls' => false,
|
||||
|
||||
|
||||
// -- Disqus OAuth ---------------------------------------------------------- //
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ final class PhabricatorLDAPProvider {
|
|||
return PhabricatorEnv::getEnvConfig('ldap.referrals');
|
||||
}
|
||||
|
||||
public function getLDAPStartTLS() {
|
||||
return PhabricatorEnv::getEnvConfig('ldap.start-tls');
|
||||
}
|
||||
|
||||
public function bindAnonymousUserEnabled() {
|
||||
return strlen(trim($this->getAnonymousUserName())) > 0;
|
||||
}
|
||||
|
@ -114,6 +118,13 @@ final class PhabricatorLDAPProvider {
|
|||
$this->getLDAPVersion());
|
||||
ldap_set_option($this->connection, LDAP_OPT_REFERRALS,
|
||||
$this->getLDAPReferrals());
|
||||
|
||||
if ($this->getLDAPStartTLS()) {
|
||||
if (!ldap_start_tls($this->getConnection())) {
|
||||
throw new Exception('Unabled to initialize STARTTLS for LDAP host at '.
|
||||
$this->getHostname().':'.$this->getPort());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->connection;
|
||||
|
|
Loading…
Reference in a new issue