Skip to content

Instantly share code, notes, and snippets.

@wixaw
Created October 14, 2019 12:18
Show Gist options
  • Save wixaw/96626767d6eb17ea9e78911f6fe70f46 to your computer and use it in GitHub Desktop.
Save wixaw/96626767d6eb17ea9e78911f6fe70f46 to your computer and use it in GitHub Desktop.
Cleaning remove delete SSO CAS session apereo/mod_auth_cas PHP
<?php
// Cleaning CAS session apereo/mod_auth_cas (https://github.com/apereo/mod_auth_cas)
// Sarting session
session_start();
if ((!isset($_SERVER["PHP_AUTH_USER"])) || (!empty($_SERVER["PHP_AUTH_USER"]))) {
// Get username
$login = $_SERVER["PHP_AUTH_USER"];
// Select your Folder ( set by CASCookiePath /var/cache/apache2/mod_auth_cas/ )
$sessionFolder = "/var/cache/apache2/mod_auth_cas/";
$exec = shell_exec("cd $sessionFolder ; grep -l $login * | xargs rm");
// Cleanup
$_SESSION = array();
// On détruit les variables de notre session
session_unset();
// On détruit notre session
session_destroy();
}
header("location:https://sso.irit.fr/cas/logout"); //Redirect vers le CAS
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment