ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
StatisticsWithAttribute.php
Go to the documentation of this file.
1 <?php
2 
10 
11 
15  private $attribute = NULL;
16 
17  private $typeTag = 'saml20-idp-SSO';
18 
19 
26  public function __construct($config, $reserved) {
27  parent::__construct($config, $reserved);
28 
29  assert('is_array($config)');
30 
31  if (array_key_exists('attributename', $config)) {
32  $this->attribute = $config['attributename'];
33  if (!is_string($this->attribute)) {
34  throw new Exception('Invalid attribute name given to core:StatisticsWithAttribute filter.');
35  }
36  }
37 
38  if (array_key_exists('type', $config)) {
39  $this->typeTag = $config['type'];
40  if (!is_string($this->typeTag)) {
41  throw new Exception('Invalid typeTag given to core:StatisticsWithAttribute filter.');
42  }
43  }
44  }
45 
46 
52  public function process(&$state) {
53  assert('is_array($state)');
54  assert('array_key_exists("Attributes", $state)');
55 
56  $logAttribute = 'NA';
57  $source = 'NA';
58  $dest = 'NA';
59 
60  if (array_key_exists($this->attribute, $state['Attributes'])) $logAttribute = $state['Attributes'][$this->attribute][0];
61  if (array_key_exists('Source', $state)) {
62  if (isset($state['Source']['core:statistics-id'])) {
63  $source = $state['Source']['core:statistics-id'];
64  } else {
65  $source = $state['Source']['entityid'];
66  }
67  }
68 
69  if (array_key_exists('Destination', $state)) {
70  if (isset($state['Destination']['core:statistics-id'])) {
71  $dest = $state['Destination']['core:statistics-id'];
72  } else {
73  $dest = $state['Destination']['entityid'];
74  }
75  }
76 
77  if (!array_key_exists('PreviousSSOTimestamp', $state)) {
78  // The user hasn't authenticated with this SP earlier in this session
79  SimpleSAML\Logger::stats($this->typeTag . '-first ' . $dest . ' ' . $source . ' ' . $logAttribute);
80  }
81 
82  SimpleSAML\Logger::stats($this->typeTag . ' ' . $dest . ' ' . $source . ' ' . $logAttribute);
83  }
84 
85 }
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static stats($string)
Definition: Logger.php:224
__construct($config, $reserved)
Initialize this filter.
$source
Definition: linkback.php:22