Beispiel #1
0
 /**
  * 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;
 }
 /**
  * Convert this EntitiesDescriptor to XML.
  *
  * @param DOMElement|NULL $parent The EntitiesDescriptor we should append this EntitiesDescriptor to.
  * @return DOMElement
  */
 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);
     /** @var SAML2_XML_md_EntityDescriptor|SAML2_XML_md_EntitiesDescriptor $node */
     foreach ($this->children as $node) {
         $node->toXML($e);
     }
     $this->signElement($e, $e->firstChild);
     return $e;
 }
 /**
  * Create this EntityDescriptor.
  *
  * @param DOMElement|NULL $parent The EntitiesDescriptor we should append this EntityDescriptor to.
  * @return DOMElement
  */
 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);
     /** @var SAML2_XML_md_UnknownRoleDescriptor|SAML2_XML_md_IDPSSODescriptor|SAML2_XML_md_SPSSODescriptor|SAML2_XML_md_AuthnAuthorityDescriptor|SAML2_XML_md_AttributeAuthorityDescriptor|SAML2_XML_md_PDPDescriptor $n */
     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;
 }
Beispiel #4
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;
 }
 /**
  * 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;
 }
 /**
  * Add this RoleDescriptor to an EntityDescriptor.
  *
  * @param DOMElement $parent The EntityDescriptor we should append this endpoint to.
  * @return DOMElement
  */
 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;
 }