OneLogin_Saml2_Response::getIssuers PHP 메소드

getIssuers() 공개 메소드

Gets the Issuers (from Response and Assertion).
public getIssuers ( ) : array
리턴 array @issuers The issuers of the assertion/response
    public function getIssuers()
    {
        $issuers = array();
        $responseIssuer = OneLogin_Saml2_Utils::query($this->document, '/samlp:Response/saml:Issuer');
        if ($responseIssuer->length == 1) {
            $issuers[] = $responseIssuer->item(0)->textContent;
        } else {
            throw new Exception("Issuer of the Response not found or multiple.");
        }
        $assertionIssuer = $this->_queryAssertion('/saml:Issuer');
        if ($assertionIssuer->length == 1) {
            $issuers[] = $assertionIssuer->item(0)->textContent;
        } else {
            throw new Exception("Issuer of the Assertion not found or multiple.");
        }
        return array_unique($issuers);
    }

Usage Example

예제 #1
0
 /**
  * Tests the getIssuers method of the OneLogin_Saml2_Response
  *
  * @covers OneLogin_Saml2_Response::getIssuers
  */
 public function testGetIssuers()
 {
     $xml = file_get_contents(TEST_ROOT . '/data/responses/adfs_response.xml.base64');
     $response = new OneLogin_Saml2_Response($this->_settings, $xml);
     $this->assertEquals(array('http://login.example.com/issuer'), $response->getIssuers());
     $xml2 = file_get_contents(TEST_ROOT . '/data/responses/valid_encrypted_assertion.xml.base64');
     $response2 = new OneLogin_Saml2_Response($this->_settings, $xml2);
     $this->assertEquals(array('http://idp.example.com/'), $response2->getIssuers());
     $xml3 = file_get_contents(TEST_ROOT . '/data/responses/double_signed_encrypted_assertion.xml.base64');
     $response3 = new OneLogin_Saml2_Response($this->_settings, $xml3);
     $this->assertEquals(array('https://pitbulk.no-ip.org/simplesaml/saml2/idp/metadata.php', 'http://idp.example.com/'), $response3->getIssuers());
     $xml4 = file_get_contents(TEST_ROOT . '/data/responses/invalids/no_issuer_response.xml.base64');
     $response4 = new OneLogin_Saml2_Response($this->_settings, $xml4);
     try {
         $issuers = $response4->getIssuers();
     } catch (Exception $e) {
         $this->assertContains('Issuer of the Response not found or multiple.', $e->getMessage());
     }
     $xml5 = file_get_contents(TEST_ROOT . '/data/responses/invalids/no_issuer_assertion.xml.base64');
     $response5 = new OneLogin_Saml2_Response($this->_settings, $xml5);
     try {
         $issuers = $response5->getIssuers();
     } catch (Exception $e) {
         $this->assertContains('Issuer of the Assertion not found or multiple.', $e->getMessage());
     }
 }
All Usage Examples Of OneLogin_Saml2_Response::getIssuers