You are here

function simple_ldap_sso_abort in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 simple_ldap_sso/simple_ldap_sso.inc \simple_ldap_sso_abort()

Abort the SSO. Logs a watchdog alert, and destroys the session.

1 call to simple_ldap_sso_abort()
simple_ldap_sso_init in simple_ldap_sso/simple_ldap_sso.module
Implements hook_init().

File

simple_ldap_sso/simple_ldap_sso.inc, line 376
Simple LDAP SSO API functions.

Code

function simple_ldap_sso_abort() {
  global $user;
  $message = 'Possible break-in attempt detected for uid @uid and session id @id.';
  $t_args = array(
    '@uid' => $user->uid,
    '@id' => session_id(),
  );
  watchdog(__FUNCTION__, $message, $t_args, WATCHDOG_ALERT);

  // Remove the SSO cookie and delete the session data from LDAP.
  simple_ldap_sso_user_logout($user);

  // Log out the user and reset the $user object.
  session_destroy();
  drupal_set_message(t('A problem was encountered when attempting to sign you in on this site.'), 'error');
}