1111 * comment them out or in case of automated metadata fetching configure blacklist in config-metarefresh.php
1212 *
1313 * @author Ondrej Velisek <ondrejvelisek@gmail.com>
14+ * @author Pavel Vyskocil <vyskocilpavel@muni.cz>
1415 */
1516class sspmod_perun_Disco extends sspmod_discopower_PowerIdPDisco
1617{
1718 const CONFIG_FILE_NAME = 'module_perun.php ' ;
1819 const PROPNAME_DISABLE_WHITELISTING = 'disco.disableWhitelisting ' ;
1920
2021 private $ originalsp ;
22+ private $ whitelist ;
23+ private $ greylist ;
24+ private $ service ;
2125
2226 public function __construct (array $ metadataSets , $ instance )
2327 {
@@ -27,6 +31,9 @@ public function __construct(array $metadataSets, $instance)
2731 $ id = explode (": " , $ query ['AuthID ' ])[0 ];
2832 $ state = SimpleSAML_Auth_State::loadState ($ id , 'saml:sp:sso ' );
2933 $ this ->originalsp = $ state ['SPMetadata ' ];
34+ $ this ->service = new sspmod_perun_IdpListsServiceCsv ();
35+ $ this ->whitelist = $ this ->service ->listToArray ("whitelist " );
36+ $ this ->greylist = $ this ->service ->listToArray ("greylist " );
3037 }
3138
3239
@@ -115,10 +122,10 @@ protected function scoping($list)
115122
116123 protected function whitelisting ($ list )
117124 {
118- $ service = new sspmod_perun_IdpListsServiceCsv ();
119125 foreach ($ list as $ entityId => $ idp ) {
120126 $ unset = true ;
121- if ($ service ->isWhitelisted ($ entityId )) {
127+
128+ if (in_array ($ entityId , $ this ->whitelist )){
122129 $ unset = false ;
123130 }
124131 if (isset ($ idp ['EntityAttributes ' ]['http://macedir.org/entity-category-support ' ])) {
@@ -149,9 +156,8 @@ protected function whitelisting($list)
149156
150157 protected function greylisting ($ list )
151158 {
152- $ service = new sspmod_perun_IdpListsServiceCsv ();
153159 foreach ($ list as $ entityId => $ idp ) {
154- if ($ service -> isGreylisted ($ entityId )) {
160+ if (in_array ($ entityId, $ this -> greylist )) {
155161 unset($ list [$ entityId ]);
156162 }
157163 }
0 commit comments