/** * Convert the response message to an XML element. * * @return DOMElement This response. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); $artifactelement = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'Artifact', $this->artifact); $root->appendChild($artifactelement); return $root; }
/** * Convert this authentication request to an XML element. * * @return DOMElement This authentication request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); if ($this->forceAuthn) { $root->setAttribute('ForceAuthn', 'true'); } if ($this->isPassive) { $root->setAttribute('IsPassive', 'true'); } if ($this->assertionConsumerServiceURL !== NULL) { $root->setAttribute('AssertionConsumerServiceURL', $this->assertionConsumerServiceURL); } if ($this->protocolBinding !== NULL) { $root->setAttribute('ProtocolBinding', $this->protocolBinding); } if (!empty($this->nameIdPolicy)) { $nameIdPolicy = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'NameIDPolicy'); if (array_key_exists('Format', $this->nameIdPolicy)) { $nameIdPolicy->setAttribute('Format', $this->nameIdPolicy['Format']); } if (array_key_exists('SPNameQualifier', $this->nameIdPolicy)) { $nameIdPolicy->setAttribute('SPNameQualifier', $this->nameIdPolicy['SPNameQualifier']); } if (array_key_exists('AllowCreate', $this->nameIdPolicy) && $this->nameIdPolicy['AllowCreate']) { $nameIdPolicy->setAttribute('AllowCreate', 'true'); } $root->appendChild($nameIdPolicy); } $rac = $this->requestedAuthnContext; if (!empty($rac) && !empty($rac['AuthnContextClassRef'])) { $e = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'RequestedAuthnContext'); $root->appendChild($e); if (isset($rac['Comparison']) && $rac['Comparison'] !== 'exact') { $e->setAttribute('Comparison', $rac['Comparison']); } foreach ($rac['AuthnContextClassRef'] as $accr) { $i = $this->document->createElementNS(SAML2_Const::NS_SAML, 'AuthnContextClassRef'); $i->appendChild($this->document->createTextNode($accr)); $e->appendChild($i); } } if (count($this->IDPList) > 0) { $scoping = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'Scoping'); $idplist = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'IDPList'); foreach ($this->IDPList as $provider) { $idpEntry = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'IDPEntry'); $idpEntry->setAttribute('ProviderID', $provider); $idplist->appendChild($idpEntry); } $scoping->appendChild($idplist); $root->appendChild($scoping); } return $root; }
/** * Convert subject query message to an XML element. * * @return DOMElement This subject query. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); $subject = $root->ownerDocument->createElementNS(SAML2_Const::NS_SAML, 'saml:Subject'); $root->appendChild($subject); SAML2_Utils::addNameId($subject, $this->nameId); return $root; }
/** * Convert this authentication request to an XML element. * * @return DOMElement This authentication request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); if ($this->forceAuthn) { $root->setAttribute('ForceAuthn', 'true'); } if ($this->isPassive) { $root->setAttribute('IsPassive', 'true'); } if ($this->assertionConsumerServiceIndex !== NULL) { $root->setAttribute('AssertionConsumerServiceIndex', $this->assertionConsumerServiceIndex); } else { if ($this->assertionConsumerServiceURL !== NULL) { $root->setAttribute('AssertionConsumerServiceURL', $this->assertionConsumerServiceURL); } if ($this->protocolBinding !== NULL) { $root->setAttribute('ProtocolBinding', $this->protocolBinding); } } if ($this->attributeConsumingServiceIndex !== NULL) { $root->setAttribute('AttributeConsumingServiceIndex', $this->attributeConsumingServiceIndex); } if (!empty($this->nameIdPolicy)) { $nameIdPolicy = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'NameIDPolicy'); if (array_key_exists('Format', $this->nameIdPolicy)) { $nameIdPolicy->setAttribute('Format', $this->nameIdPolicy['Format']); } if (array_key_exists('SPNameQualifier', $this->nameIdPolicy)) { $nameIdPolicy->setAttribute('SPNameQualifier', $this->nameIdPolicy['SPNameQualifier']); } if (array_key_exists('AllowCreate', $this->nameIdPolicy) && $this->nameIdPolicy['AllowCreate']) { $nameIdPolicy->setAttribute('AllowCreate', 'true'); } $root->appendChild($nameIdPolicy); } $rac = $this->requestedAuthnContext; if (!empty($rac) && !empty($rac['AuthnContextClassRef'])) { $e = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'RequestedAuthnContext'); $root->appendChild($e); if (isset($rac['Comparison']) && $rac['Comparison'] !== 'exact') { $e->setAttribute('Comparison', $rac['Comparison']); } foreach ($rac['AuthnContextClassRef'] as $accr) { SAML2_Utils::addString($e, SAML2_Const::NS_SAML, 'AuthnContextClassRef', $accr); } } if (!empty($this->extensions)) { SAML2_XML_samlp_Extensions::addList($root, $this->extensions); } if ($this->ProxyCount !== NULL || count($this->IDPList) > 0 || count($this->RequesterID) > 0) { $scoping = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'Scoping'); $root->appendChild($scoping); if ($this->ProxyCount !== NULL) { $scoping->setAttribute('ProxyCount', $this->ProxyCount); } if (count($this->IDPList) > 0) { $idplist = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'IDPList'); foreach ($this->IDPList as $provider) { $idpEntry = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'IDPEntry'); $idpEntry->setAttribute('ProviderID', $provider); $idplist->appendChild($idpEntry); } $scoping->appendChild($idplist); } if (count($this->RequesterID) > 0) { SAML2_Utils::addStrings($scoping, SAML2_Const::NS_SAMLP, 'RequesterID', FALSE, $this->RequesterID); } } return $root; }
/** * Convert this logout request message to an XML element. * * @return DOMElement This logout request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); if ($this->notOnOrAfter !== NULL) { $root->setAttribute('NotOnOrAfter', gmdate('Y-m-d\\TH:i:s\\Z', $this->notOnOrAfter)); } if ($this->encryptedNameId === NULL) { SAML2_Utils::addNameId($root, $this->nameId); } else { $eid = $root->ownerDocument->createElementNS(SAML2_Const::NS_SAML, 'saml:' . 'EncryptedID'); $root->appendChild($eid); $eid->appendChild($root->ownerDocument->importNode($this->encryptedNameId, TRUE)); } foreach ($this->sessionIndexes as $sessionIndex) { SAML2_Utils::addString($root, SAML2_Const::NS_SAMLP, 'SessionIndex', $sessionIndex); } return $root; }
/** * Convert this logout request message to an XML element. * * @return DOMElement This logout request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); SAML2_Utils::addNameId($root, $this->nameId); if ($this->sessionIndex !== NULL) { if (is_array($this->sessionIndex)) { foreach ($this->sessionIndex as $si) { SAML2_Utils::addString($root, SAML2_Const::NS_SAMLP, 'SessionIndex', $si); } } elseif (is_string($this->sessionIndex)) { SAML2_Utils::addString($root, SAML2_Const::NS_SAMLP, 'SessionIndex', $this->sessionIndex); } } return $root; }
/** * Convert this logout request message to an XML element. * * @return DOMElement This logout request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); SAML2_Utils::addNameId($root, $this->nameId); $root->setAttribute('NotOnOrAfter', gmdate('Y-m-d\\TH:i:s\\Z', time() + 3600)); if ($this->sessionIndex !== NULL) { if (is_array($this->sessionIndex)) { foreach ($this->sessionIndex as $si) { SAML2_Utils::addString($root, SAML2_Const::NS_SAMLP, 'SessionIndex', $si); } } elseif (is_string($this->sessionIndex)) { SAML2_Utils::addString($root, SAML2_Const::NS_SAMLP, 'SessionIndex', $this->sessionIndex); } } return $root; }
/** * Convert this logout request message to an XML element. * * @return DOMElement This logout request. */ public function toUnsignedXML() { $root = parent::toUnsignedXML(); SAML2_Utils::addNameId($root, $this->nameId); if ($this->sessionIndex !== NULL) { $sessionIndex = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'SessionIndex'); $sessionIndex->appendChild($this->document->createTextNode($this->sessionIndex)); $root->appendChild($sessionIndex); } return $root; }