From f4805e01b67051576d54271ec6209dec5c6686c3 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sun, 7 Apr 2024 21:44:39 +0200 Subject: [PATCH] Fix --- src/Auth/Source/X509userCert.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Auth/Source/X509userCert.php b/src/Auth/Source/X509userCert.php index a3f9920..3ac4eed 100644 --- a/src/Auth/Source/X509userCert.php +++ b/src/Auth/Source/X509userCert.php @@ -202,7 +202,11 @@ public function authenticate(array &$state): void throw new Exception("Should never be reached"); } - $ldap_certs = array_map([$entry, 'getAttribute'], $this->ldapusercert); + $ldap_certs = []; + foreach ($this->ldapusercert as $attr) { + $ldap_certs[$attr] = $entry->getAttribute($attr); + } + if (empty($ldap_certs)) { Logger::error('authX509: no certificate found in LDAP for dn=' . $dn); $state['authX509.error'] = "UNKNOWNCERT"; @@ -214,7 +218,7 @@ public function authenticate(array &$state): void $merged_ldapcerts = []; foreach ($this->ldapusercert as $attr) { - $merged_ldapcerts = array_merge($merged_ldapcerts, $ldap_certs[0][$attr]); + $merged_ldapcerts = array_merge($merged_ldapcerts, $ldap_certs[$attr]); } $ldap_certs = $merged_ldapcerts;