From bf8eb1b8b967308ce675846591abc1847d090aaa Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 27 Mar 2019 18:02:04 +0100 Subject: [PATCH] Add LSauth :: afterLogout() trigger --- public_html/includes/class/class.LSauth.php | 18 +++++++++++++++++- .../includes/class/class.LSauthMethod.php | 12 ++++++++++++ public_html/includes/class/class.LSsession.php | 14 +++++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/public_html/includes/class/class.LSauth.php b/public_html/includes/class/class.LSauth.php index 021246ee..ba1b3231 100644 --- a/public_html/includes/class/class.LSauth.php +++ b/public_html/includes/class/class.LSauth.php @@ -104,7 +104,23 @@ class LSauth { * @retval void **/ public static function logout() { - if (!is_null(self :: $provider)) { + if (!is_null(self :: $provider)) { + return self :: $provider -> logout(); + } + LSerror :: addErrorCode('LSauth_06'); + return; + } + + /** + * After logout + * + * This method is run by LSsession after the local session was + * was successfully destroyed. + * + * @retval void + **/ + public static function afterLogout() { + if (!is_null(self :: $provider)) { return self :: $provider -> logout(); } LSerror :: addErrorCode('LSauth_06'); diff --git a/public_html/includes/class/class.LSauthMethod.php b/public_html/includes/class/class.LSauthMethod.php index a61365d5..535db1ed 100644 --- a/public_html/includes/class/class.LSauthMethod.php +++ b/public_html/includes/class/class.LSauthMethod.php @@ -94,6 +94,18 @@ class LSauthMethod { return true; } + /** + * After logout + * + * This method is run by LSsession after the local session was + * was successfully destroyed. + * + * @retval void + **/ + public static function afterLogout() { + return true; + } + /** * Get LDAP credentials * diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php index e2bb8b87..3a61a505 100644 --- a/public_html/includes/class/class.LSsession.php +++ b/public_html/includes/class/class.LSsession.php @@ -533,15 +533,23 @@ class LSsession { } if (isset($_GET['LSsession_logout'])) { + // Trigger LSauth logout LSauth :: logout(); - session_destroy(); - + + // Delete temporaries files if (is_array($_SESSION['LSsession']['tmp_file'])) { self :: $tmp_file = $_SESSION['LSsession']['tmp_file']; } self :: deleteTmpFile(); + + // Destroy local session unset($_SESSION['LSsession']); - + session_destroy(); + + // Trigger LSauth after logout + LSauth :: afterLogout(); + + // Redirect user on home page self :: redirect('index.php'); return; }