You are here

function shib_auth_user in Shibboleth Authentication 5.2

Same name and namespace in other branches
  1. 5.3 shib_auth.module \shib_auth_user()
  2. 6.4 shib_auth.module \shib_auth_user()
  3. 6 shib_auth.module \shib_auth_user()
  4. 6.2 shib_auth.module \shib_auth_user()
  5. 6.3 shib_auth.module \shib_auth_user()

Let the user exit from the Shibboleth authority when he/she log out from the actual Drupal site.

Parameters

op What kind of action is being performed.:

edit The array of form values submitted by the user.:

account The user object on which the operation is being performed.:

category The active category of user information being edited.:

File

./shib_auth.module, line 64

Code

function shib_auth_user($op, &$edit, &$account, $category = NULL) {
  global $base_url, $user;
  if ($op == 'logout') {
    $handlerURL = variable_get('shib_auth_handler_url', '/Shibboleth.sso');
    $handlerProtocol = variable_get('shib_auth_handler_protocol', 'https');
    if (ereg("^http[s]{0,1}://", $handlerURL)) {

      // If handlerURL is an absolute path
      $logoutHandler = $handlerURL . "/Logout";
    }
    else {

      // Else, if the handlerURL is a relative path
      // If the WAYF's URI doesn't start with slash then extend it
      if (!ereg("^/", $handlerURL)) {
        $handlerURL = "/" . $handlerURL;
      }
      $logoutHandler = $handlerProtocol . "://" . $_SERVER['HTTP_HOST'] . $handlerURL . "/Logout";
    }
    drupal_goto("{$logoutHandler}?return={$base_url}");
  }
}