ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
BaseNameIDGenerator.php
Go to the documentation of this file.
1<?php
2
9
20
21
32
33
41 protected $format;
42
43
50 public function __construct($config, $reserved) {
51 parent::__construct($config, $reserved);
52 assert('is_array($config)');
53
54 if (isset($config['NameQualifier'])) {
55 $this->nameQualifier = $config['NameQualifier'];
56 } else {
57 $this->nameQualifier = FALSE;
58 }
59
60 if (isset($config['SPNameQualifier'])) {
61 $this->spNameQualifier = $config['SPNameQualifier'];
62 } else {
63 $this->spNameQualifier = TRUE;
64 }
65 }
66
67
73 abstract protected function getValue(array &$state);
74
75
81 public function process(&$state) {
82 assert('is_array($state)');
83 assert('is_string($this->format)');
84
85 $value = $this->getValue($state);
86 if ($value === NULL) {
87 return;
88 }
89
90 $nameId = new \SAML2\XML\saml\NameID();
91 $nameId->value = $value;
92
93 if ($this->nameQualifier === TRUE) {
94 if (isset($state['IdPMetadata']['entityid'])) {
95 $nameId->NameQualifier = $state['IdPMetadata']['entityid'];
96 } else {
97 SimpleSAML\Logger::warning('No IdP entity ID, unable to set NameQualifier.');
98 }
99 } elseif (is_string($this->nameQualifier)) {
100 $nameId->NameQualifier = $this->nameQualifier;
101 }
102
103 if ($this->spNameQualifier === TRUE) {
104 if (isset($state['SPMetadata']['entityid'])) {
105 $nameId->SPNameQualifier = $state['SPMetadata']['entityid'];
106 } else {
107 SimpleSAML\Logger::warning('No SP entity ID, unable to set SPNameQualifier.');
108 }
109 } elseif (is_string($this->spNameQualifier)) {
110 $nameId->SPNameQualifier = $this->spNameQualifier;
111 }
112
113 $state['saml:NameID'][$this->format] = $nameId;
114 }
115
116}
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
An exception for terminatinating execution or to throw for unit testing.
static warning($string)
Definition: Logger.php:179
getValue(array &$state)
Get the NameID value.
__construct($config, $reserved)
Initialize this filter, parse configuration.
process(&$state)
Generate transient NameID.
$nameId
Definition: saml2-acs.php:138