You are here

function _securesite_boot in Secure Site 7.2

Same name and namespace in other branches
  1. 6.2 securesite.inc \_securesite_boot()

Boot with selected authentication mechanism.

1 call to _securesite_boot()
securesite_boot in ./securesite.module
Implements hook_boot().

File

./securesite.inc, line 11
Secure Site log-in functions.

Code

function _securesite_boot($type) {
  global $user;
  switch ($type) {
    case SECURESITE_DIGEST:
      $edit = _securesite_parse_directives($_SERVER['PHP_AUTH_DIGEST']);
      $edit['name'] = $edit['username'];
      $edit['pass'] = NULL;
      $function = '_securesite_digest_auth';
      break;
    case SECURESITE_BASIC:
      $edit['name'] = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
      $edit['pass'] = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
      $function = '_securesite_plain_auth';
      break;
    case SECURESITE_FORM:

      // @ignore security_17:4
      if (!empty($_POST['openid_identifier'])) {
        openid_begin($_POST['openid_identifier'], $_POST['openid.return_to']);
      }
      $edit = array(
        'name' => $_POST['name'],
        'pass' => $_POST['pass'],
      );
      $function = '_securesite_plain_auth';
      break;
  }

  // Are credentials different from current user?
  if ((!isset($user->name) || $edit['name'] !== $user->name) && (!isset($_SESSION['securesite_guest']) || $edit['name'] !== $_SESSION['securesite_guest'])) {
    $function($edit);
  }
}