OneLogin_Saml2_Response::checkOneCondition PHP Method

checkOneCondition() public method

Checks that the samlp:Response/saml:Assertion/saml:Conditions element exists and is unique.
public checkOneCondition ( ) : boolean
return boolean true if the Conditions element exists and is unique
    public function checkOneCondition()
    {
        $entries = $this->_queryAssertion("/saml:Conditions");
        if ($entries->length == 1) {
            return true;
        } else {
            return false;
        }
    }

Usage Example

コード例 #1
0
ファイル: ResponseTest.php プロジェクト: onelogin/php-saml
 /**
  * Tests the checkOneCondition method of SamlResponse
  *
  * @covers OneLogin_Saml2_Response::checkOneCondition
  */
 public function testCheckOneCondition()
 {
     $xml = file_get_contents(TEST_ROOT . '/data/responses/invalids/no_conditions.xml.base64');
     $response = new OneLogin_Saml2_Response($this->_settings, $xml);
     $this->assertFalse($response->checkOneCondition());
     $xml2 = file_get_contents(TEST_ROOT . '/data/responses/valid_response.xml.base64');
     $response2 = new OneLogin_Saml2_Response($this->_settings, $xml2);
     $this->assertTrue($response2->checkOneCondition());
 }