|
21 | 21 | $conf = Configuration::getConfig(CONFIG_FILE_NAME); |
22 | 22 |
|
23 | 23 | $proxyIdentifier = $conf->getString(PROXY_IDENTIFIER); |
24 | | -if ($proxyIdentifier === null || empty($proxyIdentifier)) { |
| 24 | +if (empty($proxyIdentifier)) { |
25 | 25 | throw new Exception( |
26 | 26 | "perun:listOfSps: missing mandatory config option '" . PROXY_IDENTIFIER |
27 | 27 | . "'." |
28 | 28 | ); |
29 | 29 | } |
30 | 30 |
|
31 | 31 | $perunProxyIdentifierAttr = $conf->getString(PERUN_PROXY_IDENTIFIER_ATTR_NAME); |
32 | | -if ($perunProxyIdentifierAttr === null || empty($perunProxyIdentifierAttr)) { |
| 32 | +if (empty($perunProxyIdentifierAttr)) { |
33 | 33 | throw new Exception( |
34 | 34 | "perun:listOfSps: missing mandatory config option '" |
35 | 35 | . PERUN_PROXY_IDENTIFIER_ATTR_NAME . "'." |
36 | 36 | ); |
37 | 37 | } |
38 | 38 |
|
39 | 39 | $attributesDefinitions = $conf->getArray(ATTRIBUTES_DEFINITIONS); |
40 | | -if ($attributesDefinitions === null || empty($attributesDefinitions)) { |
| 40 | +if (empty($attributesDefinitions)) { |
41 | 41 | throw new Exception( |
42 | 42 | "perun:listOfSps: missing mandatory config option '" |
43 | 43 | . ATTRIBUTES_DEFINITIONS . "'." |
|
46 | 46 |
|
47 | 47 | $showOIDCServices = $conf->getBoolean(SHOW_OIDC_SERVICES, false); |
48 | 48 | $perunSaml2EntityIdAttr = $conf->getString(PERUN_SAML2_ENTITY_ID_ATTR_NAME); |
49 | | -if ($perunSaml2EntityIdAttr === null || empty($perunSaml2EntityIdAttr)) { |
| 49 | +if (empty($perunSaml2EntityIdAttr)) { |
50 | 50 | throw new Exception( |
51 | 51 | "perun:listOfSps: missing mandatory config option '" |
52 | 52 | . PERUN_SAML2_ENTITY_ID_ATTR_NAME . "'." |
53 | 53 | ); |
54 | 54 | } |
55 | 55 |
|
56 | 56 | $perunOidcClientIdAttr = $conf->getString(PERUN_OIDC_CLIENT_ID_ATTR_NAME); |
57 | | -if ($showOIDCServices |
58 | | - && ($perunOidcClientIdAttr === null |
59 | | - || empty($perunOidcClientIdAttr)) |
60 | | -) { |
| 57 | +if ($showOIDCServices && empty($perunOidcClientIdAttr)) { |
61 | 58 | throw new Exception( |
62 | 59 | "perun:listOfSps: missing mandatory config option '" |
63 | 60 | . PERUN_OIDC_CLIENT_ID_ATTR_NAME . "'." |
|
78 | 75 | $attrNames = []; |
79 | 76 |
|
80 | 77 | array_push($attrNames, $perunSaml2EntityIdAttr); |
81 | | -if ($perunOidcClientIdAttr !== null && !empty($perunOidcClientIdAttr)) { |
| 78 | +if (!empty($perunOidcClientIdAttr)) { |
82 | 79 | array_push($attrNames, $perunOidcClientIdAttr); |
83 | 80 | } |
84 | | -if ($perunLoginURLAttr !== null && !empty($perunLoginURLAttr)) { |
| 81 | +if (!empty($perunLoginURLAttr)) { |
85 | 82 | array_push($attrNames, $perunLoginURLAttr); |
86 | 83 | } |
87 | | -if ($perunTestSpAttr !== null && !empty($perunTestSpAttr)) { |
| 84 | +if (!empty($perunTestSpAttr)) { |
88 | 85 | array_push($attrNames, $perunTestSpAttr); |
89 | 86 | } |
90 | | -if ($perunShowOnServiceListAttr !== null |
91 | | - && !empty($perunShowOnServiceListAttr) |
92 | | -) { |
| 87 | +if (!empty($perunShowOnServiceListAttr)) { |
93 | 88 | array_push($attrNames, $perunShowOnServiceListAttr); |
94 | 89 | } |
95 | 90 | foreach ($attributesDefinitions as $attributeDefinition) { |
|
107 | 102 | foreach ($attributes as $attribute) { |
108 | 103 | $facilityAttributes[$attribute['name']] = $attribute; |
109 | 104 | } |
110 | | - if ($facilityAttributes[$perunSaml2EntityIdAttr]['value'] !== null |
111 | | - && !empty($facilityAttributes[$perunSaml2EntityIdAttr]['value']) |
112 | | - ) { |
| 105 | + if (!empty($facilityAttributes[$perunSaml2EntityIdAttr]['value'])) { |
113 | 106 | $samlServices[$facility->getId()] = [ |
114 | 107 | 'facility' => $facility, |
115 | 108 | 'loginURL' => $facilityAttributes[$perunLoginURLAttr], |
|
121 | 114 | } |
122 | 115 | } |
123 | 116 |
|
124 | | - if ($showOIDCServices |
125 | | - && ($facilityAttributes[$perunOidcClientIdAttr]['value'] !== null |
126 | | - && !empty($facilityAttributes[$perunOidcClientIdAttr]['value'])) |
127 | | - ) { |
| 117 | + if ($showOIDCServices && !empty($facilityAttributes[$perunOidcClientIdAttr]['value'])) { |
128 | 118 | $oidcServices[$facility->getId()] = [ |
129 | 119 | 'facility' => $facility, |
130 | 120 | 'loginURL' => $facilityAttributes[$perunLoginURLAttr], |
|
0 commit comments