[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/auth/shibboleth/ -> login.php (source)

   1  <?php
   2  
   3      require_once("../../config.php");
   4      require_once($CFG->dirroot."/auth/shibboleth/auth.php");
   5  
   6      //initialize variables
   7      $errormsg = '';
   8  
   9  /// Check for timed out sessions
  10      if (!empty($SESSION->has_timed_out)) {
  11          $session_has_timed_out = true;
  12          $SESSION->has_timed_out = false;
  13      } else {
  14          $session_has_timed_out = false;
  15      }
  16  
  17  
  18  //HTTPS is required in this page when $CFG->loginhttps enabled
  19  $PAGE->https_required();
  20  
  21  /// Define variables used in page
  22      $site = get_site();
  23  
  24      $loginsite = get_string("loginsite");
  25  
  26      $loginurl = (!empty($CFG->alternateloginurl)) ? $CFG->alternateloginurl : '';
  27  
  28  
  29      if (!empty($CFG->registerauth) or is_enabled_auth('none') or !empty($CFG->auth_instructions)) {
  30          $show_instructions = true;
  31      } else {
  32          $show_instructions = false;
  33      }
  34  
  35      // Set SAML domain cookie
  36      $config = get_config('auth/shibboleth');
  37  
  38  
  39      $IdPs = get_idp_list($config->organization_selection);
  40      if (isset($_POST['idp']) && isset($IdPs[$_POST['idp']])){
  41          $selectedIdP = $_POST['idp'];
  42          set_saml_cookie($selectedIdP);
  43  
  44          // Redirect to SessionInitiator with entityID as argument
  45          if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
  46              // For Shibbolet 1.x Service Providers
  47              header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
  48  
  49              // For Shibbolet 2.x Service Providers
  50              // header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
  51  
  52          } else {
  53              // For Shibbolet 1.x Service Providers
  54              header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
  55  
  56              // For Shibboleth 2.x Service Providers
  57              // header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
  58          }
  59      } elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']]))  {
  60          $errormsg = get_string('auth_shibboleth_errormsg', 'auth_shibboleth');
  61      }
  62  
  63      $loginsite = get_string("loginsite");
  64  
  65      $PAGE->set_url('/auth/shibboleth/login.php');
  66      $PAGE->set_context(context_system::instance());
  67      $PAGE->navbar->add($loginsite);
  68      $PAGE->set_title("$site->fullname: $loginsite");
  69      $PAGE->set_heading($site->fullname);
  70  
  71      echo $OUTPUT->header();
  72      include ("index_form.html");
  73      echo $OUTPUT->footer();
  74  
  75  


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