Exemplo n.º 1
0
 /**
  * @param \DOMElement $xml
  * @throws \AerialShip\LightSaml\Error\InvalidXmlException
  */
 function loadFromXml(\DOMElement $xml)
 {
     parent::loadFromXml($xml);
     if ($xml->hasAttribute('Reason')) {
         $this->setReason($xml->getAttribute('Reason'));
     }
     if ($xml->hasAttribute('NotOnOrAfter')) {
         $this->setNotOnOrAfter($xml->getAttribute('NotOnOrAfter'));
     }
     $signatureNode = null;
     $this->iterateChildrenElements($xml, function (\DOMElement $node) use(&$signatureNode) {
         if ($node->localName == 'NameID') {
             $nameID = new NameID();
             $nameID->loadFromXml($node);
             $this->setNameID($nameID);
         }
         if ($node->localName == 'SessionIndex') {
             $this->setSessionIndex($node->textContent);
         }
         if ($node->localName == 'Signature' && $node->namespaceURI == Protocol::NS_XMLDSIG) {
             $signatureNode = $node;
         }
     });
     if (null !== $signatureNode) {
         $signature = new SignatureXmlValidator();
         $signature->loadFromXml($signatureNode);
         $this->setSignature($signature);
     }
 }
Exemplo n.º 2
0
 /**
  * @param \DOMElement $xml
  * @throws \AerialShip\LightSaml\Error\InvalidXmlException
  */
 function loadFromXml(\DOMElement $xml)
 {
     parent::loadFromXml($xml);
     $this->setAssertionConsumerServiceURL($xml->getAttribute('AssertionConsumerServiceURL'));
     $this->setProtocolBinding($xml->getAttribute('ProtocolBinding'));
     $signatureNode = null;
     $this->iterateChildrenElements($xml, function (\DOMElement $node) use(&$signatureNode) {
         if ($node->localName == 'NameIDPolicy' && $node->namespaceURI == Protocol::SAML2) {
             $this->checkRequiredAttributes($node, array('Format', 'AllowCreate'));
             $this->setNameIdPolicyFormat($node->getAttribute('Format'));
             $this->setNameIdPolicyAllowCreate($node->getAttribute('AllowCreate') == 'true');
         } else {
             if ($node->localName == 'Signature' && $node->namespaceURI == Protocol::NS_XMLDSIG) {
                 $signatureNode = $node;
             }
         }
     });
     if ($signatureNode) {
         $signature = new SignatureXmlValidator();
         $signature->loadFromXml($signatureNode);
         $this->setSignature($signature);
     }
 }