3 require_once("../../config.php");
4 require_once($CFG->dirroot
."/auth/shibboleth/auth.php");
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;
14 $session_has_timed_out = false;
18 //HTTPS is required in this page when $CFG->loginhttps enabled
19 $PAGE->https_required();
21 /// Define variables used in page
24 $loginsite = get_string("loginsite");
26 $loginurl = (!empty($CFG->alternateloginurl
)) ?
$CFG->alternateloginurl
: '';
29 if (!empty($CFG->registerauth
) or is_enabled_auth('none') or !empty($CFG->auth_instructions
)) {
30 $show_instructions = true;
32 $show_instructions = false;
35 // Set SAML domain cookie
36 $config = get_config('auth/shibboleth');
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);
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->wwwroot
.'/auth/shibboleth/index.php'));
49 // For Shibbolet 2.x Service Providers
50 // header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
53 // For Shibbolet 1.x Service Providers
54 header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot
.'/auth/shibboleth/index.php'));
56 // For Shibboleth 2.x Service Providers
57 // header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
59 } elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) {
60 $errormsg = get_string('auth_shibboleth_errormsg', 'auth_shibboleth');
63 $loginsite = get_string("loginsite");
65 $PAGE->set_url('/auth/shibboleth/login.php');
66 $PAGE->navbar
->add($loginsite);
67 $PAGE->set_title("$site->fullname: $loginsite");
68 $PAGE->set_heading($site->fullname
);
70 echo $OUTPUT->header();
71 include("index_form.html");
72 echo $OUTPUT->footer();