You are here

function shib_auth_user in Shibboleth Authentication 5.3

Same name and namespace in other branches
  1. 5.2 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 112
Provides user authentication with Shibboleth (both v1.3 and v2.0) as well as some authorisation features (automatic role assignment base on Shibboleth attributes).

Code

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

      // If handlerURL is an absolute path
      $logout_handler = $handler_url . '/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("^/", $handler_url)) {
        $handler_url = '/' . $handler_url;
      }
      $logout_handler = $handler_protocol . '://' . $_SERVER['HTTP_HOST'] . $handler_url . '/Logout';
    }
    drupal_goto("{$logout_handler}?return={$base_url}");
  }
}