1515use SimpleSAML \XHTML \Template ;
1616use Symfony \Component \HttpFoundation \Request ;
1717
18+ use function array_key_exists ;
19+ use function in_array ;
20+ use function is_array ;
21+ use function is_string ;
22+ use function sprintf ;
23+ use function strpos ;
24+ use function substr ;
25+
1826/**
1927 * Controller class for the consentadmin module.
2028 *
@@ -138,9 +146,9 @@ public function main(Request $request): Template
138146 $ as ->logout ($ returnURL );
139147 }
140148
141- $ hashAttributes = $ this ->moduleConfig ->getValue ('attributes.hash ' , false );
149+ $ hashAttributes = $ this ->moduleConfig ->getOptionalValue ('attributes.hash ' , false );
142150
143- $ excludeAttributes = $ this ->moduleConfig ->getValue ('attributes.exclude ' , []);
151+ $ excludeAttributes = $ this ->moduleConfig ->getOptionalValue ('attributes.exclude ' , []);
144152
145153 // Check if valid local session exists
146154 $ as ->requireAuth ();
@@ -167,12 +175,7 @@ public function main(Request $request): Template
167175 }
168176
169177 // Get user ID
170- if (isset ($ idp_metadata ['userid.attribute ' ]) && is_string ($ idp_metadata ['userid.attribute ' ])) {
171- $ userid_attributename = $ idp_metadata ['userid.attribute ' ];
172- } else {
173- $ userid_attributename = 'eduPersonPrincipalName ' ;
174- }
175-
178+ $ userid_attributename = $ cA_config ->getOptionalString ('identifyingAttribute ' , 'eduPersonPrincipalName ' );
176179 $ userids = $ attributes [$ userid_attributename ];
177180
178181 if (empty ($ userids )) {
@@ -187,8 +190,8 @@ public function main(Request $request): Template
187190 // Get all SP metadata
188191 $ all_sp_metadata = $ metadata ->getList ('saml20-sp-remote ' );
189192
190- $ sp_entityid = $ request ->get ('cv ' );;
191- $ action = $ request ->get ('action ' );
193+ $ sp_entityid = $ request ->query -> get ('cv ' );;
194+ $ action = $ request ->query -> get ('action ' );
192195
193196 Logger::notice ('consentAdmin: sp: ' . $ sp_entityid . ' action: ' . $ action );
194197
@@ -297,17 +300,6 @@ public function main(Request $request): Template
297300 $ sp_status = "none " ;
298301 }
299302
300- // Set name of SP
301- if (isset ($ sp_values ['name ' ]) && is_array ($ sp_values ['name ' ])) {
302- $ sp_name = $ sp_metadata ['name ' ];
303- } elseif (isset ($ sp_values ['name ' ]) && is_string ($ sp_values ['name ' ])) {
304- $ sp_name = $ sp_metadata ['name ' ];
305- } elseif (isset ($ sp_values ['OrganizationDisplayName ' ]) && is_array ($ sp_values ['OrganizationDisplayName ' ])) {
306- $ sp_name = $ sp_metadata ['OrganizationDisplayName ' ];
307- } else {
308- $ sp_name = $ sp_entityid ;
309- }
310-
311303 // Set description of SP
312304 $ sp_description = null ;
313305 if (!empty ($ sp_metadata ['description ' ]) && is_array ($ sp_metadata ['description ' ])) {
@@ -320,7 +312,7 @@ public function main(Request $request): Template
320312 // Fill out array for the template
321313 $ sp_list [$ sp_entityid ] = [
322314 'spentityid ' => $ sp_entityid ,
323- 'name ' => $ sp_name ,
315+ 'name ' => $ template -> getEntityDisplayName ( $ sp_metadata ) ,
324316 'description ' => $ sp_description ,
325317 'consentStatus ' => $ sp_status ,
326318 'consentValue ' => $ sp_entityid ,
0 commit comments