ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
AttributeNameID.php
Go to the documentation of this file.
1 <?php
2 
3 
10 {
11 
17  private $attribute;
18 
19 
28  public function __construct($config, $reserved)
29  {
30  parent::__construct($config, $reserved);
31  assert('is_array($config)');
32 
33  if (!isset($config['Format'])) {
34  throw new SimpleSAML_Error_Exception("AttributeNameID: Missing required option 'Format'.");
35  }
36  $this->format = (string) $config['Format'];
37 
38  if (!isset($config['attribute'])) {
39  throw new SimpleSAML_Error_Exception("AttributeNameID: Missing required option 'attribute'.");
40  }
41  $this->attribute = (string) $config['attribute'];
42  }
43 
44 
51  protected function getValue(array &$state)
52  {
53 
54  if (!isset($state['Attributes'][$this->attribute]) || count($state['Attributes'][$this->attribute]) === 0) {
56  'Missing attribute '.var_export($this->attribute, true).
57  ' on user - not generating attribute NameID.'
58  );
59  return null;
60  }
61  if (count($state['Attributes'][$this->attribute]) > 1) {
63  'More than one value in attribute '.var_export($this->attribute, true).
64  ' on user - not generating attribute NameID.'
65  );
66  return null;
67  }
68  $value = array_values($state['Attributes'][$this->attribute]); // just in case the first index is no longer 0
69  $value = $value[0];
70 
71  if (empty($value)) {
73  'Empty value in attribute '.var_export($this->attribute, true).
74  ' on user - not generating persistent NameID.'
75  );
76  return null;
77  }
78 
79  return $value;
80  }
81 
82 }
Add rich text string
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static warning($string)
Definition: Logger.php:179
Create styles array
The data for the language used.
__construct($config, $reserved)
Initialize this filter, parse configuration.
Write to Excel2007 format
getValue(array &$state)
Get the NameID value.