public function testRegisterNamespaces() { // <saml:AttributeStatement><saml:Attribute Name="urn:mace:dir:attribute-def:uid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"><saml:AttributeValue xsi:type="xs:string">avykq</saml:AttributeValue></saml:Attribute> $hash = array(EngineBlock_Corto_XmlToArray::TAG_NAME_PFX => 'samlp:Response', 'saml:Issuer' => 'http://example.edu', 'saml:Assertion' => array('saml:AttributeStatement' => array('saml:Attribute' => array(0 => array('_Name' => 'name', '_NameFormat' => 'a', '_xsi:type' => 'string', 'saml:AttributeValue' => array(0 => array('__v' => 'GIANTDAD IS BACK'))))))); $expected = array('_xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion', '_xmlns:samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol', '_xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', '__t' => 'samlp:Response', 'saml:Issuer' => 'http://example.edu', 'saml:Assertion' => array('saml:AttributeStatement' => array('saml:Attribute' => array(0 => array('_Name' => 'name', '_NameFormat' => 'a', '_xsi:type' => 'string', 'saml:AttributeValue' => array(0 => array('__v' => 'GIANTDAD IS BACK'))))))); $this->assertEquals($expected, EngineBlock_Corto_XmlToArray::registerNamespaces($hash)); }
/** * @param array $legacyResponse * @return EngineBlock_Saml2_ResponseAnnotationDecorator */ public function fromOldFormat(array $legacyResponse) { $legacyResponse = EngineBlock_Corto_XmlToArray::registerNamespaces($legacyResponse); $xml = EngineBlock_Corto_XmlToArray::array2xml($legacyResponse); $document = new DOMDocument(); $document->loadXML($xml); $response = new SAML2_Response($document->firstChild); $annotatedResponse = new EngineBlock_Saml2_ResponseAnnotationDecorator($response); return $this->addPrivateVars($annotatedResponse, $legacyResponse); }