33 parent::__construct(
$config, $reserved);
38 if (
$index ===
'default') {
39 $this->isDefault = (bool)$value;
40 } elseif (is_int(
$index)) {
41 if (!is_string($value)) {
43 var_export($value, TRUE));
45 $this->allowedAttributes[] = $value;
46 } elseif (is_string(
$index)) {
47 if (!is_array($value)) {
49 ' must be specified in an array.');
51 $this->allowedAttributes[
$index] = $value;
67 if (array_key_exists(
'attributes', $request[
'Destination'])) {
69 return $request[
'Destination'][
'attributes'];
71 if (array_key_exists(
'attributes', $request[
'Source'])) {
73 return $request[
'Source'][
'attributes'];
89 assert(array_key_exists(
'Attributes',
$request));
91 if ($this->isDefault) {
96 } elseif (!empty($this->allowedAttributes)) {
114 ' must be specified in an array.');
135 if (array_key_exists(
'regex', $allowedConfigValues) && $allowedConfigValues[
'regex'] ===
true) {
136 $matchedValues = array();
137 foreach ($allowedConfigValues as $option => $pattern) {
138 if (!is_int($option)) {
142 foreach ($values as
$index => $attributeValue) {
146 $regexResult = @preg_match($pattern, $attributeValue);
147 if ($regexResult ===
false) {
150 } elseif ($regexResult === 1) {
151 $matchedValues[] = $attributeValue;
157 return $matchedValues;
158 } elseif (array_key_exists(
'ignoreCase', $allowedConfigValues) && $allowedConfigValues[
'ignoreCase'] ===
true) {
159 unset($allowedConfigValues[
'ignoreCase']);
160 return array_uintersect($values, $allowedConfigValues,
"strcasecmp");
163 unset($allowedConfigValues[
'ignoreCase']);
164 unset($allowedConfigValues[
'regex']);
166 return array_intersect($values, $allowedConfigValues);
foreach($paths as $path) $request
static getSPIdPAllowed(array &$request)
Get list of allowed from the SP/IdP config.
process(&$request)
Apply filter to remove attributes.
if(array_key_exists('yes', $_REQUEST)) $attributes
$allowedAttributes
List of attributes which this filter will allow through.
__construct($config, $reserved)
Initialize this filter.
filterAttributeValues(array $values, array $allowedConfigValues)
Perform the filtering of attributes.