ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 {
52 parent::__construct($config, $reserved);
53 assert(is_array($config));
54
55 if (isset($config['NameQualifier'])) {
56 $this->nameQualifier = $config['NameQualifier'];
57 } else {
58 $this->nameQualifier = false;
59 }
60
61 if (isset($config['SPNameQualifier'])) {
62 $this->spNameQualifier = $config['SPNameQualifier'];
63 } else {
64 $this->spNameQualifier = true;
65 }
66 }
67
68
74 abstract protected function getValue(array &$state);
75
76
82 public function process(&$state)
83 {
84 assert(is_array($state));
85 assert(is_string($this->format));
86
87 $value = $this->getValue($state);
88 if ($value === null) {
89 return;
90 }
91
92 $nameId = new \SAML2\XML\saml\NameID();
93 $nameId->value = $value;
94
95 if ($this->nameQualifier === true) {
96 if (isset($state['IdPMetadata']['entityid'])) {
97 $nameId->NameQualifier = $state['IdPMetadata']['entityid'];
98 } else {
99 SimpleSAML\Logger::warning('No IdP entity ID, unable to set NameQualifier.');
100 }
101 } elseif (is_string($this->nameQualifier)) {
102 $nameId->NameQualifier = $this->nameQualifier;
103 }
104
105 if ($this->spNameQualifier === true) {
106 if (isset($state['SPMetadata']['entityid'])) {
107 $nameId->SPNameQualifier = $state['SPMetadata']['entityid'];
108 } else {
109 SimpleSAML\Logger::warning('No SP entity ID, unable to set SPNameQualifier.');
110 }
111 } elseif (is_string($this->spNameQualifier)) {
112 $nameId->SPNameQualifier = $this->spNameQualifier;
113 }
114
115 $state['saml:NameID'][$this->format] = $nameId;
116 }
117
118}
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:177
getValue(array &$state)
Get the NameID value.
__construct($config, $reserved)
Initialize this filter, parse configuration.
process(&$state)
Generate transient NameID.
$config
Definition: bootstrap.php:15
$nameId
Definition: saml2-acs.php:138