55use AerialShip \LightSaml \Helper ;
66use AerialShip \LightSaml \Meta \SerializationContext ;
77use AerialShip \LightSaml \Model \Assertion \NameID ;
8+ use AerialShip \LightSaml \Model \XmlDSig \SignatureXmlValidator ;
89use 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