function shib_auth_terminate_session in Shibboleth Authentication 7.4
Same name and namespace in other branches
- 6.4 shib_auth.module \shib_auth_terminate_session()
Unset session variables and destroy them.
Parameters
string $msg: Error message.
2 calls to shib_auth_terminate_session()
- shib_auth_init in ./
shib_auth.module - Creates a new user, if necessary, based on information from the handler.
- shib_auth_session_check in ./
shib_auth.module - Destroys the user session under certain conditions.
File
- ./
shib_auth.module, line 129 - Drupal Shibboleth authentication module.
Code
function shib_auth_terminate_session($msg = '') {
global $user;
// Unset all session variables and destroy session.
if (isset($user->uid)) {
drupal_session_destroy_uid($user->uid);
}
$_SESSION = array();
// Added error suppression to session destroy to suppress
// warning: session_destroy()
// [function.session-destroy]: Trying to destroy uninitialized session ...
@session_destroy();
$user = drupal_anonymous_user();
// Call drupal_set_message after session_destroy to persist the message.
if ($msg) {
shib_auth_error($msg);
}
// Break the request processing to avoid cached content to be served and
// redirect to the current page.
$path = current_path();
$query = drupal_get_query_parameters();
$options['query'] = $query;
drupal_goto($path, $options);
}