summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/XML
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
committerOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
commit6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc (patch)
treef1d6c78ab5e2eec5f8b8121f9e1a838c28997fa6 /lib/SAML2/XML
parente9c98e008ed7dbb5d642aa4788edd2510c952ca1 (diff)
downloadsimplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.zip
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.gz
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.bz2
Start using SAML2 library from GitHub.
This patch also starts using Composer for other dependencies (i.e. php-openid and xmlseclibs). Thanks to Boy Baukema for implementing this! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3290 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SAML2/XML')
-rw-r--r--lib/SAML2/XML/Chunk.php104
-rw-r--r--lib/SAML2/XML/ds/KeyInfo.php94
-rw-r--r--lib/SAML2/XML/ds/KeyName.php45
-rw-r--r--lib/SAML2/XML/ds/X509Certificate.php45
-rw-r--r--lib/SAML2/XML/ds/X509Data.php74
-rw-r--r--lib/SAML2/XML/md/AdditionalMetadataLocation.php62
-rw-r--r--lib/SAML2/XML/md/AffiliationDescriptor.php162
-rw-r--r--lib/SAML2/XML/md/AttributeAuthorityDescriptor.php128
-rw-r--r--lib/SAML2/XML/md/AttributeConsumingService.php124
-rw-r--r--lib/SAML2/XML/md/AuthnAuthorityDescriptor.php94
-rw-r--r--lib/SAML2/XML/md/ContactPerson.php182
-rw-r--r--lib/SAML2/XML/md/EndpointType.php187
-rw-r--r--lib/SAML2/XML/md/EntitiesDescriptor.php147
-rw-r--r--lib/SAML2/XML/md/EntityDescriptor.php252
-rw-r--r--lib/SAML2/XML/md/Extensions.php62
-rw-r--r--lib/SAML2/XML/md/IDPSSODescriptor.php145
-rw-r--r--lib/SAML2/XML/md/IndexedEndpointType.php71
-rw-r--r--lib/SAML2/XML/md/KeyDescriptor.php97
-rw-r--r--lib/SAML2/XML/md/Organization.php105
-rw-r--r--lib/SAML2/XML/md/PDPDescriptor.php94
-rw-r--r--lib/SAML2/XML/md/RequestedAttribute.php54
-rw-r--r--lib/SAML2/XML/md/RoleDescriptor.php208
-rw-r--r--lib/SAML2/XML/md/SPSSODescriptor.php107
-rw-r--r--lib/SAML2/XML/md/SSODescriptorType.php114
-rw-r--r--lib/SAML2/XML/md/UnknownRoleDescriptor.php41
-rw-r--r--lib/SAML2/XML/mdattr/EntityAttributes.php72
-rw-r--r--lib/SAML2/XML/mdrpi/Common.php14
-rw-r--r--lib/SAML2/XML/mdrpi/PublicationInfo.php102
-rw-r--r--lib/SAML2/XML/mdrpi/RegistrationInfo.php86
-rw-r--r--lib/SAML2/XML/mdui/DiscoHints.php106
-rw-r--r--lib/SAML2/XML/mdui/Keywords.php80
-rw-r--r--lib/SAML2/XML/mdui/Logo.php94
-rw-r--r--lib/SAML2/XML/mdui/UIInfo.php154
-rw-r--r--lib/SAML2/XML/saml/Attribute.php121
-rw-r--r--lib/SAML2/XML/saml/AttributeValue.php99
-rw-r--r--lib/SAML2/XML/saml/NameID.php125
-rw-r--r--lib/SAML2/XML/saml/SubjectConfirmation.php93
-rw-r--r--lib/SAML2/XML/saml/SubjectConfirmationData.php146
-rw-r--r--lib/SAML2/XML/samlp/Extensions.php48
-rw-r--r--lib/SAML2/XML/shibmd/Scope.php74
40 files changed, 0 insertions, 4212 deletions
diff --git a/lib/SAML2/XML/Chunk.php b/lib/SAML2/XML/Chunk.php
deleted file mode 100644
index 9f614d3..0000000
--- a/lib/SAML2/XML/Chunk.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/**
- * Serializable class used to hold an XML element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_Chunk {
-
- /**
- * The localName of the element.
- *
- * @var string
- */
- public $localName;
-
-
- /**
- * The namespaceURI of this element.
- *
- * @var string
- */
- public $namespaceURI;
-
-
- /**
- * The DOMElement we contain.
- *
- * @var DOMElement
- */
- private $xml;
-
-
- /**
- * The DOMElement as a text string. Used during serialization.
- *
- * @var string|NULL
- */
- private $xmlString;
-
-
- /**
- * Create a XMLChunk from a copy of the given DOMElement.
- *
- * @param DOMElement $xml The element we should copy.
- */
- public function __construct(DOMElement $xml) {
-
- $this->localName = $xml->localName;
- $this->namespaceURI = $xml->namespaceURI;
-
- $this->xml = SAML2_Utils::copyElement($xml);
- }
-
-
- /**
- * Get this DOMElement.
- *
- * @return DOMElement This element.
- */
- public function getXML() {
- assert('$this->xml instanceof DOMElement || is_string($this->xmlString)');
-
- if ($this->xml === NULL) {
- $doc = new DOMDocument();
- $doc->loadXML($this->xmlString);
- $this->xml = $doc->firstChild;
- }
-
- return $this->xml;
- }
-
-
- /**
- * Append this XML element to a different XML element.
- *
- * @param DOMElement $parent The element we should append this element to.
- * @return DOMElement The new element.
- */
- public function toXML(DOMElement $parent) {
-
- return SAML2_Utils::copyElement($this->getXML(), $parent);
- }
-
-
- /**
- * Serialization handler.
- *
- * Converts the XML data to a string that can be serialized
- *
- * @return array List of properties that should be serialized.
- */
- public function __sleep() {
- assert('$this->xml instanceof DOMElement || is_string($this->xmlString)');
-
- if ($this->xmlString === NULL) {
- $this->xmlString = $this->xml->ownerDocument->saveXML($this->xml);
- }
-
- return array('xmlString', 'localName', 'namespaceURI');
- }
-
-}
diff --git a/lib/SAML2/XML/ds/KeyInfo.php b/lib/SAML2/XML/ds/KeyInfo.php
deleted file mode 100644
index 44b4b0d..0000000
--- a/lib/SAML2/XML/ds/KeyInfo.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * Class representing a ds:KeyInfo element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_ds_KeyInfo {
-
- /**
- * The Id attribute on this element.
- *
- * @var string|NULL
- */
- public $Id = NULL;
-
-
- /**
- * The various key information elements.
- *
- * Array with various elements describing this key.
- * Unknown elements will be represented by SAML2_XML_Chunk.
- *
- * @var array
- */
- public $info = array();
-
-
- /**
- * Initialize a KeyInfo element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('Id')) {
- $this->Id = $xml->getAttribute('Id');
- }
-
- for ($n = $xml->firstChild; $n !== NULL; $n = $n->nextSibling) {
- if (!($n instanceof DOMElement)) {
- continue;
- }
-
- if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
- $this->info[] = new SAML2_XML_Chunk($n);
- continue;
- }
- switch ($n->localName) {
- case 'KeyName':
- $this->info[] = new SAML2_XML_ds_KeyName($n);
- break;
- case 'X509Data':
- $this->info[] = new SAML2_XML_ds_X509Data($n);
- break;
- default:
- $this->info[] = new SAML2_XML_Chunk($n);
- break;
- }
- }
- }
-
-
- /**
- * Convert this KeyInfo to XML.
- *
- * @param DOMElement $parent The element we should append this KeyInfo to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->Id) || is_string($this->Id)');
- assert('is_array($this->info)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:KeyInfo');
- $parent->appendChild($e);
-
- if (isset($this->Id)) {
- $e->setAttribute('Id', $this->Id);
- }
-
- foreach ($this->info as $n) {
- $n->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/ds/KeyName.php b/lib/SAML2/XML/ds/KeyName.php
deleted file mode 100644
index 6eae3a4..0000000
--- a/lib/SAML2/XML/ds/KeyName.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Class representing a ds:KeyName element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_ds_KeyName {
-
- /**
- * The key name.
- *
- * @var string
- */
- public $name;
-
-
- /**
- * Initialize a KeyName element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->name = $xml->textContent;
- }
-
-
- /**
- * Convert this KeyName element to XML.
- *
- * @param DOMElement $parent The element we should append this KeyName element to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->name)');
-
- return SAML2_Utils::addString($parent, XMLSecurityDSig::XMLDSIGNS, 'ds:KeyName', $this->name);
- }
-
-}
diff --git a/lib/SAML2/XML/ds/X509Certificate.php b/lib/SAML2/XML/ds/X509Certificate.php
deleted file mode 100644
index c4dcac1..0000000
--- a/lib/SAML2/XML/ds/X509Certificate.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Class representing a ds:X509Certificate element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_ds_X509Certificate {
-
- /**
- * The base64-encoded certificate.
- *
- * @var string
- */
- public $certificate;
-
-
- /**
- * Initialize an X509Certificate element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->certificate = $xml->textContent;
- }
-
-
- /**
- * Convert this X509Certificate element to XML.
- *
- * @param DOMElement $parent The element we should append this X509Certificate element to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->certificate)');
-
- return SAML2_Utils::addString($parent, XMLSecurityDSig::XMLDSIGNS, 'ds:X509Certificate', $this->certificate);
- }
-
-}
diff --git a/lib/SAML2/XML/ds/X509Data.php b/lib/SAML2/XML/ds/X509Data.php
deleted file mode 100644
index e6b3c06..0000000
--- a/lib/SAML2/XML/ds/X509Data.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * Class representing a ds:X509Data element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_ds_X509Data {
-
- /**
- * The various X509 data elements.
- *
- * Array with various elements describing this certificate.
- * Unknown elements will be represented by SAML2_XML_Chunk.
- *
- * @var array
- */
- public $data = array();
-
-
- /**
- * Initialize a X509Data.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- for ($n = $xml->firstChild; $n !== NULL; $n = $n->nextSibling) {
- if (!($n instanceof DOMElement)) {
- continue;
- }
-
- if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
- $this->data[] = new SAML2_XML_Chunk($n);
- continue;
- }
- switch ($n->localName) {
- case 'X509Certificate':
- $this->data[] = new SAML2_XML_ds_X509Certificate($n);
- break;
- default:
- $this->data[] = new SAML2_XML_Chunk($n);
- break;
- }
- }
- }
-
-
- /**
- * Convert this X509Data element to XML.
- *
- * @param DOMElement $parent The element we should append this X509Data element to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->data)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509Data');
- $parent->appendChild($e);
-
- foreach ($this->data as $n) {
- $n->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/AdditionalMetadataLocation.php b/lib/SAML2/XML/md/AdditionalMetadataLocation.php
deleted file mode 100644
index 3bdb6ba..0000000
--- a/lib/SAML2/XML/md/AdditionalMetadataLocation.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 metadata AdditionalMetadataLocation element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_AdditionalMetadataLocation {
-
- /**
- * The namespace of this metadata.
- *
- * @var string
- */
- public $namespace;
-
- /**
- * The URI where the metadata is located.
- *
- * @var string
- */
- public $location;
-
-
- /**
- * Initialize an AdditionalMetadataLocation element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('namespace')) {
- throw new Exception('Missing namespace attribute on AdditionalMetadataLocation element.');
- }
- $this->namespace = $xml->getAttribute('namespace');
-
- $this->location = $xml->textContent;
- }
-
-
- /**
- * Convert this AdditionalMetadataLocation to XML.
- *
- * @param DOMElement $parent The element we should append to.
- * @return DOMElement This AdditionalMetadataLocation-element.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->namespace)');
- assert('is_string($this->location)');
-
- $e = SAML2_Utils::addString($parent, SAML2_Const::NS_MD, 'md:AdditionalMetadataLocation', $this->location);
- $e->setAttribute('namespace', $this->namespace);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/AffiliationDescriptor.php b/lib/SAML2/XML/md/AffiliationDescriptor.php
deleted file mode 100644
index 927ad1f..0000000
--- a/lib/SAML2/XML/md/AffiliationDescriptor.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 AffiliationDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_AffiliationDescriptor extends SAML2_SignedElementHelper {
-
- /**
- * The affiliationOwnerID.
- *
- * @var string
- */
- public $affiliationOwnerID;
-
-
- /**
- * The ID of this element.
- *
- * @var string|NULL
- */
- public $ID;
-
-
- /**
- * How long this element is valid, as a unix timestamp.
- *
- * @var int|NULL
- */
- public $validUntil;
-
-
- /**
- * The length of time this element can be cached, as string.
- *
- * @var string|NULL
- */
- public $cacheDuration;
-
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * The AffiliateMember(s).
- *
- * Array of entity ID strings.
- *
- * @var array
- */
- public $AffiliateMember = array();
-
-
- /**
- * KeyDescriptor elements.
- *
- * Array of SAML2_XML_md_KeyDescriptor elements.
- *
- * @var array
- */
- public $KeyDescriptor = array();
-
-
- /**
- * Initialize a AffiliationDescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- parent::__construct($xml);
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('affiliationOwnerID')) {
- throw new Exception('Missing affiliationOwnerID on AffiliationDescriptor.');
- }
- $this->affiliationOwnerID = $xml->getAttribute('affiliationOwnerID');
-
- if ($xml->hasAttribute('ID')) {
- $this->ID = $xml->getAttribute('ID');
- }
-
- if ($xml->hasAttribute('validUntil')) {
- $this->validUntil = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('validUntil'));
- }
-
- if ($xml->hasAttribute('cacheDuration')) {
- $this->cacheDuration = $xml->getAttribute('cacheDuration');
- }
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
- $this->AffiliateMember = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'AffiliateMember');
- if (empty($this->AffiliateMember)) {
- throw new Exception('Missing AffiliateMember in AffiliationDescriptor.');
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
- $this->KeyDescriptor[] = new SAML2_XML_md_KeyDescriptor($kd);
- }
- }
-
-
- /**
- * Add this AffiliationDescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this endpoint to.
- * @param string $name The name of the element we should create.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->affiliationOwnerID)');
- assert('is_null($this->ID) || is_string($this->ID)');
- assert('is_null($this->validUntil) || is_int($this->validUntil)');
- assert('is_null($this->cacheDuration) || is_string($this->cacheDuration)');
- assert('is_array($this->Extensions)');
- assert('is_array($this->AffiliateMember)');
- assert('!empty($this->AffiliateMember)');
- assert('is_array($this->KeyDescriptor)');
-
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, 'md:AffiliationDescriptor');
- $parent->appendChild($e);
-
- $e->setAttribute('affiliationOwnerID', $this->affiliationOwnerID);
-
- if (isset($this->ID)) {
- $e->setAttribute('ID', $this->ID);
- }
-
- if (isset($this->validUntil)) {
- $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
- }
-
- if (isset($this->cacheDuration)) {
- $e->setAttribute('cacheDuration', $this->cacheDuration);
- }
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:AffiliateMember', FALSE, $this->AffiliateMember);
-
- foreach ($this->KeyDescriptor as $kd) {
- $kd->toXML($e);
- }
-
- $this->signElement($e, $e->firstChild);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/AttributeAuthorityDescriptor.php b/lib/SAML2/XML/md/AttributeAuthorityDescriptor.php
deleted file mode 100644
index 68eefee..0000000
--- a/lib/SAML2/XML/md/AttributeAuthorityDescriptor.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 metadata AttributeAuthorityDescriptor.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_AttributeAuthorityDescriptor extends SAML2_XML_md_RoleDescriptor {
-
- /**
- * List of AttributeService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AttributeService = array();
-
-
- /**
- * List of AssertionIDRequestService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AssertionIDRequestService = array();
-
-
- /**
- * List of supported NameID formats.
- *
- * Array of strings.
- *
- * @var array
- */
- public $NameIDFormat = array();
-
-
- /**
- * List of supported attribute profiles.
- *
- * Array with strings.
- *
- * @var array
- */
- public $AttributeProfile = array();
-
-
- /**
- * List of supported attributes.
- *
- * Array with SAML2_XML_saml_Attribute objects.
- *
- * @var array
- */
- public $Attribute = array();
-
-
- /**
- * Initialize an IDPSSODescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct('md:AttributeAuthorityDescriptor', $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AttributeService') as $ep) {
- $this->AttributeService[] = new SAML2_XML_md_EndpointType($ep);
- }
- if (empty($this->AttributeService)) {
- throw new Exception('Must have at least one AttributeService in AttributeAuthorityDescriptor.');
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
- $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
-
- $this->AttributeProfile = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'AttributeProfile');
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
- $this->Attribute[] = new SAML2_XML_saml_Attribute($a);
- }
- }
-
-
- /**
- * Add this AttributeAuthorityDescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this IDPSSODescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->AttributeService)');
- assert('!empty($this->AttributeService)');
- assert('is_array($this->AssertionIDRequestService)');
- assert('is_array($this->NameIDFormat)');
- assert('is_array($this->AttributeProfile)');
- assert('is_array($this->Attribute)');
-
- $e = parent::toXML($parent);
-
- foreach ($this->AttributeService as $ep) {
- $ep->toXML($e, 'md:AttributeService');
- }
-
- foreach ($this->AssertionIDRequestService as $ep) {
- $ep->toXML($e, 'md:AssertionIDRequestService');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:NameIDFormat', FALSE, $this->NameIDFormat);
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:AttributeProfile', FALSE, $this->AttributeProfile);
-
- foreach ($this->Attribute as $a) {
- $a->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/AttributeConsumingService.php b/lib/SAML2/XML/md/AttributeConsumingService.php
deleted file mode 100644
index 427fd28..0000000
--- a/lib/SAML2/XML/md/AttributeConsumingService.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 Metadata AttributeConsumingService element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_AttributeConsumingService {
-
- /**
- * The index of this AttributeConsumingService.
- *
- * @var int
- */
- public $index;
-
-
- /**
- * Whether this is the default AttributeConsumingService.
- *
- * @var bool|NULL
- */
- public $isDefault = NULL;
-
-
- /**
- * The ServiceName of this AttributeConsumingService.
- *
- * This is an associative array with language => translation.
- *
- * @var array
- */
- public $ServiceName = array();
-
-
- /**
- * The ServiceDescription of this AttributeConsumingService.
- *
- * This is an associative array with language => translation.
- *
- * @var array
- */
- public $ServiceDescription = array();
-
-
- /**
- * The RequestedAttribute elements.
- *
- * This is an array of SAML_RequestedAttributeType elements.
- *
- * @var array
- */
- public $RequestedAttribute = array();
-
-
- /**
- * Initialize / parse an AttributeConsumingService.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
-
- if (!$xml->hasAttribute('index')) {
- throw new Exception('Missing index on AttributeConsumingService.');
- }
- $this->index = (int)$xml->getAttribute('index');
-
- $this->isDefault = SAML2_Utils::parseBoolean($xml, 'isDefault', NULL);
-
- $this->ServiceName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'ServiceName');
- if (empty($this->ServiceName)) {
- throw new Exception('Missing ServiceName in AttributeConsumingService.');
- }
-
- $this->ServiceDescription = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'ServiceDescription');
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:RequestedAttribute') as $ra) {
- $this->RequestedAttribute[] = new SAML2_XML_md_RequestedAttribute($ra);
- }
- }
-
-
- /**
- * Convert to DOMElement.
- *
- * @param DOMElement $parent The element we should append this AttributeConsumingService to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_int($this->index)');
- assert('is_null($this->isDefault) || is_bool($this->isDefault)');
- assert('is_array($this->ServiceName)');
- assert('is_array($this->ServiceDescription)');
- assert('is_array($this->RequestedAttribute)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:AttributeConsumingService');
- $parent->appendChild($e);
-
- $e->setAttribute('index', (string)$this->index);
-
- if ($this->isDefault === TRUE) {
- $e->setAttribute('isDefault', 'true');
- } elseif ($this->isDefault === FALSE) {
- $e->setAttribute('isDefault', 'false');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:ServiceName', TRUE, $this->ServiceName);
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:ServiceDescription', TRUE, $this->ServiceDescription);
-
- foreach ($this->RequestedAttribute as $ra) {
- $ra->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/AuthnAuthorityDescriptor.php b/lib/SAML2/XML/md/AuthnAuthorityDescriptor.php
deleted file mode 100644
index 52124ab..0000000
--- a/lib/SAML2/XML/md/AuthnAuthorityDescriptor.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 metadata AuthnAuthorityDescriptor.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_AuthnAuthorityDescriptor extends SAML2_XML_md_RoleDescriptor {
-
- /**
- * List of AuthnQueryService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AuthnQueryService = array();
-
-
- /**
- * List of AssertionIDRequestService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AssertionIDRequestService = array();
-
-
- /**
- * List of supported NameID formats.
- *
- * Array of strings.
- *
- * @var array
- */
- public $NameIDFormat = array();
-
-
- /**
- * Initialize an IDPSSODescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct('md:AuthnAuthorityDescriptor', $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AuthnQueryService') as $ep) {
- $this->AuthnQueryService[] = new SAML2_XML_md_EndpointType($ep);
- }
- if (empty($this->AuthnQueryService)) {
- throw new Exception('Must have at least one AuthnQueryService in AuthnAuthorityDescriptor.');
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
- $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
- }
-
-
- /**
- * Add this IDPSSODescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this AuthnAuthorityDescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->AuthnQueryService)');
- assert('!empty($this->AuthnQueryService)');
- assert('is_array($this->AssertionIDRequestService)');
- assert('is_array($this->NameIDFormat)');
-
- $e = parent::toXML($parent);
-
- foreach ($this->AuthnQueryService as $ep) {
- $ep->toXML($e, 'md:AuthnQueryService');
- }
-
- foreach ($this->AssertionIDRequestService as $ep) {
- $ep->toXML($e, 'md:AssertionIDRequestService');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:NameIDFormat', FALSE, $this->NameIDFormat);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/ContactPerson.php b/lib/SAML2/XML/md/ContactPerson.php
deleted file mode 100644
index ea347c3..0000000
--- a/lib/SAML2/XML/md/ContactPerson.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 ContactPerson.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_ContactPerson {
-
- /**
- * The contact type.
- *
- * @var string
- */
- public $contactType;
-
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * The Company of this contact.
- *
- * @var string
- */
- public $Company = NULL;
-
-
- /**
- * The GivenName of this contact.
- *
- * @var string
- */
- public $GivenName = NULL;
-
-
- /**
- * The SurName of this contact.
- *
- * @var string
- */
- public $SurName = NULL;
-
-
- /**
- * The EmailAddresses of this contact.
- *
- * @var array
- */
- public $EmailAddress = array();
-
-
- /**
- * The TelephoneNumbers of this contact.
- *
- * @var array
- */
- public $TelephoneNumber = array();
-
-
- /**
- * Initialize a ContactPerson element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('contactType')) {
- throw new Exception('Missing contactType on ContactPerson.');
- }
- $this->contactType = $xml->getAttribute('contactType');
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
-
- $this->Company = self::getStringElement($xml, 'Company');
- $this->GivenName = self::getStringElement($xml, 'GivenName');
- $this->SurName = self::getStringElement($xml, 'SurName');
- $this->EmailAddress = self::getStringElements($xml, 'EmailAddress');
- $this->TelephoneNumber = self::getStringElements($xml, 'TelephoneNumber');
- }
-
-
- /**
- * Retrieve the value of a child DOMElements as an array of strings.
- *
- * @param DOMElement $parent The parent element.
- * @param string $name The name of the child elements.
- * @return array The value of the child elements.
- */
- private static function getStringElements(DOMElement $parent, $name) {
- assert('is_string($name)');
-
- $e = SAML2_Utils::xpQuery($parent, './saml_metadata:' . $name);
-
- $ret = array();
- foreach ($e as $i) {
- $ret[] = $i->textContent;
- }
-
- return $ret;
- }
-
-
- /**
- * Retrieve the value of a child DOMElement as a string.
- *
- * @param DOMElement $parent The parent element.
- * @param string $name The name of the child element.
- * @return string|NULL The value of the child element.
- */
- private static function getStringElement(DOMElement $parent, $name) {
- assert('is_string($name)');
-
- $e = self::getStringElements($parent, $name);
- if (empty($e)) {
- return NULL;
- }
- if (count($e) > 1) {
- throw new Exception('More than one ' . $name . ' in ' . $parent->tagName);
- }
-
- return $e[0];
- }
-
-
- /**
- * Convert this ContactPerson to XML.
- *
- * @param DOMElement $parent The element we should add this contact to.
- * @return DOMElement The new ContactPerson-element.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->contactType)');
- assert('is_array($this->Extensions)');
- assert('is_null($this->Company) || is_string($this->Company)');
- assert('is_null($this->GivenName) || is_string($this->GivenName)');
- assert('is_null($this->SurName) || is_string($this->SurName)');
- assert('is_array($this->EmailAddress)');
- assert('is_array($this->TelephoneNumber)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:ContactPerson');
- $parent->appendChild($e);
-
- $e->setAttribute('contactType', $this->contactType);
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- if (isset($this->Company)) {
- SAML2_Utils::addString($e, SAML2_Const::NS_MD, 'md:Company', $this->Company);
- }
- if (isset($this->GivenName)) {
- SAML2_Utils::addString($e, SAML2_Const::NS_MD, 'md:GivenName', $this->GivenName);
- }
- if (isset($this->SurName)) {
- SAML2_Utils::addString($e, SAML2_Const::NS_MD, 'md:SurName', $this->SurName);
- }
- if (!empty($this->EmailAddress)) {
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:EmailAddress', FALSE, $this->EmailAddress);
- }
- if (!empty($this->TelephoneNumber)) {
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:TelephoneNumber', FALSE, $this->TelephoneNumber);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/EndpointType.php b/lib/SAML2/XML/md/EndpointType.php
deleted file mode 100644
index e4317e6..0000000
--- a/lib/SAML2/XML/md/EndpointType.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 EndpointType.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_EndpointType {
-
- /**
- * The binding for this endpoint.
- *
- * @var string
- */
- public $Binding;
-
-
- /**
- * The URI to this endpoint.
- *
- * @var string
- */
- public $Location;
-
-
- /**
- * The URI where responses can be delivered.
- *
- * @var string|NULL
- */
- public $ResponseLocation = NULL;
-
-
- /**
- * Extra (namespace qualified) attributes.
- *
- * @var array
- */
- private $attributes = array();
-
-
- /**
- * Initialize an EndpointType.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('Binding')) {
- throw new Exception('Missing Binding on ' . $xml->tagName);
- }
- $this->Binding = $xml->getAttribute('Binding');
-
- if (!$xml->hasAttribute('Location')) {
- throw new Exception('Missing Location on ' . $xml->tagName);
- }
- $this->Location = $xml->getAttribute('Location');
-
- if ($xml->hasAttribute('ResponseLocation')) {
- $this->ResponseLocation = $xml->getAttribute('ResponseLocation');
- }
-
- foreach ($xml->attributes as $a) {
- if ($a->namespaceURI === NULL) {
- continue; /* Not namespace-qualified -- skip. */
- }
- $fullName = '{' . $a->namespaceURI . '}' . $a->localName;
- $this->attributes[$fullName] = array(
- 'qualifiedName' => $a->nodeName,
- 'namespaceURI' => $a->namespaceURI,
- 'value' => $a->value,
- );
- }
- }
-
-
- /**
- * Check if a namespace-qualified attribute exists.
- *
- * @param string $namespaceURI The namespace URI.
- * @param string $localName The local name.
- * @return boolean TRUE if the attribute exists, FALSE if not.
- */
- public function hasAttributeNS($namespaceURI, $localName) {
- assert('is_string($namespaceURI)');
- assert('is_string($localName)');
-
- $fullName = '{' . $namespaceURI . '}' . $localName;
- return isset($this->attributes[$fullName]);
- }
-
-
- /**
- * Get a namespace-qualified attribute.
- *
- * @param string $namespaceURI The namespace URI.
- * @param string $localName The local name.
- * @return string The value of the attribute, or an empty string if the attribute does not exist.
- */
- public function getAttributeNS($namespaceURI, $localName) {
- assert('is_string($namespaceURI)');
- assert('is_string($localName)');
-
- $fullName = '{' . $namespaceURI . '}' . $localName;
- if (!isset($this->attributes[$fullName])) {
- return '';
- }
- return $this->attributes[$fullName]['value'];
- }
-
-
- /**
- * Get a namespace-qualified attribute.
- *
- * @param string $namespaceURI The namespace URI.
- * @param string $qualifiedName The local name.
- * @param string $value The attribute value.
- */
- public function setAttributeNS($namespaceURI, $qualifiedName, $value) {
- assert('is_string($namespaceURI)');
- assert('is_string($qualifiedName)');
-
- $name = explode(':', $qualifiedName, 2);
- if (count($name) < 2) {
- throw new Exception('Not a qualified name.');
- }
- $localName = $name[1];
-
- $fullName = '{' . $namespaceURI . '}' . $localName;
- $this->attributes[$fullName] = array(
- 'qualifiedName' => $qualifiedName,
- 'namespaceURI' => $namespaceURI,
- 'value' => $value,
- );
- }
-
-
- /**
- * Remove a namespace-qualified attribute.
- *
- * @param string $namespaceURI The namespace URI.
- * @param string $localName The local name.
- */
- public function removeAttributeNS($namespaceURI, $localName) {
- assert('is_string($namespaceURI)');
- assert('is_string($localName)');
-
- $fullName = '{' . $namespaceURI . '}' . $localName;
- unset($this->attributes[$fullName]);
- }
-
-
- /**
- * Add this endpoint to an XML element.
- *
- * @param DOMElement $parent The element we should append this endpoint to.
- * @param string $name The name of the element we should create.
- */
- public function toXML(DOMElement $parent, $name) {
- assert('is_string($name)');
- assert('is_string($this->Binding)');
- assert('is_string($this->Location)');
- assert('is_null($this->ResponseLocation) || is_string($this->ResponseLocation)');
-
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, $name);
- $parent->appendChild($e);
-
- $e->setAttribute('Binding', $this->Binding);
- $e->setAttribute('Location', $this->Location);
-
- if (isset($this->ResponseLocation)) {
- $e->setAttribute('ResponseLocation', $this->ResponseLocation);
- }
-
- foreach ($this->attributes as $a) {
- $e->setAttributeNS($a['namespaceURI'], $a['qualifiedName'], $a['value']);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/EntitiesDescriptor.php b/lib/SAML2/XML/md/EntitiesDescriptor.php
deleted file mode 100644
index c0e9134..0000000
--- a/lib/SAML2/XML/md/EntitiesDescriptor.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 EntitiesDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_EntitiesDescriptor extends SAML2_SignedElementHelper {
-
- /**
- * The ID of this element.
- *
- * @var string|NULL
- */
- public $ID;
-
-
- /**
- * How long this element is valid, as a unix timestamp.
- *
- * @var int|NULL
- */
- public $validUntil;
-
-
- /**
- * The length of time this element can be cached, as string.
- *
- * @var string|NULL
- */
- public $cacheDuration;
-
-
- /**
- * The name of this entity collection.
- *
- * @var string|NULL
- */
- public $Name;
-
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * Child EntityDescriptor and EntitiesDescriptor elements.
- *
- * @var array
- */
- public $children = array();
-
-
- /**
- * Initialize an EntitiesDescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct($xml);
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('ID')) {
- $this->ID = $xml->getAttribute('ID');
- }
- if ($xml->hasAttribute('validUntil')) {
- $this->validUntil = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('validUntil'));
- }
- if ($xml->hasAttribute('cacheDuration')) {
- $this->cacheDuration = $xml->getAttribute('cacheDuration');
- }
- if ($xml->hasAttribute('Name')) {
- $this->Name = $xml->getAttribute('Name');
- }
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:EntityDescriptor|./saml_metadata:EntitiesDescriptor') as $node) {
- if ($node->localName === 'EntityDescriptor') {
- $this->children[] = new SAML2_XML_md_EntityDescriptor($node);
- } else {
- $this->children[] = new SAML2_XML_md_EntitiesDescriptor($node);
- }
- }
- }
-
-
- /**
- * Convert this EntitiesDescriptor to XML.
- *
- * @param DOMElement|NULL $parent The EntitiesDescriptor we should append this EntitiesDescriptor to.
- */
- public function toXML(DOMElement $parent = NULL) {
- assert('is_null($this->ID) || is_string($this->ID)');
- assert('is_null($this->validUntil) || is_int($this->validUntil)');
- assert('is_null($this->cacheDuration) || is_string($this->cacheDuration)');
- assert('is_null($this->Name) || is_string($this->Name)');
- assert('is_array($this->Extensions)');
- assert('is_array($this->children)');
-
- if ($parent === NULL) {
- $doc = new DOMDocument();
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:EntitiesDescriptor');
- $doc->appendChild($e);
- } else {
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, 'md:EntitiesDescriptor');
- $parent->appendChild($e);
- }
-
- if (isset($this->ID)) {
- $e->setAttribute('ID', $this->ID);
- }
-
- if (isset($this->validUntil)) {
- $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
- }
-
- if (isset($this->cacheDuration)) {
- $e->setAttribute('cacheDuration', $this->cacheDuration);
- }
-
- if (isset($this->Name)) {
- $e->setAttribute('Name', $this->Name);
- }
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- foreach ($this->children as $node) {
- $node->toXML($e);
- }
-
- $this->signElement($e, $e->firstChild);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/EntityDescriptor.php b/lib/SAML2/XML/md/EntityDescriptor.php
deleted file mode 100644
index 89c7dce..0000000
--- a/lib/SAML2/XML/md/EntityDescriptor.php
+++ /dev/null
@@ -1,252 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 EntityDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_EntityDescriptor extends SAML2_SignedElementHelper {
-
- /**
- * The entityID this EntityDescriptor represents.
- *
- * @var string
- */
- public $entityID;
-
-
- /**
- * The ID of this element.
- *
- * @var string|NULL
- */
- public $ID;
-
-
- /**
- * How long this element is valid, as a unix timestamp.
- *
- * @var int|NULL
- */
- public $validUntil;
-
-
- /**
- * The length of time this element can be cached, as string.
- *
- * @var string|NULL
- */
- public $cacheDuration;
-
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * Array with all roles for this entity.
- *
- * Array of SAML2_XML_md_RoleDescriptor objects (and subclasses of RoleDescriptor).
- *
- * @var array
- */
- public $RoleDescriptor = array();
-
-
- /**
- * AffiliationDescriptor of this entity.
- *
- * @var SAML2_XML_md_AffiliationDescriptor|NULL
- */
- public $AffiliationDescriptor = NULL;
-
-
- /**
- * Organization of this entity.
- *
- * @var SAML2_XML_md_Organization|NULL
- */
- public $Organization = NULL;
-
-
- /**
- * ContactPerson elements for this entity.
- *
- * @var array
- */
- public $ContactPerson = array();
-
-
- /**
- * AdditionalMetadataLocation elements for this entity.
- *
- * @var array
- */
- public $AdditionalMetadataLocation = array();
-
-
- /**
- * Initialize an EntitiyDescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct($xml);
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('entityID')) {
- throw new Exception('Missing required attribute entityID on EntityDescriptor.');
- }
- $this->entityID = $xml->getAttribute('entityID');
-
- if ($xml->hasAttribute('ID')) {
- $this->ID = $xml->getAttribute('ID');
- }
- if ($xml->hasAttribute('validUntil')) {
- $this->validUntil = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('validUntil'));
- }
- if ($xml->hasAttribute('cacheDuration')) {
- $this->cacheDuration = $xml->getAttribute('cacheDuration');
- }
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
- for ($node = $xml->firstChild; $node !== NULL; $node = $node->nextSibling) {
- if (!($node instanceof DOMElement)) {
- continue;
- }
-
- if ($node->namespaceURI !== SAML2_Const::NS_MD) {
- continue;
- }
-
- switch ($node->localName) {
- case 'RoleDescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_UnknownRoleDescriptor($node);
- break;
- case 'IDPSSODescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_IDPSSODescriptor($node);
- break;
- case 'SPSSODescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_SPSSODescriptor($node);
- break;
- case 'AuthnAuthorityDescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_AuthnAuthorityDescriptor($node);
- break;
- case 'AttributeAuthorityDescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_AttributeAuthorityDescriptor($node);
- break;
- case 'PDPDescriptor':
- $this->RoleDescriptor[] = new SAML2_XML_md_PDPDescriptor($node);
- break;
- }
- }
-
- $affiliationDescriptor = SAML2_Utils::xpQuery($xml, './saml_metadata:AffiliationDescriptor');
- if (count($affiliationDescriptor) > 1) {
- throw new Exception('More than one AffiliationDescriptor in the entity.');
- } elseif (!empty($affiliationDescriptor)) {
- $this->AffiliationDescriptor = new SAML2_XML_md_AffiliationDescriptor($affiliationDescriptor[0]);
- }
-
- if (empty($this->RoleDescriptor) && is_null($this->AffiliationDescriptor)) {
- throw new Exception('Must have either one of the RoleDescriptors or an AffiliationDescriptor in EntityDescriptor.');
- } elseif (!empty($this->RoleDescriptor) && !is_null($this->AffiliationDescriptor)) {
- throw new Exception('AffiliationDescriptor cannot be combined with other RoleDescriptor elements in EntityDescriptor.');
- }
-
- $organization = SAML2_Utils::xpQuery($xml, './saml_metadata:Organization');
- if (count($organization) > 1) {
- throw new Exception('More than one Organization in the entity.');
- } elseif (!empty($organization)) {
- $this->Organization = new SAML2_XML_md_Organization($organization[0]);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
- $this->ContactPerson[] = new SAML2_XML_md_ContactPerson($cp);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AdditionalMetadataLocation') as $aml) {
- $this->AdditionalMetadataLocation[] = new SAML2_XML_md_AdditionalMetadataLocation($aml);
- }
- }
-
-
- /**
- * Create this EntityDescriptor.
- *
- * @param DOMElement|NULL $parent The EntitiesDescriptor we should append this EntityDescriptor to.
- */
- public function toXML(DOMElement $parent = NULL) {
- assert('is_string($this->entityID)');
- assert('is_null($this->ID) || is_string($this->ID)');
- assert('is_null($this->validUntil) || is_int($this->validUntil)');
- assert('is_null($this->cacheDuration) || is_string($this->cacheDuration)');
- assert('is_array($this->Extensions)');
- assert('is_array($this->RoleDescriptor)');
- assert('is_null($this->AffiliationDescriptor) || $this->AffiliationDescriptor instanceof SAML2_XML_md_AffiliationDescriptor');
- assert('is_null($this->Organization) || $this->Organization instanceof SAML2_XML_md_Organization');
- assert('is_array($this->ContactPerson)');
- assert('is_array($this->AdditionalMetadataLocation)');
-
- if ($parent === NULL) {
- $doc = new DOMDocument();
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:EntityDescriptor');
- $doc->appendChild($e);
- } else {
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, 'md:EntityDescriptor');
- $parent->appendChild($e);
- }
-
- $e->setAttribute('entityID', $this->entityID);
-
- if (isset($this->ID)) {
- $e->setAttribute('ID', $this->ID);
- }
-
- if (isset($this->validUntil)) {
- $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
- }
-
- if (isset($this->cacheDuration)) {
- $e->setAttribute('cacheDuration', $this->cacheDuration);
- }
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- foreach ($this->RoleDescriptor as $n) {
- $n->toXML($e);
- }
-
- if (isset($this->AffiliationDescriptor)) {
- $this->AffiliationDescriptor->toXML($e);
- }
-
- if (isset($this->Organization)) {
- $this->Organization->toXML($e);
- }
-
- foreach ($this->ContactPerson as $cp) {
- $cp->toXML($e);
- }
-
- foreach ($this->AdditionalMetadataLocation as $n) {
- $n->toXML($e);
- }
-
- $this->signElement($e, $e->firstChild);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/Extensions.php b/lib/SAML2/XML/md/Extensions.php
deleted file mode 100644
index 797bdaf..0000000
--- a/lib/SAML2/XML/md/Extensions.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Class for handling SAML2 metadata extensions.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_Extensions {
-
- /**
- * Get a list of Extensions in the given element.
- *
- * @param DOMElement $parent The element that may contain the md:Extensions element.
- * @return array Array of extensions.
- */
- public static function getList(DOMElement $parent) {
-
- $ret = array();
- foreach (SAML2_Utils::xpQuery($parent, './saml_metadata:Extensions/*') as $node) {
- if ($node->namespaceURI === SAML2_XML_shibmd_Scope::NS && $node->localName === 'Scope') {
- $ret[] = new SAML2_XML_shibmd_Scope($node);
- } elseif ($node->namespaceURI === SAML2_XML_mdattr_EntityAttributes::NS && $node->localName === 'EntityAttributes') {
- $ret[] = new SAML2_XML_mdattr_EntityAttributes($node);
- } elseif ($node->namespaceURI === SAML2_XML_mdrpi_Common::NS_MDRPI && $node->localName === 'RegistrationInfo') {
- $ret[] = new SAML2_XML_mdrpi_RegistrationInfo($node);
- } elseif ($node->namespaceURI === SAML2_XML_mdrpi_Common::NS_MDRPI && $node->localName === 'PublicationInfo') {
- $ret[] = new SAML2_XML_mdrpi_PublicationInfo($node);
- } elseif ($node->namespaceURI === SAML2_XML_mdui_UIInfo::NS && $node->localName === 'UIInfo') {
- $ret[] = new SAML2_XML_mdui_UIInfo($node);
- } elseif ($node->namespaceURI === SAML2_XML_mdui_DiscoHints::NS && $node->localName === 'DiscoHints') {
- $ret[] = new SAML2_XML_mdui_DiscoHints($node);
- } else {
- $ret[] = new SAML2_XML_Chunk($node);
- }
- }
-
- return $ret;
- }
-
-
- /**
- * Add a list of Extensions to the given element.
- *
- * @param DOMElement $parent The element we should add the extensions to.
- * @param array $extensions List of extension objects.
- */
- public static function addList(DOMElement $parent, array $extensions) {
-
- if (empty($extensions)) {
- return;
- }
-
- $extElement = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, 'md:Extensions');
- $parent->appendChild($extElement);
-
- foreach ($extensions as $ext) {
- $ext->toXML($extElement);
- }
- }
-
-}
diff --git a/lib/SAML2/XML/md/IDPSSODescriptor.php b/lib/SAML2/XML/md/IDPSSODescriptor.php
deleted file mode 100644
index 0479d98..0000000
--- a/lib/SAML2/XML/md/IDPSSODescriptor.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 IDPSSODescriptor.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_IDPSSODescriptor extends SAML2_XML_md_SSODescriptorType {
-
- /**
- * Whether AuthnRequests sent to this IdP should be signed.
- *
- * @var bool|NULL
- */
- public $WantAuthnRequestsSigned = NULL;
-
-
- /**
- * List of SingleSignOnService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $SingleSignOnService = array();
-
-
- /**
- * List of NameIDMappingService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $NameIDMappingService = array();
-
-
- /**
- * List of AssertionIDRequestService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AssertionIDRequestService = array();
-
-
- /**
- * List of supported attribute profiles.
- *
- * Array with strings.
- *
- * @var array
- */
- public $AttributeProfile = array();
-
-
- /**
- * List of supported attributes.
- *
- * Array with SAML2_XML_saml_Attribute objects.
- *
- * @var array
- */
- public $Attribute = array();
-
-
- /**
- * Initialize an IDPSSODescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct('md:IDPSSODescriptor', $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- $this->WantAuthnRequestsSigned = SAML2_Utils::parseBoolean($xml, 'WantAuthnRequestsSigned', NULL);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:SingleSignOnService') as $ep) {
- $this->SingleSignOnService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:NameIDMappingService') as $ep) {
- $this->NameIDMappingService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
- $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- $this->AttributeProfile = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'AttributeProfile');
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
- $this->Attribute[] = new SAML2_XML_saml_Attribute($a);
- }
- }
-
-
- /**
- * Add this IDPSSODescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this IDPSSODescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->WantAuthnRequestsSigned) || is_bool($this->WantAuthnRequestsSigned)');
- assert('is_array($this->SingleSignOnService)');
- assert('is_array($this->NameIDMappingService)');
- assert('is_array($this->AssertionIDRequestService)');
- assert('is_array($this->AttributeProfile)');
- assert('is_array($this->Attribute)');
-
- $e = parent::toXML($parent);
-
- if ($this->WantAuthnRequestsSigned === TRUE) {
- $e->setAttribute('WantAuthnRequestsSigned', 'true');
- } elseif ($this->WantAuthnRequestsSigned === FALSE) {
- $e->setAttribute('WantAuthnRequestsSigned', 'false');
- }
-
- foreach ($this->SingleSignOnService as $ep) {
- $ep->toXML($e, 'md:SingleSignOnService');
- }
-
- foreach ($this->NameIDMappingService as $ep) {
- $ep->toXML($e, 'md:NameIDMappingService');
- }
-
- foreach ($this->AssertionIDRequestService as $ep) {
- $ep->toXML($e, 'md:AssertionIDRequestService');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:AttributeProfile', FALSE, $this->AttributeProfile);
-
- foreach ($this->Attribute as $a) {
- $a->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/IndexedEndpointType.php b/lib/SAML2/XML/md/IndexedEndpointType.php
deleted file mode 100644
index c019152..0000000
--- a/lib/SAML2/XML/md/IndexedEndpointType.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 IndexedEndpointType.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_IndexedEndpointType extends SAML2_XML_md_EndpointType {
-
- /**
- * The index for this endpoint.
- *
- * @var int
- */
- public $index;
-
-
- /**
- * Whether this endpoint is the default.
- *
- * @var bool|NULL
- */
- public $isDefault = NULL;
-
-
- /**
- * Initialize an IndexedEndpointType.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct($xml);
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('index')) {
- throw new Exception('Missing index on ' . $xml->tagName);
- }
- $this->index = (int)$xml->getAttribute('index');
-
- $this->isDefault = SAML2_Utils::parseBoolean($xml, 'isDefault', NULL);
- }
-
-
- /**
- * Add this endpoint to an XML element.
- *
- * @param DOMElement $parent The element we should append this endpoint to.
- * @param string $name The name of the element we should create.
- */
- public function toXML(DOMElement $parent, $name) {
- assert('is_string($name)');
- assert('is_int($this->index)');
- assert('is_null($this->isDefault) || is_bool($this->isDefault)');
-
- $e = parent::toXML($parent, $name);
- $e->setAttribute('index', (string)$this->index);
-
- if ($this->isDefault === TRUE) {
- $e->setAttribute('isDefault', 'true');
- } elseif ($this->isDefault === FALSE) {
- $e->setAttribute('isDefault', 'false');
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/KeyDescriptor.php b/lib/SAML2/XML/md/KeyDescriptor.php
deleted file mode 100644
index aeaffe9..0000000
--- a/lib/SAML2/XML/md/KeyDescriptor.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * Class representing a KeyDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_KeyDescriptor {
-
- /**
- * What this key can be used for.
- *
- * 'encryption', 'signing' or NULL.
- *
- * @var string|NULL
- */
- public $use;
-
-
- /**
- * The KeyInfo for this key.
- *
- * @var SAML2_XML_ds_KeyInfo
- */
- public $KeyInfo;
-
-
- /**
- * Supported EncryptionMethods.
- *
- * Array of SAML2_XML_Chunk objects.
- *
- * @var array
- */
- public $EncryptionMethod = array();
-
-
- /**
- * Initialize an KeyDescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('use')) {
- $this->use = $xml->getAttribute('use');
- }
-
- $keyInfo = SAML2_Utils::xpQuery($xml, './ds:KeyInfo');
- if (count($keyInfo) > 1) {
- throw new Exception('More than one ds:KeyInfo in the KeyDescriptor.');
- } elseif (empty($keyInfo)) {
- throw new Exception('No ds:KeyInfo in the KeyDescriptor.');
- }
- $this->KeyInfo = new SAML2_XML_ds_KeyInfo($keyInfo[0]);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:EncryptionMethod') as $em) {
- $this->EncryptionMethod[] = new SAML2_XML_Chunk($em);
- }
-
- }
-
-
- /**
- * Convert this KeyDescriptor to XML.
- *
- * @param DOMElement $parent The element we should append this KeyDescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->use) || is_string($this->use)');
- assert('$this->KeyInfo instanceof SAML2_XML_ds_KeyInfo');
- assert('is_array($this->EncryptionMethod)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:KeyDescriptor');
- $parent->appendChild($e);
-
- if (isset($this->use)) {
- $e->setAttribute('use', $this->use);
- }
-
- $this->KeyInfo->toXML($e);
-
- foreach ($this->EncryptionMethod as $em) {
- $em->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/Organization.php b/lib/SAML2/XML/md/Organization.php
deleted file mode 100644
index 5ceaeed..0000000
--- a/lib/SAML2/XML/md/Organization.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 Organization element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_Organization {
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * The OrganizationName, as an array of language => translation.
- *
- * @var array
- */
- public $OrganizationName = array();
-
-
- /**
- * The OrganizationDisplayName, as an array of language => translation.
- *
- * @var array
- */
- public $OrganizationDisplayName = array();
-
-
- /**
- * The OrganizationURL, as an array of language => translation.
- *
- * @var array
- */
- public $OrganizationURL = array();
-
-
- /**
- * Initialize an Organization element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
-
- $this->OrganizationName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationName');
- if (empty($this->OrganizationName)) {
- $this->OrganizationName = array('invalid' => '');
- }
-
- $this->OrganizationDisplayName = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationDisplayName');
- if (empty($this->OrganizationDisplayName)) {
- $this->OrganizationDisplayName = array('invalid' => '');
- }
-
- $this->OrganizationURL = SAML2_Utils::extractLocalizedStrings($xml, SAML2_Const::NS_MD, 'OrganizationURL');
- if (empty($this->OrganizationURL)) {
- $this->OrganizationURL = array('invalid' => '');
- }
- }
-
-
- /**
- * Convert this Organization to XML.
- *
- * @param DOMElement $parent The element we should add this organization to.
- * @return DOMElement This Organization-element.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->Extensions)');
- assert('is_array($this->OrganizationName)');
- assert('!empty($this->OrganizationName)');
- assert('is_array($this->OrganizationDisplayName)');
- assert('!empty($this->OrganizationDisplayName)');
- assert('is_array($this->OrganizationURL)');
- assert('!empty($this->OrganizationURL)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:Organization');
- $parent->appendChild($e);
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:OrganizationName', TRUE, $this->OrganizationName);
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:OrganizationDisplayName', TRUE, $this->OrganizationDisplayName);
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:OrganizationURL', TRUE, $this->OrganizationURL);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/PDPDescriptor.php b/lib/SAML2/XML/md/PDPDescriptor.php
deleted file mode 100644
index f09d054..0000000
--- a/lib/SAML2/XML/md/PDPDescriptor.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 metadata PDPDescriptor.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_PDPDescriptor extends SAML2_XML_md_RoleDescriptor {
-
- /**
- * List of AuthzService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AuthzService = array();
-
-
- /**
- * List of AssertionIDRequestService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $AssertionIDRequestService = array();
-
-
- /**
- * List of supported NameID formats.
- *
- * Array of strings.
- *
- * @var array
- */
- public $NameIDFormat = array();
-
-
- /**
- * Initialize an IDPSSODescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct('md:PDPDescriptor', $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AuthzService') as $ep) {
- $this->AuthzService[] = new SAML2_XML_md_EndpointType($ep);
- }
- if (empty($this->AuthzService)) {
- throw new Exception('Must have at least one AuthzService in PDPDescriptor.');
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
- $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
- }
-
-
- /**
- * Add this PDPDescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this IDPSSODescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->AuthzService)');
- assert('!empty($this->AuthzService)');
- assert('is_array($this->AssertionIDRequestService)');
- assert('is_array($this->NameIDFormat)');
-
- $e = parent::toXML($parent);
-
- foreach ($this->AuthzService as $ep) {
- $ep->toXML($e, 'md:AuthzService');
- }
-
- foreach ($this->AssertionIDRequestService as $ep) {
- $ep->toXML($e, 'md:AssertionIDRequestService');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:NameIDFormat', FALSE, $this->NameIDFormat);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/RequestedAttribute.php b/lib/SAML2/XML/md/RequestedAttribute.php
deleted file mode 100644
index 124a25d..0000000
--- a/lib/SAML2/XML/md/RequestedAttribute.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 metadata RequestedAttribute.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_RequestedAttribute extends SAML2_XML_saml_Attribute {
-
- /**
- * Whether this attribute is required.
- *
- * @var bool|NULL
- */
- public $isRequired = NULL;
-
-
- /**
- * Initialize an RequestedAttribute.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct($xml);
-
- if ($xml === NULL) {
- return;
- }
-
- $this->isRequired = SAML2_Utils::parseBoolean($xml, 'isRequired', NULL);
- }
-
-
- /**
- * Convert this RequestedAttribute to XML.
- *
- * @param DOMElement $parent The element we should append this RequestedAttribute to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_bool($this->isRequired) || is_null($this->isRequired)');
-
- $e = $this->toXMLInternal($parent, SAML2_Const::NS_MD, 'md:RequestedAttribute');
-
- if ($this->isRequired === TRUE) {
- $e->setAttribute('isRequired', 'true');
- } elseif ($this->isRequired === FALSE) {
- $e->setAttribute('isRequired', 'false');
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/RoleDescriptor.php b/lib/SAML2/XML/md/RoleDescriptor.php
deleted file mode 100644
index 346d34c..0000000
--- a/lib/SAML2/XML/md/RoleDescriptor.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 RoleDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_RoleDescriptor extends SAML2_SignedElementHelper {
-
- /**
- * The name of this descriptor element.
- *
- * @var string
- */
- private $elementName;
-
-
- /**
- * The ID of this element.
- *
- * @var string|NULL
- */
- public $ID;
-
-
- /**
- * How long this element is valid, as a unix timestamp.
- *
- * @var int|NULL
- */
- public $validUntil;
-
-
- /**
- * The length of time this element can be cached, as string.
- *
- * @var string|NULL
- */
- public $cacheDuration;
-
-
- /**
- * List of supported protocols.
- *
- * @var array
- */
- public $protocolSupportEnumeration = array();
-
-
- /**
- * Error URL for this role.
- *
- * @var string|NULL
- */
- public $errorURL;
-
-
- /**
- * Extensions on this element.
- *
- * Array of extension elements.
- *
- * @var array
- */
- public $Extensions = array();
-
-
- /**
- * KeyDescriptor elements.
- *
- * Array of SAML2_XML_md_KeyDescriptor elements.
- *
- * @var array
- */
- public $KeyDescriptor = array();
-
-
- /**
- * Organization of this role.
- *
- * @var SAML2_XML_md_Organization|NULL
- */
- public $Organization = NULL;
-
-
- /**
- * ContactPerson elements for this role.
- *
- * Array of SAML2_XML_md_ContactPerson objects.
- *
- * @var array
- */
- public $ContactPerson = array();
-
-
- /**
- * Initialize a RoleDescriptor.
- *
- * @param string $elementName The name of this element.
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- protected function __construct($elementName, DOMElement $xml = NULL) {
- assert('is_string($elementName)');
-
- parent::__construct($xml);
- $this->elementName = $elementName;
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('ID')) {
- $this->ID = $xml->getAttribute('ID');
- }
- if ($xml->hasAttribute('validUntil')) {
- $this->validUntil = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('validUntil'));
- }
- if ($xml->hasAttribute('cacheDuration')) {
- $this->cacheDuration = $xml->getAttribute('cacheDuration');
- }
-
- if (!$xml->hasAttribute('protocolSupportEnumeration')) {
- throw new Exception('Missing protocolSupportEnumeration attribute on ' . $xml->localName);
- }
- $this->protocolSupportEnumeration = preg_split('/[\s]+/', $xml->getAttribute('protocolSupportEnumeration'));
-
- if ($xml->hasAttribute('errorURL')) {
- $this->errorURL = $xml->getAttribute('errorURL');
- }
-
-
- $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
- $this->KeyDescriptor[] = new SAML2_XML_md_KeyDescriptor($kd);
- }
-
- $organization = SAML2_Utils::xpQuery($xml, './saml_metadata:Organization');
- if (count($organization) > 1) {
- throw new Exception('More than one Organization in the entity.');
- } elseif (!empty($organization)) {
- $this->Organization = new SAML2_XML_md_Organization($organization[0]);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
- $this->contactPersons[] = new SAML2_XML_md_ContactPerson($cp);
- }
- }
-
-
- /**
- * Add this RoleDescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this endpoint to.
- * @param string $name The name of the element we should create.
- */
- protected function toXML(DOMElement $parent) {
- assert('is_null($this->ID) || is_string($this->ID)');
- assert('is_null($this->validUntil) || is_int($this->validUntil)');
- assert('is_null($this->cacheDuration) || is_string($this->cacheDuration)');
- assert('is_array($this->protocolSupportEnumeration)');
- assert('is_null($this->errorURL) || is_string($this->errorURL)');
- assert('is_array($this->Extensions)');
- assert('is_array($this->KeyDescriptor)');
- assert('is_null($this->Organization) || $this->Organization instanceof SAML2_XML_md_Organization');
- assert('is_array($this->ContactPerson)');
-
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_MD, $this->elementName);
- $parent->appendChild($e);
-
- if (isset($this->ID)) {
- $e->setAttribute('ID', $this->ID);
- }
-
- if (isset($this->validUntil)) {
- $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
- }
-
- if (isset($this->cacheDuration)) {
- $e->setAttribute('cacheDuration', $this->cacheDuration);
- }
-
- $e->setAttribute('protocolSupportEnumeration', implode(' ', $this->protocolSupportEnumeration));
-
- if (isset($this->errorURL)) {
- $e->setAttribute('errorURL', $this->errorURL);
- }
-
-
- SAML2_XML_md_Extensions::addList($e, $this->Extensions);
-
- foreach ($this->KeyDescriptor as $kd) {
- $kd->toXML($e);
- }
-
- if (isset($this->Organization)) {
- $this->Organization->toXML($e);
- }
-
- foreach ($this->ContactPerson as $cp) {
- $cp->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/SPSSODescriptor.php b/lib/SAML2/XML/md/SPSSODescriptor.php
deleted file mode 100644
index da7077e..0000000
--- a/lib/SAML2/XML/md/SPSSODescriptor.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 SPSSODescriptor.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_SPSSODescriptor extends SAML2_XML_md_SSODescriptorType {
-
- /**
- * Whether this SP signs authentication requests.
- *
- * @var bool|NULL
- */
- public $AuthnRequestsSigned = NULL;
-
-
- /**
- * Whether this SP wants the Assertion elements to be signed.
- *
- * @var bool|NULL
- */
- public $WantAssertionsSigned = NULL;
-
-
- /**
- * List of AssertionConsumerService endpoints for this SP.
- *
- * Array with IndexedEndpointType objects.
- *
- * @var array
- */
- public $AssertionConsumerService = array();
-
-
- /**
- * List of AttributeConsumingService descriptors for this SP.
- *
- * Array with SAML2_XML_md_AttribteConsumingService objects.
- *
- * @var array
- */
- public $AttributeConsumingService = array();
-
-
- /**
- * Initialize a SPSSODescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
- parent::__construct('md:SPSSODescriptor', $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- $this->AuthnRequestsSigned = SAML2_Utils::parseBoolean($xml, 'AuthnRequestsSigned', NULL);
- $this->WantAssertionsSigned = SAML2_Utils::parseBoolean($xml, 'WantAssertionsSigned', NULL);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionConsumerService') as $ep) {
- $this->AssertionConsumerService[] = new SAML2_XML_md_IndexedEndpointType($ep);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AttributeConsumingService') as $acs) {
- $this->AttributeConsumingService[] = new SAML2_XML_md_AttributeConsumingService($acs);
- }
- }
-
-
- /**
- * Add this SPSSODescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this SPSSODescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->AuthnRequestsSigned) || is_bool($this->AuthnRequestsSigned)');
- assert('is_null($this->WantAssertionsSigned) || is_bool($this->WantAssertionsSigned)');
- assert('is_array($this->AssertionConsumerService)');
- assert('is_array($this->AttributeConsumingService)');
-
- $e = parent::toXML($parent);
-
- if ($this->AuthnRequestsSigned === TRUE) {
- $e->setAttribute('AuthnRequestsSigned', 'true');
- } elseif ($this->AuthnRequestsSigned === FALSE) {
- $e->setAttribute('AuthnRequestsSigned', 'false');
- }
-
- if ($this->WantAssertionsSigned === TRUE) {
- $e->setAttribute('WantAssertionsSigned', 'true');
- } elseif ($this->WantAssertionsSigned === FALSE) {
- $e->setAttribute('WantAssertionsSigned', 'false');
- }
-
-
- foreach ($this->AssertionConsumerService as $ep) {
- $ep->toXML($e, 'md:AssertionConsumerService');
- }
-
- foreach ($this->AttributeConsumingService as $acs) {
- $acs->toXML($e);
- }
- }
-
-}
diff --git a/lib/SAML2/XML/md/SSODescriptorType.php b/lib/SAML2/XML/md/SSODescriptorType.php
deleted file mode 100644
index bdb8e96..0000000
--- a/lib/SAML2/XML/md/SSODescriptorType.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 SSODescriptorType.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-abstract class SAML2_XML_md_SSODescriptorType extends SAML2_XML_md_RoleDescriptor {
-
- /**
- * List of ArtifactResolutionService endpoints.
- *
- * Array with IndexedEndpointType objects.
- *
- * @var array
- */
- public $ArtifactResolutionService = array();
-
-
- /**
- * List of SingleLogoutService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $SingleLogoutService = array();
-
-
- /**
- * List of ManageNameIDService endpoints.
- *
- * Array with EndpointType objects.
- *
- * @var array
- */
- public $ManageNameIDService = array();
-
-
- /**
- * List of supported NameID formats.
- *
- * Array of strings.
- *
- * @var array
- */
- public $NameIDFormat = array();
-
-
- /**
- * Initialize a SSODescriptor.
- *
- * @param string $elementName The name of this element.
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- protected function __construct($elementName, DOMElement $xml = NULL) {
- assert('is_string($elementName)');
-
- parent::__construct($elementName, $xml);
-
- if ($xml === NULL) {
- return;
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ArtifactResolutionService') as $ep) {
- $this->ArtifactResolutionService[] = new SAML2_XML_md_IndexedEndpointType($ep);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:SingleLogoutService') as $ep) {
- $this->SingleLogoutService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ManageNameIDService') as $ep) {
- $this->ManageNameIDService[] = new SAML2_XML_md_EndpointType($ep);
- }
-
- $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
- }
-
-
- /**
- * Add this SSODescriptorType to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this SSODescriptorType to.
- * @param string $name The name of the element we should create.
- * @return DOMElement The generated SSODescriptor DOMElement.
- */
- protected function toXML(DOMElement $parent) {
- assert('is_array($this->ArtifactResolutionService)');
- assert('is_array($this->SingleLogoutService)');
- assert('is_array($this->ManageNameIDService)');
- assert('is_array($this->NameIDFormat)');
-
- $e = parent::toXML($parent);
-
- foreach ($this->ArtifactResolutionService as $ep) {
- $ep->toXML($e, 'md:ArtifactResolutionService');
- }
-
- foreach ($this->SingleLogoutService as $ep) {
- $ep->toXML($e, 'md:SingleLogoutService');
- }
-
- foreach ($this->ManageNameIDService as $ep) {
- $ep->toXML($e, 'md:ManageNameIDService');
- }
-
- SAML2_Utils::addStrings($e, SAML2_Const::NS_MD, 'md:NameIDFormat', FALSE, $this->NameIDFormat);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/md/UnknownRoleDescriptor.php b/lib/SAML2/XML/md/UnknownRoleDescriptor.php
deleted file mode 100644
index 66e3a79..0000000
--- a/lib/SAML2/XML/md/UnknownRoleDescriptor.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Class representing unknown RoleDescriptors.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_UnknownRoleDescriptor extends SAML2_XML_md_RoleDescriptor {
-
- /**
- * This RoleDescriptor as XML
- *
- * @var SAML2_XML_Chunk
- */
- private $xml;
-
-
- /**
- * Initialize an unknown RoleDescriptor.
- *
- * @param DOMElement $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml) {
- parent::__construct('md:RoleDescriptor', $xml);
-
- $this->xml = new SAML2_XML_Chunk($xml);
- }
-
-
- /**
- * Add this RoleDescriptor to an EntityDescriptor.
- *
- * @param DOMElement $parent The EntityDescriptor we should append this RoleDescriptor to.
- */
- public function toXML(DOMElement $parent) {
-
- $this->xml->toXML($parent);
- }
-
-}
diff --git a/lib/SAML2/XML/mdattr/EntityAttributes.php b/lib/SAML2/XML/mdattr/EntityAttributes.php
deleted file mode 100644
index 9359008..0000000
--- a/lib/SAML2/XML/mdattr/EntityAttributes.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Class for handling the EntityAttributes metadata extension.
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-metadata-attr-cs-01.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdattr_EntityAttributes {
-
- /**
- * The namespace used for the EntityAttributes extension.
- */
- const NS = 'urn:oasis:names:tc:SAML:metadata:attribute';
-
-
- /**
- * Array with child elements.
- *
- * The elements can be SAML2_XML_saml_Attribute or SAML2_XML_Chunk elements.
- *
- * @var array
- */
- public $children;
-
-
- /**
- * Create a EntityAttributes element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:Attribute|./saml_assertion:Assertion') as $node) {
- if ($node->localName === 'Attribute') {
- $this->children[] = new SAML2_XML_saml_Attribute($node);
- } else {
- $this->children[] = new SAML2_XML_Chunk($node);
- }
- }
-
- }
-
-
- /**
- * Convert this EntityAttributes to XML.
- *
- * @param DOMElement $parent The element we should append to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->children)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_mdattr_EntityAttributes::NS, 'mdattr:EntityAttributes');
- $parent->appendChild($e);
-
- if (!empty($this->children)) {
- foreach ($this->children as $child) {
- $child->toXML($e);
- }
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/mdrpi/Common.php b/lib/SAML2/XML/mdrpi/Common.php
deleted file mode 100644
index f6a4dc3..0000000
--- a/lib/SAML2/XML/mdrpi/Common.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-/**
- * Common definitions for the mdrpi metadata extension.
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdrpi_Common {
-
- const NS_MDRPI = 'urn:oasis:names:tc:SAML:metadata:rpi';
-
-}
diff --git a/lib/SAML2/XML/mdrpi/PublicationInfo.php b/lib/SAML2/XML/mdrpi/PublicationInfo.php
deleted file mode 100644
index bf6bff8..0000000
--- a/lib/SAML2/XML/mdrpi/PublicationInfo.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * Class for handling the mdrpi:PublicationInfo element.
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdrpi_PublicationInfo {
-
- /**
- * The identifier of the metadata publisher.
- *
- * @var string
- */
- public $publisher;
-
- /**
- * The creation timestamp for the metadata, as a UNIX timestamp.
- *
- * @var int|NULL
- */
- public $creationInstant;
-
- /**
- * Identifier for this metadata publication.
- *
- * @var string|NULL
- */
- public $publicationId;
-
- /**
- * Link to usage policy for this metadata.
- *
- * This is an associative array with language=>URL.
- *
- * @var array
- */
- public $UsagePolicy = array();
-
-
- /**
- * Create/parse a mdrpi:PublicationInfo element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('publisher')) {
- throw new Exception('Missing required attribute "publisher" in mdrpi:PublicationInfo element.');
- }
- $this->publisher = $xml->getAttribute('publisher');
-
- if ($xml->hasAttribute('creationInstant')) {
- $this->creationInstant = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('creationInstant'));
- }
-
- if ($xml->hasAttribute('publicationId')) {
- $this->publicationId = $xml->getAttribute('publicationId');
- }
-
- $this->UsagePolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'UsagePolicy');
- }
-
-
- /**
- * Convert this element to XML.
- *
- * @param DOMElement $parent The element we should append to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->publisher)');
- assert('is_int($this->creationInstant) || is_null($this->creationInstant)');
- assert('is_string($this->publicationId) || is_null($this->publicationId)');
- assert('is_array($this->UsagePolicy)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_mdrpi_Common::NS_MDRPI, 'mdrpi:PublicationInfo');
- $parent->appendChild($e);
-
- $e->setAttribute('publisher', $this->publisher);
-
- if ($this->creationInstant !== NULL) {
- $e->setAttribute('creationInstant', gmdate('Y-m-d\TH:i:s\Z', $this->creationInstant));
- }
-
- if ($this->publicationId !== NULL) {
- $e->setAttribute('publicationId', $this->publicationId);
- }
-
- SAML2_Utils::addStrings($e, SAML2_XML_mdrpi_Common::NS_MDRPI, 'mdrpi:UsagePolicy', TRUE, $this->UsagePolicy);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/mdrpi/RegistrationInfo.php b/lib/SAML2/XML/mdrpi/RegistrationInfo.php
deleted file mode 100644
index 4bb334a..0000000
--- a/lib/SAML2/XML/mdrpi/RegistrationInfo.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-
-/**
- * Class for handling the mdrpi:RegistrationInfo element.
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/saml-metadata-rpi/v1.0/saml-metadata-rpi-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdrpi_RegistrationInfo {
-
- /**
- * The identifier of the metadata registration authority.
- *
- * @var string
- */
- public $registrationAuthority;
-
- /**
- * The registration timestamp for the metadata, as a UNIX timestamp.
- *
- * @var int|NULL
- */
- public $registrationInstant;
-
- /**
- * Link to registration policy for this metadata.
- *
- * This is an associative array with language=>URL.
- *
- * @var array
- */
- public $RegistrationPolicy = array();
-
-
- /**
- * Create/parse a mdrpi:RegistrationInfo element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('registrationAuthority')) {
- throw new Exception('Missing required attribute "registrationAuthority" in mdrpi:RegistrationInfo element.');
- }
- $this->registrationAuthority = $xml->getAttribute('registrationAuthority');
-
- if ($xml->hasAttribute('registrationInstant')) {
- $this->registrationInstant = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('registrationInstant'));
- }
-
- $this->RegistrationPolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'RegistrationPolicy');
- }
-
-
- /**
- * Convert this element to XML.
- *
- * @param DOMElement $parent The element we should append to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->registrationAuthority)');
- assert('is_int($this->registrationInstant) || is_null($this->registrationInstant)');
- assert('is_array($this->RegistrationPolicy)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_mdrpi_Common::NS_MDRPI, 'mdrpi:RegistrationInfo');
- $parent->appendChild($e);
-
- $e->setAttribute('registrationAuthority', $this->registrationAuthority);
-
- if ($this->registrationInstant !== NULL) {
- $e->setAttribute('registrationInstant', gmdate('Y-m-d\TH:i:s\Z', $this->registrationInstant));
- }
-
- SAML2_Utils::addStrings($e, SAML2_XML_mdrpi_Common::NS_MDRPI, 'mdrpi:RegistrationPolicy', TRUE, $this->RegistrationPolicy);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/mdui/DiscoHints.php b/lib/SAML2/XML/mdui/DiscoHints.php
deleted file mode 100644
index 8ff510d..0000000
--- a/lib/SAML2/XML/mdui/DiscoHints.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * Class for handling the metadata extensions for login and discovery user interface
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdui_DiscoHints {
-
- /**
- * The namespace used for the DiscoHints extension.
- */
- const NS = 'urn:oasis:names:tc:SAML:metadata:ui';
-
-
- /**
- * Array with child elements.
- *
- * The elements can be any of the other SAML2_XML_mdui_* elements.
- *
- * @var array
- */
- public $children = array();
-
-
- /**
- * The IPHint, as an array of strings.
- *
- * @var array
- */
- public $IPHint = array();
-
-
- /**
- * The DomainHint, as an array of strings.
- *
- * @var array
- */
- public $DomainHint = array();
-
-
- /**
- * The GeolocationHint, as an array of strings.
- *
- * @var array
- */
- public $GeolocationHint = array();
-
- /**
- * Create a DiscoHints element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->IPHint = SAML2_Utils::extractStrings($xml, self::NS, 'IPHint');
- $this->DomainHint = SAML2_Utils::extractStrings($xml, self::NS, 'DomainHint');
- $this->GeolocationHint = SAML2_Utils::extractStrings($xml, self::NS, 'GeolocationHint');
-
- foreach (SAML2_Utils::xpQuery($xml, "./*[namespace-uri()!='".self::NS."']") as $node) {
- $this->children[] = new SAML2_XML_Chunk($node);
- }
- }
-
-
- /**
- * Convert this DiscoHints to XML.
- *
- * @param DOMElement $parent The element we should append to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->IPHint)');
- assert('is_array($this->DomainHint)');
- assert('is_array($this->GeolocationHint)');
- assert('is_array($this->children)');
-
- if (!empty($this->IPHint)
- || !empty($this->DomainHint)
- || !empty($this->GeolocationHint)
- || !empty($this->children)) {
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(self::NS, 'mdui:DiscoHints');
- $parent->appendChild($e);
-
- if (!empty($this->children)) {
- foreach ($this->children as $child) {
- $child->toXML($e);
- }
- }
-
- SAML2_Utils::addStrings($e, self::NS, 'mdui:IPHint', FALSE, $this->IPHint);
- SAML2_Utils::addStrings($e, self::NS, 'mdui:DomainHint', FALSE, $this->DomainHint);
- SAML2_Utils::addStrings($e, self::NS, 'mdui:GeolocationHint', FALSE, $this->GeolocationHint);
-
- return $e;
- }
- }
-
-}
diff --git a/lib/SAML2/XML/mdui/Keywords.php b/lib/SAML2/XML/mdui/Keywords.php
deleted file mode 100644
index 161f5e9..0000000
--- a/lib/SAML2/XML/mdui/Keywords.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * Class for handling the Keywords metadata extensions for login and discovery user interface
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdui_Keywords {
-
- /**
- * The keywords of this item.
- *
- * @var string
- */
- public $Keywords;
-
-
- /**
- * The language of this item.
- *
- * @var string
- */
- public $lang;
-
-
- /**
- * Initialize a Keywords.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('xml:lang')) {
- throw new Exception('Missing lang on Keywords.');
- }
- if (!is_string($xml->textContent) || !strlen($xml->textContent)) {
- throw new Exception('Missing value for Keywords.');
- }
- $this->Keywords = array();
- foreach (explode(' ', $xml->textContent) as $keyword) {
- $this->Keywords[] = str_replace('+', ' ', $keyword);
- }
- $this->lang = $xml->getAttribute('xml:lang');
- }
-
-
- /**
- * Convert this Keywords to XML.
- *
- * @param DOMElement $parent The element we should append this Keywords to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->lang)');
- assert('is_array($this->Keywords)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_mdui_UIInfo::NS, 'mdui:Keywords');
- $e->setAttribute('xml:lang', $this->lang);
- $value = '';
- foreach ($this->Keywords as $keyword) {
- if (strpos($keyword, "+") !== false) {
- throw new Exception('Keywords may not contain a "+" character.');
- }
- $value .= str_replace(' ', '+', $keyword) . ' ';
- }
- $value = rtrim($value);
- $e->appendChild($doc->createTextNode($value));
- $parent->appendChild($e);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/mdui/Logo.php b/lib/SAML2/XML/mdui/Logo.php
deleted file mode 100644
index 93bcf53..0000000
--- a/lib/SAML2/XML/mdui/Logo.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * Class for handling the Logo metadata extensions for login and discovery user interface
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdui_Logo {
-
- /**
- * The url of this logo.
- *
- * @var string
- */
- public $url;
-
-
- /**
- * The width of this logo.
- *
- * @var string
- */
- public $width;
-
-
- /**
- * The height of this logo.
- *
- * @var string
- */
- public $height;
-
- /**
- * The language of this item.
- *
- * @var string
- */
- public $lang;
-
-
- /**
- * Initialize a Logo.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('width')) {
- throw new Exception('Missing width of Logo.');
- }
- if (!$xml->hasAttribute('height')) {
- throw new Exception('Missing height of Logo.');
- }
- if (!is_string($xml->textContent) || !strlen($xml->textContent)) {
- throw new Exception('Missing url value for Logo.');
- }
- $this->url = $xml->textContent;
- $this->width = (int)$xml->getAttribute('width');
- $this->height = (int)$xml->getAttribute('height');
- $this->lang = $xml->hasAttribute('xml:lang') ? $xml->getAttribute('xml:lang') : NULL;
- }
-
-
- /**
- * Convert this Logo to XML.
- *
- * @param DOMElement $parent The element we should append this Logo to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_int($this->width)');
- assert('is_int($this->height)');
- assert('is_string($this->url)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_mdui_UIInfo::NS, 'mdui:Logo');
- $e->appendChild($doc->createTextNode($this->url));
- $e->setAttribute('width', (int)$this->width);
- $e->setAttribute('height', (int)$this->height);
- if (isset($this->lang)) {
- $e->setAttribute('xml:lang', $this->lang);
- }
- $parent->appendChild($e);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/mdui/UIInfo.php b/lib/SAML2/XML/mdui/UIInfo.php
deleted file mode 100644
index 2023abe..0000000
--- a/lib/SAML2/XML/mdui/UIInfo.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-
-/**
- * Class for handling the metadata extensions for login and discovery user interface
- *
- * @link: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_mdui_UIInfo {
-
- /**
- * The namespace used for the UIInfo extension.
- */
- const NS = 'urn:oasis:names:tc:SAML:metadata:ui';
-
-
- /**
- * Array with child elements.
- *
- * The elements can be any of the other SAML2_XML_mdui_* elements.
- *
- * @var array
- */
- public $children = array();
-
- /**
- * The DisplayName, as an array of language => translation.
- *
- * @var array
- */
- public $DisplayName = array();
-
- /**
- * The Description, as an array of language => translation.
- *
- * @var array
- */
- public $Description = array();
-
- /**
- * The InformationURL, as an array of language => url.
- *
- * @var array
- */
- public $InformationURL = array();
-
- /**
- * The PrivacyStatementURL, as an array of language => url.
- *
- * @var array
- */
- public $PrivacyStatementURL = array();
-
- /**
- * The Keywords, as an array of language => array of strings.
- *
- * @var array
- */
- public $Keywords = array();
-
- /**
- * The Logo, as an array of associative arrays containing url, width, height, and optional lang.
- *
- * @var array
- */
- public $Logo = array();
-
-
- /**
- * Create a UIInfo element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->DisplayName = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'DisplayName');
- $this->Description = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'Description');
- $this->InformationURL = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'InformationURL');
- $this->PrivacyStatementURL = SAML2_Utils::extractLocalizedStrings($xml, self::NS, 'PrivacyStatementURL');
-
- foreach (SAML2_Utils::xpQuery($xml, './*') as $node) {
- if ($node->namespaceURI === self::NS) {
- switch ($node->localName) {
- case 'Keywords':
- $this->Keywords[] = new SAML2_XML_mdui_Keywords($node);
- break;
- case 'Logo':
- $this->Logo[] = new SAML2_XML_mdui_Logo($node);
- break;
- }
- } else {
- $this->children[] = new SAML2_XML_Chunk($node);
- }
- }
- }
-
-
- /**
- * Convert this UIInfo to XML.
- *
- * @param DOMElement $parent The element we should append to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_array($this->DisplayName)');
- assert('is_array($this->InformationURL)');
- assert('is_array($this->PrivacyStatementURL)');
- assert('is_array($this->Keywords)');
- assert('is_array($this->Logo)');
- assert('is_array($this->children)');
-
- if (!empty($this->DisplayName)
- || !empty($this->Description)
- || !empty($this->InformationURL)
- || !empty($this->PrivacyStatementURL)
- || !empty($this->Keywords)
- || !empty($this->Logo)
- || !empty($this->children)) {
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(self::NS, 'mdui:UIInfo');
- $parent->appendChild($e);
-
- SAML2_Utils::addStrings($e, self::NS, 'mdui:DisplayName', TRUE, $this->DisplayName);
- SAML2_Utils::addStrings($e, self::NS, 'mdui:Description', TRUE, $this->Description);
- SAML2_Utils::addStrings($e, self::NS, 'mdui:InformationURL', TRUE, $this->InformationURL);
- SAML2_Utils::addStrings($e, self::NS, 'mdui:PrivacyStatementURL', TRUE, $this->PrivacyStatementURL);
-
- if (!empty($this->Keywords)) {
- foreach ($this->Keywords as $child) {
- $child->toXML($e);
- }
- }
-
- if (!empty($this->Logo)) {
- foreach ($this->Logo as $child) {
- $child->toXML($e);
- }
- }
-
- if (!empty($this->children)) {
- foreach ($this->children as $child) {
- $child->toXML($e);
- }
- }
- }
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/saml/Attribute.php b/lib/SAML2/XML/saml/Attribute.php
deleted file mode 100644
index afbf0cb..0000000
--- a/lib/SAML2/XML/saml/Attribute.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 Attribute.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_saml_Attribute {
-
- /**
- * The Name of this attribute.
- *
- * @var string
- */
- public $Name;
-
-
- /**
- * The NameFormat of this attribute.
- *
- * @var string|NULL
- */
- public $NameFormat;
-
-
- /**
- * The FriendlyName of this attribute.
- *
- * @var string|NULL
- */
- public $FriendlyName = NULL;
-
-
- /**
- * List of attribute values.
- *
- * Array of SAML2_XML_saml_AttributeValue elements.
- *
- * @var array
- */
- public $AttributeValue = array();
-
-
- /**
- * Initialize an Attribute.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('Name')) {
- throw new Exception('Missing Name on Attribute.');
- }
- $this->Name = $xml->getAttribute('Name');
-
- if ($xml->hasAttribute('NameFormat')) {
- $this->NameFormat = $xml->getAttribute('NameFormat');
- }
-
- if ($xml->hasAttribute('FriendlyName')) {
- $this->FriendlyName = $xml->getAttribute('FriendlyName');
- }
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:AttributeValue') as $av) {
- $this->AttributeValue[] = new SAML2_XML_saml_AttributeValue($av);
- }
- }
-
-
- /**
- * Internal implementation of toXML.
- * This function allows RequestedAttribute to specify the element name and namespace.
- *
- * @param DOMElement $parent The element we should append this Attribute to.
- * @param string $namespace The namespace the element should be created in.
- * @param string $name The name of the element.
- */
- protected function toXMLInternal(DOMElement $parent, $namespace, $name) {
- assert('is_string($namespace)');
- assert('is_string($name)');
- assert('is_string($this->Name)');
- assert('is_null($this->NameFormat) || is_string($this->NameFormat)');
- assert('is_null($this->FriendlyName) || is_string($this->FriendlyName)');
- assert('is_array($this->AttributeValue)');
-
- $e = $parent->ownerDocument->createElementNS($namespace, $name);
- $parent->appendChild($e);
-
- $e->setAttribute('Name', $this->Name);
-
- if (isset($this->NameFormat)) {
- $e->setAttribute('NameFormat', $this->NameFormat);
- }
-
- if (isset($this->FriendlyName)) {
- $e->setAttribute('FriendlyName', $this->FriendlyName);
- }
-
- foreach ($this->AttributeValue as $av) {
- $av->toXML($e);
- }
-
- return $e;
- }
-
-
- /**
- * Convert this Attribute to XML.
- *
- * @param DOMElement $parent The element we should append this Attribute to.
- */
- public function toXML(DOMElement $parent) {
- return $this->toXMLInternal($parent, SAML2_Const::NS_SAML, 'saml:Attribute');
- }
-
-}
diff --git a/lib/SAML2/XML/saml/AttributeValue.php b/lib/SAML2/XML/saml/AttributeValue.php
deleted file mode 100644
index bc89055..0000000
--- a/lib/SAML2/XML/saml/AttributeValue.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-/**
- * Class representing an AttributeValue.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_saml_AttributeValue {
-
- /**
- * The raw DOMElement representing this value.
- *
- * @var DOMElement
- */
- public $element;
-
-
- /**
- * Create an AttributeValue.
- *
- * @param mixed $value
- * The value of this element.
- * Can be one of:
- * - string Create an attribute value with a simple string.
- * - DOMElement(AttributeValue) Create an attribute value of the given DOMElement.
- * - DOMElement Create an attribute value with the given DOMElement as a child.
- */
- public function __construct($value) {
- assert('is_string($value) || $value instanceof DOMElement');
-
- if (is_string($value)) {
- $doc = new DOMDocument();
- $this->element = $doc->createElementNS(SAML2_Const::NS_SAML, 'saml:AttributeValue');
- $this->element->setAttributeNS(SAML2_Const::NS_XSI, 'xsi:type', 'xs:string');
- $this->element->appendChild($doc->createTextNode($value));
-
- /* Make sure that the xs-namespace is available in the AttributeValue (for xs:string). */
- $this->element->setAttributeNS(SAML2_Const::NS_XS, 'xs:tmp', 'tmp');
- $this->element->removeAttributeNS(SAML2_Const::NS_XS, 'tmp');
-
- return;
- }
-
- if ($value->namespaceURI === SAML2_Const::NS_SAML && $value->localName === 'AttributeValue') {
- $this->element = SAML2_Utils::copyElement($value);
- return;
- }
-
- $doc = new DOMDocument();
- $this->element = $doc->createElementNS(SAML2_Const::NS_SAML, 'saml:AttributeValue');
- SAML2_Utils::copyElement($value, $this->element);
- }
-
-
- /**
- * Append this attribute value to an element.
- *
- * @param DOMElement $parent The element we should append this attribute value to.
- * @return DOMElement The generated AttributeValue element.
- */
- public function toXML(DOMElement $parent) {
- assert('$this->element instanceof DOMElement');
- assert('$this->element->namespaceURI === SAML2_Const::NS_SAML && $this->element->localName === "AttributeValue"');
-
- $v = SAML2_Utils::copyElement($this->element, $parent);
-
- return $v;
- }
-
- /*
- * Returns a plain text content of the attribute value.
- */
- public function getString() {
- return $this->element->textContent;
- }
-
-
- /**
- * Convert this attribute value to a string.
- *
- * If this element contains XML data, that data vil be encoded as a string and returned.
- *
- * @return string This attribute value.
- */
- public function __toString() {
- assert('$this->element instanceof DOMElement');
-
- $doc = $this->element->ownerDocument;
-
- $ret = '';
- foreach ($this->element->childNodes as $c) {
- $ret .= $doc->saveXML($c);
- }
-
- return $ret;
- }
-
-}
diff --git a/lib/SAML2/XML/saml/NameID.php b/lib/SAML2/XML/saml/NameID.php
deleted file mode 100644
index b31a00c..0000000
--- a/lib/SAML2/XML/saml/NameID.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-/**
- * Class representing the saml:NameID element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_saml_NameID {
-
- /**
- * The NameQualifier or the NameID.
- *
- * @var string|NULL
- */
- public $NameQualifier;
-
- /**
- * The SPNameQualifier or the NameID.
- *
- * @var string|NULL
- */
- public $SPNameQualifier;
-
-
- /**
- * The Format or the NameID.
- *
- * @var string|NULL
- */
- public $Format;
-
-
- /**
- * The SPProvidedID or the NameID.
- *
- * @var string|NULL
- */
- public $SPProvidedID;
-
-
- /**
- * The value of this NameID.
- *
- * @var string
- */
- public $value;
-
-
- /**
- * Initialize a saml:NameID.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('SPNameQualifier')) {
- $this->SPNameQualifier = $xml->getAttribute('SPNameQualifier');
- }
-
- if ($xml->hasAttribute('NameQualifier')) {
- $this->NameQualifier = $xml->getAttribute('NameQualifier');
- }
-
- if ($xml->hasAttribute('Format')) {
- $this->Format = $xml->getAttribute('Format');
- }
-
- if ($xml->hasAttribute('SPProvidedID')) {
- $this->SPProvidedID = $xml->getAttribute('SPProvidedID');
- }
-
- $this->value = trim($xml->textContent);
- }
-
-
- /**
- * Convert this NameID to XML.
- *
- * @param DOMElement|NULL $parent The element we should append to.
- * @return DOMElement This AdditionalMetadataLocation-element.
- */
- public function toXML(DOMElement $parent = NULL) {
- assert('is_string($this->NameQualifier) || is_null($this->NameQualifier)');
- assert('is_string($this->SPNameQualifier) || is_null($this->SPNameQualifier)');
- assert('is_string($this->Format) || is_null($this->Format)');
- assert('is_string($this->SPProvidedID) || is_null($this->SPProvidedID)');
- assert('is_string($this->value)');
-
- if ($parent === NULL) {
- $parent = new DOMDocument();
- $doc = $parent;
- } else {
- $doc = $parent->ownerDocument;
- }
- $e = $doc->createElementNS(SAML2_Const::NS_SAML, 'saml:NameID');
- $parent->appendChild($e);
-
- if ($this->NameQualifier !== NULL) {
- $e->setAttribute('NameQualifier', $this->NameQualifier);
- }
-
- if ($this->SPNameQualifier !== NULL) {
- $e->setAttribute('SPNameQualifier', $this->SPNameQualifier);
- }
-
- if ($this->Format !== NULL) {
- $e->setAttribute('Format', $this->Format);
- }
-
- if ($this->SPProvidedID !== NULL) {
- $e->setAttribute('SPProvidedID', $this->SPProvidedID);
- }
-
- $t = $doc->createTextNode($this->value);
- $e->appendChild($t);
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/saml/SubjectConfirmation.php b/lib/SAML2/XML/saml/SubjectConfirmation.php
deleted file mode 100644
index 857ee4b..0000000
--- a/lib/SAML2/XML/saml/SubjectConfirmation.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 SubjectConfirmation element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_saml_SubjectConfirmation {
-
- /**
- * The method we can use to verify this Subject.
- *
- * @var string
- */
- public $Method;
-
-
- /**
- * The NameID of the entity that can use this element to verify the Subject.
- *
- * @var SAML2_XML_saml_NameID|NULL
- */
- public $NameID;
-
-
- /**
- * SubjectConfirmationData element with extra data for verification of the Subject.
- *
- * @var SAML2_XML_saml_SubjectConfirmationData|NULL
- */
- public $SubjectConfirmationData;
-
-
- /**
- * Initialize (and parse? a SubjectConfirmation element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if (!$xml->hasAttribute('Method')) {
- throw new Exception('SubjectConfirmation element without Method attribute.');
- }
- $this->Method = $xml->getAttribute('Method');
-
- $nid = SAML2_Utils::xpQuery($xml, './saml_assertion:NameID');
- if (count($nid) > 1) {
- throw new Exception('More than one NameID in a SubjectConfirmation element.');
- } elseif (!empty($nid)) {
- $this->NameID = new SAML2_XML_saml_NameID($nid[0]);
- }
-
- $scd = SAML2_Utils::xpQuery($xml, './saml_assertion:SubjectConfirmationData');
- if (count($scd) > 1) {
- throw new Exception('More than one SubjectConfirmationData child in a SubjectConfirmation element.');
- } elseif (!empty($scd)) {
- $this->SubjectConfirmationData = new SAML2_XML_saml_SubjectConfirmationData($scd[0]);
- }
- }
-
-
- /**
- * Convert this element to XML.
- *
- * @param DOMElement $parent The parent element we should append this element to.
- * @return DOMElement This element, as XML.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->Method)');
- assert('is_null($this->NameID) || $this->NameID instanceof SAML2_XML_saml_NameID');
- assert('is_null($this->SubjectConfirmationData) || $this->SubjectConfirmationData instanceof SAML2_XML_saml_SubjectConfirmationData');
-
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_SAML, 'saml:SubjectConfirmation');
- $parent->appendChild($e);
-
- $e->setAttribute('Method', $this->Method);
-
- if (isset($this->NameID)) {
- $this->NameID->toXML($e);
- }
- if (isset($this->SubjectConfirmationData)) {
- $this->SubjectConfirmationData->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/saml/SubjectConfirmationData.php b/lib/SAML2/XML/saml/SubjectConfirmationData.php
deleted file mode 100644
index 1c28c65..0000000
--- a/lib/SAML2/XML/saml/SubjectConfirmationData.php
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-
-/**
- * Class representing SAML 2 SubjectConfirmationData element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_saml_SubjectConfirmationData {
-
- /**
- * The time before this element is valid, as an unix timestamp.
- *
- * @var int|NULL
- */
- public $NotBefore;
-
-
- /**
- * The time after which this element is invalid, as an unix timestamp.
- *
- * @var int|NULL
- */
- public $NotOnOrAfter;
-
-
- /**
- * The Recipient this Subject is valid for. Either an entity or a location.
- *
- * @var string|NULL
- */
- public $Recipient;
-
-
- /**
- * The ID of the AuthnRequest this is a response to.
- *
- * @var string|NULL
- */
- public $InResponseTo;
-
-
- /**
- * The IP(v6) address of the user.
- *
- * @var string|NULL
- */
- public $Address;
-
-
- /**
- * The various key information elements.
- *
- * Array with various elements describing this key.
- * Unknown elements will be represented by SAML2_XML_Chunk.
- *
- * @var array
- */
- public $info = array();
-
-
- /**
- * Initialize (and parse) a SubjectConfirmationData element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('NotBefore')) {
- $this->NotBefore = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('NotBefore'));
- }
- if ($xml->hasAttribute('NotOnOrAfter')) {
- $this->NotOnOrAfter = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('NotOnOrAfter'));
- }
- if ($xml->hasAttribute('Recipient')) {
- $this->Recipient = $xml->getAttribute('Recipient');
- }
- if ($xml->hasAttribute('InResponseTo')) {
- $this->InResponseTo = $xml->getAttribute('InResponseTo');
- }
- if ($xml->hasAttribute('Address')) {
- $this->Address = $xml->getAttribute('Address');
- }
- for ($n = $xml->firstChild; $n !== NULL; $n = $n->nextSibling) {
- if (!($n instanceof DOMElement)) {
- continue;
- }
- if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
- $this->info[] = new SAML2_XML_Chunk($n);
- continue;
- }
- switch ($n->localName) {
- case 'KeyInfo':
- $this->info[] = new SAML2_XML_ds_KeyInfo($n);
- break;
- default:
- $this->info[] = new SAML2_XML_Chunk($n);
- break;
- }
- }
- }
-
-
- /**
- * Convert this element to XML.
- *
- * @param DOMElement $parent The parent element we should append this element to.
- * @return DOMElement This element, as XML.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->NotBefore) || is_int($this->NotBefore)');
- assert('is_null($this->NotOnOrAfter) || is_int($this->NotOnOrAfter)');
- assert('is_null($this->Recipient) || is_string($this->Recipient)');
- assert('is_null($this->InResponseTo) || is_string($this->InResponseTo)');
- assert('is_null($this->Address) || is_string($this->Address)');
-
- $e = $parent->ownerDocument->createElementNS(SAML2_Const::NS_SAML, 'saml:SubjectConfirmationData');
- $parent->appendChild($e);
-
- if (isset($this->NotBefore)) {
- $e->setAttribute('NotBefore', gmdate('Y-m-d\TH:i:s\Z', $this->NotBefore));
- }
- if (isset($this->NotOnOrAfter)) {
- $e->setAttribute('NotOnOrAfter', gmdate('Y-m-d\TH:i:s\Z', $this->NotOnOrAfter));
- }
- if (isset($this->Recipient)) {
- $e->setAttribute('Recipient', $this->Recipient);
- }
- if (isset($this->InResponseTo)) {
- $e->setAttribute('InResponseTo', $this->InResponseTo);
- }
- if (isset($this->Address)) {
- $e->setAttribute('Address', $this->Address);
- }
- foreach ($this->info as $n) {
- $n->toXML($e);
- }
-
- return $e;
- }
-
-}
diff --git a/lib/SAML2/XML/samlp/Extensions.php b/lib/SAML2/XML/samlp/Extensions.php
deleted file mode 100644
index ad86c3f..0000000
--- a/lib/SAML2/XML/samlp/Extensions.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Class for handling SAML2 extensions.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_samlp_Extensions {
-
- /**
- * Get a list of Extensions in the given element.
- *
- * @param DOMElement $parent The element that may contain the samlp:Extensions element.
- * @return array Array of extensions.
- */
- public static function getList(DOMElement $parent) {
-
- $ret = array();
- foreach (SAML2_Utils::xpQuery($parent, './saml_protocol:Extensions/*') as $node) {
- $ret[] = new SAML2_XML_Chunk($node);
- }
-
- return $ret;
- }
-
-
- /**
- * Add a list of Extensions to the given element.
- *
- * @param DOMElement $parent The element we should add the extensions to.
- * @param array $extensions List of extension objects.
- */
- public static function addList(DOMElement $parent, array $extensions) {
-
- if (empty($extensions)) {
- return;
- }
-
- $extElement = $parent->ownerDocument->createElementNS(SAML2_Const::NS_SAMLP, 'samlp:Extensions');
- $parent->appendChild($extElement);
-
- foreach ($extensions as $ext) {
- $ext->toXML($extElement);
- }
- }
-
-}
diff --git a/lib/SAML2/XML/shibmd/Scope.php b/lib/SAML2/XML/shibmd/Scope.php
deleted file mode 100644
index 9847546..0000000
--- a/lib/SAML2/XML/shibmd/Scope.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * Class which represents the Scope element found in Shibboleth metadata.
- *
- * @link https://wiki.shibboleth.net/confluence/display/SHIB/ShibbolethMetadataProfile
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_shibmd_Scope {
-
- /**
- * The namespace used for the Scope extension element.
- */
- const NS = 'urn:mace:shibboleth:metadata:1.0';
-
-
- /**
- * The scope.
- *
- * @var string
- */
- public $scope;
-
- /**
- * Whether this is a regexp scope.
- *
- * @var bool|NULL
- */
- public $regexp = NULL;
-
-
- /**
- * Create a Scope.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- $this->scope = $xml->textContent;
- $this->regexp = SAML2_Utils::parseBoolean($xml, 'regexp', NULL);
- }
-
-
- /**
- * Convert this Scope to XML.
- *
- * @param DOMElement $parent The element we should append this Scope to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_string($this->scope)');
- assert('is_bool($this->regexp) || is_null($this->regexp)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_XML_shibmd_Scope::NS, 'shibmd:Scope');
- $parent->appendChild($e);
-
- $e->appendChild($doc->createTextNode($this->scope));
-
- if ($this->regexp === TRUE) {
- $e->setAttribute('regexp', 'true');
- } elseif ($this->regexp === FALSE) {
- $e->setAttribute('regexp', 'false');
- }
-
- return $e;
- }
-
-}