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 | ||
리턴 | string | null | The SessionIndex value |
/** * 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()); }
/** * Process the SAML Response sent by the IdP. * * @param string $requestId The ID of the AuthNRequest sent by this SP to the IdP */ public function processResponse($requestId = null) { $this->_errors = array(); if (isset($_POST) && isset($_POST['SAMLResponse'])) { // AuthnResponse -- HTTP_POST Binding $response = new OneLogin_Saml2_Response($this->_settings, $_POST['SAMLResponse']); if ($response->isValid($requestId)) { $this->_attributes = $response->getAttributes(); $this->_nameid = $response->getNameId(); $this->_authenticated = true; $this->_sessionIndex = $response->getSessionIndex(); } else { $this->_errors[] = 'invalid_response'; $this->_errorReason = $response->getError(); } } else { $this->_errors[] = 'invalid_binding'; throw new OneLogin_Saml2_Error('SAML Response not found, Only supported HTTP_POST Binding', OneLogin_Saml2_Error::SAML_RESPONSE_NOT_FOUND); } }