@@ -287,8 +287,11 @@ public function getFacilitiesByEntityId($spEntityId)
287287 public function getFacilityByEntityId ($ spEntityId , $ entityIdAttr = 'perunFacilityAttr_entityID ' )
288288 {
289289 $ attrName = AttributeUtils::getLdapAttrName ($ entityIdAttr );
290- if (empty ($ attributeName )) {
291- throw new Exception ("No attribute configuration in LDAP found for attribute $ {entityIdAttr}" );
290+ if (empty ($ attrName )) {
291+ $ attrName = 'entityID ' ;
292+ Logger::warning (
293+ "No attribute configuration in LDAP found for attribute $ {entityIdAttr}, using $ {attrName} as fallback value "
294+ );
292295 }
293296 $ ldapResult = $ this ->connector ->searchForEntity (
294297 $ this ->ldapBase ,
@@ -301,21 +304,22 @@ public function getFacilityByEntityId($spEntityId, $entityIdAttr = 'perunFacilit
301304 return null ;
302305 }
303306
304- $ facility = new Facility (
307+ return new Facility (
305308 $ ldapResult [self ::PERUN_FACILITY_ID ][0 ],
306309 $ ldapResult [self ::CN ][0 ],
307310 $ ldapResult [self ::DESCRIPTION ][0 ],
308311 $ spEntityId
309312 );
310-
311- return $ facility ;
312313 }
313314
314315 public function getFacilityByClientId ($ clientId , $ clientIdAttr = 'perunFacilityAttr_OIDCClientID ' )
315316 {
316317 $ attrName = AttributeUtils::getLdapAttrName ($ clientIdAttr );
317- if (empty ($ attributeName )) {
318- throw new Exception ("No attribute configuration in LDAP found for attribute $ {clientIdAttr}" );
318+ if (empty ($ attrName )) {
319+ $ attrName = 'OIDCClientID ' ;
320+ Logger::warning (
321+ "No attribute configuration in LDAP found for attribute $ {clientIdAttr}, using $ {attrName} as fallback value "
322+ );
319323 }
320324 $ ldapResult = $ this ->connector ->searchForEntity (
321325 $ this ->ldapBase ,
@@ -328,14 +332,12 @@ public function getFacilityByClientId($clientId, $clientIdAttr = 'perunFacilityA
328332 return null ;
329333 }
330334
331- $ facility = new Facility (
335+ return new Facility (
332336 $ ldapResult [self ::PERUN_FACILITY_ID ][0 ],
333337 $ ldapResult [self ::CN ][0 ],
334338 $ ldapResult [self ::DESCRIPTION ][0 ],
335339 $ clientId
336340 );
337-
338- return $ facility ;
339341 }
340342
341343 public function getEntitylessAttribute ($ attrName )
0 commit comments