Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit d18a9d6

Browse files
committed
Added filter for RemoveAllAttributes
1 parent 119d7d4 commit d18a9d6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

lib/Auth/Process/RemoveAllAttributes.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,41 @@
66
* Because the attributes should not depends on IdP which user currently used.
77
*
88
* @author Ondrej Velisek <[email protected]>
9+
* @author Pavel Vyskočil <[email protected]>
910
*/
10-
1111
class sspmod_perun_Auth_Process_RemoveAllAttributes extends SimpleSAML_Auth_ProcessingFilter
1212
{
1313

14+
const FILTER_ATTRIBUTE_LIST = "filterAttributeList";
15+
16+
private $filterAttributeList = array();
17+
1418
public function __construct($config, $reserved)
1519
{
1620
parent::__construct($config, $reserved);
21+
22+
if (isset($config[self::FILTER_ATTRIBUTE_LIST])) {
23+
$this->filterAttributeList = $config[self::FILTER_ATTRIBUTE_LIST];
24+
}
1725
}
1826

1927
public function process(&$request)
2028
{
2129
assert('is_array($request)');
2230

31+
$attributes = array();
32+
33+
foreach ($request['Attributes'] as $attributeKey => $attributeValue) {
34+
if (in_array($attributeKey, $this->filterAttributeList)) {
35+
$attributes[$attributeKey] = $attributeValue;
36+
}
37+
}
38+
2339
$request['Attributes'] = array();
40+
41+
foreach ($attributes as $attributeKey => $attributeValue) {
42+
$request['Attributes'][$attributeKey] = $attributeValue;
43+
}
2444
}
2545

2646
}

0 commit comments

Comments
 (0)