3 require(__DIR__
.'/../../config.php');
5 //HTTPS is required in this page when $CFG->loginhttps enabled
6 $PAGE->https_required();
8 $PAGE->set_url('/auth/ldap/ntlmsso_finish.php');
9 $PAGE->set_context(context_system
::instance());
11 // Define variables used in page
14 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
15 if (!in_array('ldap', $authsequence, true)) {
16 print_error('ldap_isdisabled', 'auth');
19 $authplugin = get_auth_plugin('ldap');
20 if (empty($authplugin->config
->ntlmsso_enabled
)) {
21 print_error('ntlmsso_isdisabled', 'auth_ldap');
24 // If ntlmsso_finish() succeeds, then the code never returns,
25 // so we only worry about failure.
26 if (!$authplugin->ntlmsso_finish()) {
27 // Redirect to login, saying "don't try again!"
28 // Display the page header. This makes redirect respect the timeout we specify
29 // here (and not add 3 more secs).
30 $loginsite = get_string("loginsite");
31 $PAGE->navbar
->add($loginsite);
32 $PAGE->set_title("$site->fullname: $loginsite");
33 $PAGE->set_heading($site->fullname
);
34 echo $OUTPUT->header();
35 redirect($CFG->httpswwwroot
. '/login/index.php?authldap_skipntlmsso=1',
36 get_string('ntlmsso_failed','auth_ldap'), 3);