ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\XML\saml\Attribute Class Reference
+ Inheritance diagram for SAML2\XML\saml\Attribute:
+ Collaboration diagram for SAML2\XML\saml\Attribute:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize an Attribute. More...
 
 toXML (\DOMElement $parent)
 Convert this Attribute to XML. More...
 

Data Fields

 $Name
 
 $NameFormat
 
 $FriendlyName = null
 
 $AttributeValue = array()
 

Protected Member Functions

 toXMLInternal (\DOMElement $parent, $namespace, $name)
 Internal implementation of toXML. More...
 

Detailed Description

Definition at line 13 of file Attribute.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\saml\Attribute::__construct ( \DOMElement  $xml = null)

Initialize an Attribute.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Exception

Reimplemented in SAML2\XML\md\RequestedAttribute.

Definition at line 51 of file Attribute.php.

52 {
53 if ($xml === null) {
54 return;
55 }
56
57 if (!$xml->hasAttribute('Name')) {
58 throw new \Exception('Missing Name on Attribute.');
59 }
60 $this->Name = $xml->getAttribute('Name');
61
62 if ($xml->hasAttribute('NameFormat')) {
63 $this->NameFormat = $xml->getAttribute('NameFormat');
64 }
65
66 if ($xml->hasAttribute('FriendlyName')) {
67 $this->FriendlyName = $xml->getAttribute('FriendlyName');
68 }
69
70 foreach (Utils::xpQuery($xml, './saml_assertion:AttributeValue') as $av) {
71 $this->AttributeValue[] = new AttributeValue($av);
72 }
73 }
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
$xml
Definition: metadata.php:240

References $xml, and SAML2\Utils\xpQuery().

+ Here is the call graph for this function:

Member Function Documentation

◆ toXML()

SAML2\XML\saml\Attribute::toXML ( \DOMElement  $parent)

Convert this Attribute to XML.

Parameters
\DOMElement$parentThe element we should append this Attribute to.
Returns
\DOMElement

Reimplemented in SAML2\XML\md\RequestedAttribute.

Definition at line 119 of file Attribute.php.

120 {
121 return $this->toXMLInternal($parent, Constants::NS_SAML, 'saml:Attribute');
122 }
const NS_SAML
The namespace for the SAML 2 assertions.
Definition: Constants.php:220
toXMLInternal(\DOMElement $parent, $namespace, $name)
Internal implementation of toXML.
Definition: Attribute.php:84

References SAML2\Constants\NS_SAML, and SAML2\XML\saml\Attribute\toXMLInternal().

+ Here is the call graph for this function:

◆ toXMLInternal()

SAML2\XML\saml\Attribute::toXMLInternal ( \DOMElement  $parent,
  $namespace,
  $name 
)
protected

Internal implementation of toXML.

This function allows RequestedAttribute to specify the element name and namespace.

Parameters
\DOMElement$parentThe element we should append this Attribute to.
string$namespaceThe namespace the element should be created in.
string$nameThe name of the element.
Returns
\DOMElement

Definition at line 84 of file Attribute.php.

85 {
86 assert(is_string($namespace));
87 assert(is_string($name));
88 assert(is_string($this->Name));
89 assert(is_null($this->NameFormat) || is_string($this->NameFormat));
90 assert(is_null($this->FriendlyName) || is_string($this->FriendlyName));
91 assert(is_array($this->AttributeValue));
92
93 $e = $parent->ownerDocument->createElementNS($namespace, $name);
94 $parent->appendChild($e);
95
96 $e->setAttribute('Name', $this->Name);
97
98 if (isset($this->NameFormat)) {
99 $e->setAttribute('NameFormat', $this->NameFormat);
100 }
101
102 if (isset($this->FriendlyName)) {
103 $e->setAttribute('FriendlyName', $this->FriendlyName);
104 }
105
106 foreach ($this->AttributeValue as $av) {
107 $av->toXML($e);
108 }
109
110 return $e;
111 }
if($err=$client->getError()) $namespace
if($format !==null) $name
Definition: metadata.php:146

References $name, and $namespace.

Referenced by SAML2\XML\md\RequestedAttribute\toXML(), and SAML2\XML\saml\Attribute\toXML().

+ Here is the caller graph for this function:

Field Documentation

◆ $AttributeValue

SAML2\XML\saml\Attribute::$AttributeValue = array()

Definition at line 43 of file Attribute.php.

◆ $FriendlyName

SAML2\XML\saml\Attribute::$FriendlyName = null

Definition at line 34 of file Attribute.php.

◆ $Name

SAML2\XML\saml\Attribute::$Name

Definition at line 20 of file Attribute.php.

◆ $NameFormat

SAML2\XML\saml\Attribute::$NameFormat

Definition at line 27 of file Attribute.php.


The documentation for this class was generated from the following file: