|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* SAML NameIDType abstract data type. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Jaime Pérez Crespo, UNINETT AS <[email protected]> |
|
6
|
|
|
* @package simplesamlphp/saml2 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace SAML2\XML\saml; |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
abstract class NameIDType extends BaseIDType |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* A URI reference representing the classification of string-based identifier information. See Section 8.3 for the |
|
16
|
|
|
* SAML-defined URI references that MAY be used as the value of the Format attribute and their associated |
|
17
|
|
|
* descriptions and processing rules. Unless otherwise specified by an element based on this type, if no Format |
|
18
|
|
|
* value is provided, then the value urn:oasis:names:tc:SAML:1.0:nameid-format:unspecified (see Section 8.3.1) is in |
|
19
|
|
|
* effect. |
|
20
|
|
|
* |
|
21
|
|
|
* When a Format value other than one specified in Section 8.3 is used, the content of an element of this type is to |
|
22
|
|
|
* be interpreted according to the definition of that format as provided outside of this specification. If not |
|
23
|
|
|
* otherwise indicated by the definition of the format, issues of anonymity, pseudonymity, and the persistence of |
|
24
|
|
|
* the identifier with respect to the asserting and relying parties are implementation-specific. |
|
25
|
|
|
* |
|
26
|
|
|
* @var string|null |
|
27
|
|
|
* |
|
28
|
|
|
* @see saml-core-2.0-os |
|
29
|
|
|
*/ |
|
30
|
|
|
public $Format = null; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* A name identifier established by a service provider or affiliation of providers for the entity, if different from |
|
34
|
|
|
* the primary name identifier given in the content of the element. This attribute provides a means of integrating |
|
35
|
|
|
* the use of SAML with existing identifiers already in use by a service provider. For example, an existing |
|
36
|
|
|
* identifier can be "attached" to the entity using the Name Identifier Management protocol defined in Section 3.6. |
|
37
|
|
|
* |
|
38
|
|
|
* @var string|null |
|
39
|
|
|
* |
|
40
|
|
|
* @see saml-core-2.0-os |
|
41
|
|
|
*/ |
|
42
|
|
|
public $SPProvidedID = null; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* The NameIDType complex type is used when an element serves to represent an entity by a string-valued name. |
|
46
|
|
|
* |
|
47
|
|
|
* @var string|null |
|
48
|
|
|
*/ |
|
49
|
|
|
public $value = null; |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Initialize a saml:NameIDType, either from scratch or from an existing \DOMElement. |
|
54
|
|
|
* |
|
55
|
|
|
* @param \DOMElement|null $xml The XML element we should load, if any. |
|
56
|
|
|
*/ |
|
57
|
|
|
public function __construct(\DOMElement $xml = null) |
|
58
|
|
|
{ |
|
59
|
|
|
parent::__construct($xml); |
|
60
|
|
|
|
|
61
|
|
|
if ($xml === null) { |
|
62
|
|
|
return; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
if ($xml->hasAttribute('Format')) { |
|
66
|
|
|
$this->Format = $xml->getAttribute('Format'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
if ($xml->hasAttribute('SPProvidedID')) { |
|
70
|
|
|
$this->SPProvidedID = $xml->getAttribute('SPProvidedID'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
$this->value = trim($xml->textContent); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Convert this NameIDType to XML. |
|
79
|
|
|
* |
|
80
|
|
|
* @param \DOMElement $element The element we are converting to XML. |
|
|
|
|
|
|
81
|
|
|
* |
|
82
|
|
|
* @return \DOMElement The XML element after adding the data corresponding to this NameIDType. |
|
83
|
|
|
*/ |
|
84
|
|
|
public function toXML(\DOMElement $parent = null) |
|
85
|
|
|
{ |
|
86
|
|
|
assert('is_string($this->Format) || is_null($this->Format)'); |
|
87
|
|
|
assert('is_string($this->SPProvidedID) || is_null($this->SPProvidedID)'); |
|
88
|
|
|
assert('is_string($this->value)'); |
|
89
|
|
|
|
|
90
|
|
|
$element = parent::toXML($parent); |
|
91
|
|
|
|
|
92
|
|
|
if ($this->Format !== null) { |
|
93
|
|
|
$element->setAttribute('Format', $this->Format); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
if ($this->SPProvidedID !== null) { |
|
97
|
|
|
$element->setAttribute('SPProvidedID', $this->SPProvidedID); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
$value = $element->ownerDocument->createTextNode($this->value); |
|
101
|
|
|
$element->appendChild($value); |
|
102
|
|
|
|
|
103
|
|
|
return $element; |
|
104
|
|
|
} |
|
105
|
|
|
} |
|
106
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.