Skip to content

Commit 896b373

Browse files
author
tchapi
committed
Fixups
1 parent 0291178 commit 896b373

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Services/LDAPAuth.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ final class LDAPAuth extends AbstractBasic
6767
* Indicates what to do with certificate.
6868
* see https://www.php.net/manual/en/ldap.constants.php#constant.ldap-opt-x-tls-require-cert
6969
*/
70-
private $cert_checking_strat;
70+
private $LDAPCertificateCheckingStrategy;
7171

7272
/**
7373
* Creates the backend object.
7474
*/
75-
public function __construct(ManagerRegistry $doctrine, Utils $utils, string $LDAPAuthUrl, string $LDAPDnPattern, string $LDAPMailAttribute, bool $autoCreate, string $LDAPCertificateCheckingStrategy)
75+
public function __construct(ManagerRegistry $doctrine, Utils $utils, string $LDAPAuthUrl, string $LDAPDnPattern, ?string $LDAPMailAttribute, bool $autoCreate, ?string $LDAPCertificateCheckingStrategy)
7676
{
7777
$this->LDAPAuthUrl = $LDAPAuthUrl;
7878
$this->LDAPDnPattern = $LDAPDnPattern;
7979
$this->LDAPMailAttribute = $LDAPMailAttribute ?? 'mail';
8080
$this->autoCreate = $autoCreate;
81-
$this->cert_checking_strat = $LDAPCertificateCheckingStrategy ?? "try";
81+
$this->LDAPCertificateCheckingStrategy = $LDAPCertificateCheckingStrategy ?? "try";
8282

8383
$this->doctrine = $doctrine;
8484
$this->utils = $utils;
@@ -94,7 +94,7 @@ public function __construct(ManagerRegistry $doctrine, Utils $utils, string $LDA
9494
*/
9595
protected function ldapOpen($username, $password)
9696
{
97-
switch ($this->cert_checking_strat) {
97+
switch ($this->LDAPCertificateCheckingStrategy) {
9898
case 'never':
9999
$cert_strategy = LDAP_OPT_X_TLS_NEVER;
100100
break;
@@ -111,7 +111,7 @@ protected function ldapOpen($username, $password)
111111
$cert_strategy = LDAP_OPT_X_TLS_TRY;
112112
break;
113113
default:
114-
error_log('Invalid certificate checking strategy: ' . $this->cert_checking_strat);
114+
error_log('Invalid certificate checking strategy: ' . $this->LDAPCertificateCheckingStrategy);
115115
return false;
116116
}
117117

@@ -120,6 +120,7 @@ protected function ldapOpen($username, $password)
120120

121121
return false;
122122
}
123+
123124
try {
124125
$ldap = ldap_connect($this->LDAPAuthUrl);
125126
} catch (\Exception $e) {

0 commit comments

Comments
 (0)