|
2 | 2 |
|
3 | 3 | namespace SimpleSAML\Module\perun\Auth\Process; |
4 | 4 |
|
| 5 | +use SimpleSAML\Auth\ProcessingFilter; |
5 | 6 | use SimpleSAML\Error\Exception; |
6 | 7 | use SimpleSAML\Module\perun\Adapter; |
7 | | -use SimpleSAML\Module\perun\AttributeUtils; |
8 | 8 | use SimpleSAML\Module\perun\model; |
9 | 9 | use SimpleSAML\Logger; |
10 | 10 | use SimpleSAML\Auth\State; |
|
27 | 27 | * |
28 | 28 | * It relies on PerunIdentity filter. Configure it before this filter properly. |
29 | 29 | */ |
30 | | -class ForceAup extends \SimpleSAML\Auth\ProcessingFilter |
| 30 | +class ForceAup extends ProcessingFilter |
31 | 31 | { |
32 | 32 |
|
33 | 33 | const UID_ATTR = 'uidAttr'; |
34 | 34 | const INTERFACE_PROPNAME = 'interface'; |
35 | 35 | const PERUN_AUPS_ATTR = 'perunAupsAttr'; |
36 | 36 | const PERUN_USER_AUP_ATTR = 'perunUserAupAttr'; |
37 | 37 | const PERUN_VO_AUP_ATTR = 'perunVoAupAttr'; |
38 | | - const PERUN_FACILITY_REQ_AUPS_ATTR = 'facilityReqAupsAttr'; |
39 | | - const PERUN_FACILITY_VO_SHORT_NAMES_ATTR = 'facilityVoShortNamesAttr'; |
| 38 | + const PERUN_FACILITY_REQ_AUPS_ATTR = 'perunFacilityReqAupsAttr'; |
| 39 | + const PERUN_FACILITY_VO_SHORT_NAMES_ATTR = 'perunFacilityVoShortNamesAttr'; |
40 | 40 |
|
41 | 41 | private $uidAttr; |
42 | 42 | private $perunAupsAttr; |
43 | 43 | private $perunUserAupAttr; |
44 | 44 | private $perunVoAupAttr; |
45 | 45 | private $perunFacilityReqAupsAttr; |
46 | 46 | private $perunFacilityVoShortNames; |
47 | | - private $interface; |
48 | 47 |
|
49 | 48 | /** |
50 | 49 | * @var Adapter |
@@ -83,18 +82,11 @@ public function __construct($config, $reserved) |
83 | 82 | $this->perunAupsAttr = (string)$config[self::PERUN_AUPS_ATTR]; |
84 | 83 | $this->perunUserAupAttr = (string)$config[self::PERUN_USER_AUP_ATTR]; |
85 | 84 | $this->perunVoAupAttr = (string)$config[self::PERUN_VO_AUP_ATTR]; |
86 | | - $this->interface = (string)$config[self::INTERFACE_PROPNAME]; |
87 | | - $this->adapter = Adapter::getInstance($this->interface); |
88 | | - |
89 | | - $this->perunFacilityReqAupsAttr = AttributeUtils::getAttrName( |
90 | | - self::PERUN_FACILITY_REQ_AUPS_ATTR, |
91 | | - $this->interface |
92 | | - ); |
93 | | - |
94 | | - $this->perunFacilityVoShortNames = AttributeUtils::getAttrName( |
95 | | - self::PERUN_FACILITY_VO_SHORT_NAMES_ATTR, |
96 | | - $this->interface |
97 | | - ); |
| 85 | + $interface = (string)$config[self::INTERFACE_PROPNAME]; |
| 86 | + $this->adapter = Adapter::getInstance($interface); |
| 87 | + |
| 88 | + $this->perunFacilityReqAupsAttr = (string)$config[self::PERUN_FACILITY_REQ_AUPS_ATTR]; |
| 89 | + $this->perunFacilityVoShortNames = (string)$config[self::PERUN_FACILITY_VO_SHORT_NAMES_ATTR]; |
98 | 90 | } |
99 | 91 |
|
100 | 92 | /** |
@@ -129,19 +121,19 @@ public function process(&$request) |
129 | 121 |
|
130 | 122 | $facilityAttrValues = $this->adapter->getFacilityAttributesValues( |
131 | 123 | $facility, |
132 | | - [self::PERUN_FACILITY_REQ_AUPS_ATTR, self::PERUN_FACILITY_VO_SHORT_NAMES_ATTR] |
| 124 | + [$this->perunFacilityReqAupsAttr, $this->perunFacilityVoShortNames] |
133 | 125 | ); |
134 | 126 |
|
135 | 127 | if (isset($this->perunFacilityReqAupsAttr, $facilityAttrValues) && |
136 | 128 | is_array($facilityAttrValues[$this->perunFacilityReqAupsAttr])) { |
137 | | - foreach ($facilityAttrValues[$this->perunFacilityReqAupsAttr] as $facilityAup) { |
| 129 | + foreach (array_values($facilityAttrValues[$this->perunFacilityReqAupsAttr]) as $facilityAup) { |
138 | 130 | array_push($requiredAups, $facilityAup); |
139 | 131 | } |
140 | 132 | } |
141 | 133 |
|
142 | 134 | if (isset($this->perunFacilityVoShortNames, $facilityAttrValues) && |
143 | 135 | is_array($facilityAttrValues[$this->perunFacilityVoShortNames])) { |
144 | | - foreach ($facilityAttrValues[$this->perunFacilityVoShortNames] as $facilityVoShortName) { |
| 136 | + foreach (array_values($facilityAttrValues[$this->perunFacilityVoShortNames]) as $facilityVoShortName) { |
145 | 137 | array_push($voShortNames, $facilityVoShortName); |
146 | 138 | } |
147 | 139 | } |
|
0 commit comments