コード例 #1
0
 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));
     }
 }
コード例 #2
0
ファイル: ResultTest.php プロジェクト: Shalmezad/saml2
 /**
  * @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());
 }
コード例 #3
0
ファイル: IsSuccessful.php プロジェクト: Shalmezad/saml2
 public function validate(SAML2_Response $response, SAML2_Response_Validation_Result $result)
 {
     if (!$response->isSuccess()) {
         $result->addError($this->buildMessage($response->getStatus()));
     }
 }
コード例 #4
0
 public static function createFromValidationResult(SAML2_Response_Validation_Result $result)
 {
     $message = sprintf('Cannot process response, preconditions not met: "%s"', implode('", "', $result->getErrors()));
     return new self($message);
 }