48 parent::__construct(
$config, $reserved);
50 assert(
'is_array($config)');
56 if ($value ===
'%replace') {
57 $this->replace =
true;
58 } elseif ($value ===
'%keep') {
63 "AttributeValueMap: unknown configuration flag '".var_export($value,
true).
"'" 70 if (
$name ===
'targetattribute') {
71 $this->targetattribute = $value;
75 if (
$name ===
'sourceattribute') {
76 $this->sourceattribute = $value;
80 if (
$name ===
'values') {
81 $this->values = $value;
86 if (!is_string($this->sourceattribute)) {
87 throw new \SimpleSAML_Error_Exception(
"AttributeValueMap: 'sourceattribute' configuration option not set.");
89 if (!is_string($this->targetattribute)) {
90 throw new \SimpleSAML_Error_Exception(
"AttributeValueMap: 'targetattribute' configuration option not set.");
92 if (!is_array($this->values)) {
93 throw new \SimpleSAML_Error_Exception(
"AttributeValueMap: 'values' configuration option is not an array.");
107 assert(
'is_array($request)');
108 assert(
'array_key_exists("Attributes", $request)');
111 if (!array_key_exists($this->sourceattribute,
$attributes)) {
117 $targetvalues =
array();
120 foreach ($this->values as $value =>
$values) {
126 $targetvalues[] = $value;
131 if (count($targetvalues) > 0) {
132 if ($this->replace || !array_key_exists($this->targetattribute,
$attributes)) {
__construct($config, $reserved)
Initialize the filter.
$sourceattribute
The name of the attribute we should create values from.
process(&$request)
Apply filter.
$values
The required $sourceattribute values and target affiliations.
Create styles array
The data for the language used.
$replace
Whether $target attribute values should be replaced by new values or not.
$keep
Whether $sourceattribute should be kept or not.
$targetattribute
The name of the attribute we should assign values to (ie: the target attribute).