/** * Construct an authnresponse and send it. * Also test setting a relaystate and destination for the response. */ public function testSendAuthnResponse() { $response = new Response(); $response->setIssuer('testIssuer'); $response->setRelayState('http://example.org'); $response->setDestination('http://example.org/login?success=yes'); $response->setSignatureKey(CertificatesMock::getPrivateKey()); $hr = new HTTPPost(); $hr->send($response); }
/** * Construct an authnresponse and send it. * Also test setting a relaystate and destination for the response. */ public function testSendAuthnResponse() { $response = new Response(); $response->setIssuer('testIssuer'); $response->setRelayState('http://example.org'); $response->setDestination('http://example.org/login?success=yes'); $hr = new HTTPRedirect(); $hr->send($response); }
/** * @group Message */ public function testConvertIssuerToXML() { // first, try with common Issuer objects (Format=entity) $response = new Response(); $issuer = new XML\saml\Issuer(); $issuer->value = 'https://gateway.stepup.org/saml20/sp/metadata'; $response->setIssuer($issuer); $xml = $response->toUnsignedXML(); $xml_issuer = Utils::xpQuery($xml, './saml_assertion:Issuer'); $xml_issuer = $xml_issuer[0]; $this->assertFalse($xml_issuer->hasAttributes()); $this->assertEquals($issuer->value, $xml_issuer->textContent); // now, try an Issuer with another format and attributes $issuer->Format = Constants::NAMEID_UNSPECIFIED; $issuer->NameQualifier = 'SomeNameQualifier'; $issuer->SPNameQualifier = 'SomeSPNameQualifier'; $issuer->SPProvidedID = 'SomeSPProvidedID'; $response->setIssuer($issuer); $xml = $response->toUnsignedXML(); $xml_issuer = Utils::xpQuery($xml, './saml_assertion:Issuer'); $xml_issuer = $xml_issuer[0]; $this->assertTrue($xml_issuer->hasAttributes()); $this->assertEquals($issuer->value, $xml_issuer->textContent); $this->assertEquals($issuer->NameQualifier, $xml_issuer->getAttribute('NameQualifier')); $this->assertEquals($issuer->SPNameQualifier, $xml_issuer->getAttribute('SPNameQualifier')); $this->assertEquals($issuer->SPProvidedID, $xml_issuer->getAttribute('SPProvidedID')); // finally, make sure we can skip the Issuer by setting it to null $response->setIssuer(null); $xml = $response->toUnsignedXML(); $this->assertEmpty(Utils::xpQuery($xml, './saml_assertion:Issuer')); }