[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/auth/ldap/ -> ntlmsso_magic.php (source)

   1  <?php
   2  
   3  // Don't let lib/setup.php set any cookies
   4  // as we will be executing under the OS security
   5  // context of the user we are trying to login, rather than
   6  // of the webserver.
   7  define('NO_MOODLE_COOKIES', true);
   8  
   9  require(__DIR__.'/../../config.php');
  10  
  11  //HTTPS is required in this page when $CFG->loginhttps enabled
  12  $PAGE->https_required();
  13  
  14  $PAGE->set_context(context_system::instance());
  15  
  16  $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
  17  if (!in_array('ldap', $authsequence, true)) {
  18      print_error('ldap_isdisabled', 'auth');
  19  }
  20  
  21  $authplugin = get_auth_plugin('ldap');
  22  if (empty($authplugin->config->ntlmsso_enabled)) {
  23      print_error('ntlmsso_isdisabled', 'auth_ldap');
  24  }
  25  
  26  $sesskey = required_param('sesskey', PARAM_RAW);
  27  $file = $CFG->dirroot.'/pix/spacer.gif';
  28  
  29  if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) {
  30      if (!empty($authplugin->config->ntlmsso_ie_fastpath)) {
  31          if (core_useragent::is_ie()) {
  32              // $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
  33              redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php');
  34          }
  35      }
  36  
  37      // Serve GIF
  38      // Type
  39      header('Content-Type: image/gif');
  40      header('Content-Length: '.filesize($file));
  41  
  42      // Output file
  43      $handle = fopen($file, 'r');
  44      fpassthru($handle);
  45      fclose($handle);
  46      exit;
  47  } else {
  48      print_error('ntlmsso_iwamagicnotenabled', 'auth_ldap');
  49  }
  50  
  51  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1