OneLogin_Saml2_Response::getSessionIndex PHP Method

getSessionIndex() public method

Could be used to be stored in the local session in order to be used in a future Logout Request that the SP could send to the SP, to set what specific session must be deleted
public getSessionIndex ( ) : string | null
return string | null The SessionIndex value
    public function getSessionIndex()
    {
        $sessionIndex = null;
        $entries = $this->_queryAssertion('/saml:AuthnStatement[@SessionIndex]');
        if ($entries->length !== 0) {
            $sessionIndex = $entries->item(0)->getAttribute('SessionIndex');
        }
        return $sessionIndex;
    }

Usage Example

コード例 #1
0
ファイル: ResponseTest.php プロジェクト: onelogin/php-saml
 /**
  * Tests the getSessionIndex method of the OneLogin_Saml2_Response
  *
  * @covers OneLogin_Saml2_Response::getSessionIndex
  */
 public function testGetSessionIndex()
 {
     $xml = file_get_contents(TEST_ROOT . '/data/responses/response1.xml.base64');
     $response = new OneLogin_Saml2_Response($this->_settings, $xml);
     $this->assertEquals('_531c32d283bdff7e04e487bcdbc4dd8d', $response->getSessionIndex());
     $xml2 = file_get_contents(TEST_ROOT . '/data/responses/valid_encrypted_assertion.xml.base64');
     $response2 = new OneLogin_Saml2_Response($this->_settings, $xml2);
     $this->assertEquals('_7164a9a9f97828bfdb8d0ebc004a05d2e7d873f70c', $response2->getSessionIndex());
 }
All Usage Examples Of OneLogin_Saml2_Response::getSessionIndex