Skip to content
Snippets Groups Projects
Commit c571d4be authored by Pavel Vyskočil's avatar Pavel Vyskočil
Browse files

Merge pull request #17 from Gaeldrin/fix-getAllowedAffiliations

fix for empty LDAP response in IsCesnetEligible::getAllowedAffiliations
parent 90c62492
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
[Fixed]
- Added verification for empty response from LDAP in IsCesnetEligible::getAllowedAffiliations which is valid state
## [v1.4.1] ## [v1.4.1]
[Fixed] [Fixed]
......
...@@ -139,12 +139,18 @@ class sspmod_cesnet_Auth_Process_IsCesnetEligible extends SimpleSAML_Auth_Proces ...@@ -139,12 +139,18 @@ class sspmod_cesnet_Auth_Process_IsCesnetEligible extends SimpleSAML_Auth_Proces
try { try {
$affiliations = $this->cesnetLdapConnector->searchForEntity(self::ORGANIZATION_LDAP_BASE,'(entityIDofIdP=' . $idpEntityId . ')', array( $affiliations = $this->cesnetLdapConnector->searchForEntity(self::ORGANIZATION_LDAP_BASE,'(entityIDofIdP=' . $idpEntityId . ')', array(
'cesnetcustomeraffiliation'))['cesnetcustomeraffiliation']; 'cesnetcustomeraffiliation'))['cesnetcustomeraffiliation'];
foreach ($affiliations as $affiliation) {
array_push($allowedAffiliations, $affiliation); if (empty($affiliations)) {
SimpleSAML\Logger::debug("cesnet:IsCesnetEligible - Received empty response from LDAP, entityId " . $idpEntityId . " was probably not found.");
} else {
foreach ($affiliations as $affiliation) {
array_push($allowedAffiliations, $affiliation);
}
} }
} catch (Exception $ex) { } catch (Exception $ex) {
SimpleSAML\Logger::warning("cesnet:IsCesnetEligible - Unable to connect to LDAP!"); SimpleSAML\Logger::warning("cesnet:IsCesnetEligible - Unable to connect to LDAP!");
} }
return $allowedAffiliations; return $allowedAffiliations;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment