diff --git a/components/ILIAS/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php b/components/ILIAS/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php index c949f6f38cb3..bfedfa663057 100755 --- a/components/ILIAS/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php +++ b/components/ILIAS/AuthShibboleth/classes/class.ilAuthProviderShibboleth.php @@ -107,6 +107,7 @@ public function doAuthentication(ilAuthStatus $status): bool return false; } + ilSession::set('shibboleth_session_id', $_SERVER['Shib-Session-ID']); return true; } } diff --git a/components/ILIAS/AuthShibboleth/resources/shib_logout.php b/components/ILIAS/AuthShibboleth/resources/shib_logout.php index ca4e08403df2..c7a92f590e57 100644 --- a/components/ILIAS/AuthShibboleth/resources/shib_logout.php +++ b/components/ILIAS/AuthShibboleth/resources/shib_logout.php @@ -14,7 +14,10 @@ *****************************************************************************/ /** @noRector */ require_once("../vendor/composer/vendor/autoload.php"); +ilContext::init(ilContext::CONTEXT_SHIBBOLETH); +ilInitialisation::initILIAS(); global $DIC; + $q = $DIC->http()->wrapper()->query(); if ( $q->has('return') @@ -38,7 +41,7 @@ // stored in the application's session data. // See function LogoutNotification below -elseif (!empty($HTTP_RAW_POST_DATA)) { +elseif (!empty(file_get_contents('php://input'))) { ilContext::init(ilContext::CONTEXT_SOAP); // Load ILIAS libraries and initialise ILIAS in non-web context @@ -64,16 +67,15 @@ echo << - + - + @@ -93,7 +95,7 @@ - + @@ -112,9 +114,9 @@ - + - + WSDL; @@ -136,20 +138,15 @@ function LogoutNotification($SessionID) $q = "SELECT session_id, data FROM usr_session WHERE expires > 'NOW()'"; $r = $ilDB->query($q); - while ($session_entry = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) { - $user_session = unserializesession($session_entry['data']); - - // Look for session with matching Shibboleth session id - // and then delete this ilias session - foreach ($user_session as $user_session_entry) { - if (is_array($user_session_entry) - && array_key_exists('shibboleth_session_id', $user_session_entry) - && $user_session_entry['shibboleth_session_id'] == $SessionID - ) { - // Delete this session entry - if (ilSession::_destroy($session_entry['session_id']) !== true) { - return new SoapFault('LogoutError', 'Could not delete session entry in database.'); - } + while ($session = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) { + $session_data = unserializesession($session['data']); + if (is_array($session_data) + && array_key_exists('shibboleth_session_id', $session_data) + && $session_data['shibboleth_session_id'] == $SessionID + ) { + // Delete this session entry + if (ilSession::_destroy($session['session_id']) !== true) { + return new SoapFault('LogoutError', 'Could not delete session entry in database.'); } } } @@ -167,4 +164,4 @@ function unserializesession($serialized_string) } return ($variables); -} \ No newline at end of file +}