|
11 | 11 | const ATTRIBUTES_DEFINITIONS = 'listOfSps.attributesDefinitions'; |
12 | 12 | const SHOW_OIDC_SERVICES = 'listOfSps.showOIDCServices'; |
13 | 13 |
|
| 14 | +const PERUN_SERVICE_NAME_ATTR_NAME = 'listOfSps.serviceNameAttr'; |
14 | 15 | const PERUN_PROXY_IDENTIFIER_ATTR_NAME = 'listOfSps.perunProxyIdentifierAttr'; |
15 | 16 | const PERUN_LOGIN_URL_ATTR_NAME = 'listOfSps.loginURLAttr'; |
16 | 17 | const PERUN_TEST_SP_ATTR_NAME = 'listOfSps.isTestSpAttr'; |
|
62 | 63 | ); |
63 | 64 | } |
64 | 65 |
|
| 66 | +$perunServiceNameAttr = $conf->getString(PERUN_SERVICE_NAME_ATTR_NAME, null); |
| 67 | +if (empty($perunServiceNameAttr)) { |
| 68 | + throw new Exception( |
| 69 | + 'perun:listOfSps: missing mandatory config option \'' |
| 70 | + . PERUN_SERVICE_NAME_ATTR_NAME . '\'.' |
| 71 | + ); |
| 72 | +} |
65 | 73 | $perunLoginURLAttr = $conf->getString(PERUN_LOGIN_URL_ATTR_NAME, null); |
66 | 74 | $perunTestSpAttr = $conf->getString(PERUN_TEST_SP_ATTR_NAME, null); |
67 | 75 | $perunShowOnServiceListAttr |
|
76 | 84 | $attrNames = []; |
77 | 85 |
|
78 | 86 | array_push($attrNames, $perunSaml2EntityIdAttr); |
| 87 | +array_push($attrNames, $perunServiceNameAttr); |
79 | 88 | if (!empty($perunOidcClientIdAttr)) { |
80 | 89 | array_push($attrNames, $perunOidcClientIdAttr); |
81 | 90 | } |
|
106 | 115 | if (!empty($facilityAttributes[$perunSaml2EntityIdAttr]['value'])) { |
107 | 116 | $samlServices[$facility->getId()] = [ |
108 | 117 | 'facility' => $facility, |
| 118 | + 'name' => $facilityAttributes[$perunServiceNameAttr], |
109 | 119 | 'loginURL' => $facilityAttributes[$perunLoginURLAttr], |
110 | 120 | 'showOnServiceList' => $facilityAttributes[$perunShowOnServiceListAttr], |
111 | 121 | 'facilityAttributes' => $facilityAttributes |
|
118 | 128 | if ($showOIDCServices && !empty($facilityAttributes[$perunOidcClientIdAttr]['value'])) { |
119 | 129 | $oidcServices[$facility->getId()] = [ |
120 | 130 | 'facility' => $facility, |
| 131 | + 'name' => $facilityAttributes[$perunServiceNameAttr], |
121 | 132 | 'loginURL' => $facilityAttributes[$perunLoginURLAttr], |
122 | 133 | 'showOnServiceList' => $facilityAttributes[$perunShowOnServiceListAttr], |
123 | 134 | 'facilityAttributes' => $facilityAttributes |
|
137 | 148 | $attributesToShow = []; |
138 | 149 | foreach ($attrNames as $attrName) { |
139 | 150 | if ($attrName !== $perunLoginURLAttr |
| 151 | + && $attrName !== $perunServiceNameAttr |
140 | 152 | && $attrName !== $perunShowOnServiceListAttr |
141 | 153 | && $attrName !== $perunTestSpAttr |
142 | 154 | && $attrName !== $perunOidcClientIdAttr |
|
161 | 173 | $json['statistics']['oidcTestServicesCount'] = $statistics['oidcTestServicesCount']; |
162 | 174 | foreach ($allServices as $service) { |
163 | 175 | $a = []; |
164 | | - $a['name'] = $service['facility']->getName(); |
| 176 | + $a['name'] = $service['facilityAttributes'][$perunServiceNameAttr]['value']; |
165 | 177 |
|
166 | 178 | if (array_key_exists($service['facility']->getID(), $samlServices)) { |
167 | 179 | $a['authenticationProtocol'] = 'SAML'; |
|
0 commit comments