Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 5cde5ad

Browse files
committed
Log error when CESNET LDAP return more than one item in getAllowedAffiliations()
* Log error when CESNET LDAP return more than one item in getAllowedAffiliations() in IsCesnetEligible.php
1 parent 544148a commit 5cde5ad

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
#### Fixed
6+
- Log error when CESNET LDAP return more than one item in getAllowedAffiliations() in IsCesnetEligible.php
57

68
## [v2.3.0]
79
#### Changed

lib/Auth/Process/IsCesnetEligible.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,20 @@ private function getAllowedAffiliations($idpEntityId)
193193
$allowedAffiliations = [];
194194

195195
try {
196-
$affiliations = $this->cesnetLdapConnector->searchForEntity(
196+
$organization = $this->cesnetLdapConnector->searchForEntity(
197197
self::ORGANIZATION_LDAP_BASE,
198198
'(entityIDofIdP=' . $idpEntityId . ')',
199199
['cesnetcustomeraffiliation']
200-
)['cesnetcustomeraffiliation'];
200+
);
201201

202-
if (empty($affiliations)) {
202+
if (empty($organization)) {
203203
Logger::debug('cesnet:IsCesnetEligible - Received empty response from LDAP, entityId '
204204
. $idpEntityId . ' was probably not found.');
205+
} elseif (count($organization) > 1) {
206+
Logger::error('cesnet:IsCesnetEligible - Received more record from LDAP with entityId '
207+
. $idpEntityId . '.');
205208
} else {
209+
$affiliations = $organization['cesnetcustomeraffiliation'];
206210
foreach ($affiliations as $affiliation) {
207211
array_push($allowedAffiliations, $affiliation);
208212
}

0 commit comments

Comments
 (0)