public function validate(SAML2_Response $response, SAML2_Response_Validation_Result $result) { $destination = $response->getDestination(); if (!$this->expectedDestination->equals(new SAML2_Configuration_Destination($destination))) { $result->addError(sprintf('Destination in response "%s" does not match the expected destination "%s"', $destination, $this->expectedDestination)); } }
/** * @group response-validation * @test */ public function the_result_correctly_reports_whether_or_not_it_is_valid() { $result = new SAML2_Response_Validation_Result(); $this->assertTrue($result->isValid()); $this->assertCount(0, $result->getErrors()); $result->addError('Oh noooos!'); $this->assertFalse($result->isValid()); $this->assertCount(1, $result->getErrors()); }
public function validate(SAML2_Response $response, SAML2_Response_Validation_Result $result) { if (!$response->isSuccess()) { $result->addError($this->buildMessage($response->getStatus())); } }