Skip to content

Commit fede0be

Browse files
committed
Merge pull request #33 from data-licious/master
Fixed LogoutRequest::loadFromXml (added SignatureValidation).
2 parents 17c75f1 + 2573042 commit fede0be

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/AerialShip/LightSaml/Model/Protocol/LogoutRequest.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use AerialShip\LightSaml\Helper;
66
use AerialShip\LightSaml\Meta\SerializationContext;
77
use AerialShip\LightSaml\Model\Assertion\NameID;
8+
use AerialShip\LightSaml\Model\XmlDSig\SignatureXmlValidator;
89
use AerialShip\LightSaml\Protocol;
910

1011

@@ -135,16 +136,19 @@ function getXml(\DOMNode $parent, SerializationContext $context)
135136
* @param \DOMElement $xml
136137
* @throws \AerialShip\LightSaml\Error\InvalidXmlException
137138
*/
138-
function loadFromXml(\DOMElement $xml) {
139+
function loadFromXml(\DOMElement $xml)
140+
{
139141
parent::loadFromXml($xml);
140142

141-
if($xml->hasAttribute('Reason')){
143+
if ($xml->hasAttribute('Reason')) {
142144
$this->setReason($xml->getAttribute('Reason'));
143145
}
144-
if($xml->hasAttribute('NotOnOrAfter')){
146+
if ($xml->hasAttribute('NotOnOrAfter')) {
145147
$this->setNotOnOrAfter($xml->getAttribute('NotOnOrAfter'));
146148
}
147-
$this->iterateChildrenElements($xml, function(\DOMElement $node) {
149+
150+
$signatureNode = null;
151+
$this->iterateChildrenElements($xml, function(\DOMElement $node) use (&$signatureNode) {
148152
if ($node->localName == 'NameID') {
149153
$nameID = new NameID();
150154
$nameID->loadFromXml($node);
@@ -153,6 +157,16 @@ function loadFromXml(\DOMElement $xml) {
153157
if ($node->localName == 'SessionIndex') {
154158
$this->setSessionIndex($node->textContent);
155159
}
160+
161+
if ($node->localName == 'Signature' && $node->namespaceURI == Protocol::NS_XMLDSIG) {
162+
$signatureNode = $node;
163+
}
156164
});
165+
166+
if (null !== $signatureNode) {
167+
$signature = new SignatureXmlValidator;
168+
$signature->loadFromXml($signatureNode);
169+
$this->setSignature($signature);
170+
}
157171
}
158172
}

0 commit comments

Comments
 (0)