2007-11-14 22:08:38 +00:00
|
|
|
<?php
|
|
|
|
|
2016-02-26 17:47:58 +11:00
|
|
|
require(__DIR__.'/../../config.php');
|
2007-11-14 22:08:38 +00:00
|
|
|
|
2010-10-10 15:04:19 +00:00
|
|
|
//HTTPS is required in this page when $CFG->loginhttps enabled
|
|
|
|
$PAGE->https_required();
|
2007-11-14 22:08:38 +00:00
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$PAGE->set_url('/auth/ldap/ntlmsso_finish.php');
|
2012-08-02 11:20:48 +08:00
|
|
|
$PAGE->set_context(context_system::instance());
|
2009-10-15 02:34:31 +00:00
|
|
|
|
2010-07-25 22:36:15 +00:00
|
|
|
// Define variables used in page
|
2009-11-01 09:10:09 +00:00
|
|
|
$site = get_site();
|
2007-11-14 22:08:38 +00:00
|
|
|
|
|
|
|
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
2010-07-25 22:36:15 +00:00
|
|
|
if (!in_array('ldap', $authsequence, true)) {
|
|
|
|
print_error('ldap_isdisabled', 'auth');
|
2007-11-14 22:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$authplugin = get_auth_plugin('ldap');
|
|
|
|
if (empty($authplugin->config->ntlmsso_enabled)) {
|
2010-07-25 22:36:15 +00:00
|
|
|
print_error('ntlmsso_isdisabled', 'auth_ldap');
|
2007-11-14 22:08:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If ntlmsso_finish() succeeds, then the code never returns,
|
|
|
|
// so we only worry about failure.
|
|
|
|
if (!$authplugin->ntlmsso_finish()) {
|
|
|
|
// Redirect to login, saying "don't try again!"
|
2009-02-14 16:21:14 +00:00
|
|
|
// Display the page header. This makes redirect respect the timeout we specify
|
|
|
|
// here (and not add 3 more secs).
|
|
|
|
$loginsite = get_string("loginsite");
|
2009-09-03 05:40:41 +00:00
|
|
|
$PAGE->navbar->add($loginsite);
|
|
|
|
$PAGE->set_title("$site->fullname: $loginsite");
|
|
|
|
$PAGE->set_heading($site->fullname);
|
|
|
|
echo $OUTPUT->header();
|
2009-11-01 11:55:14 +00:00
|
|
|
redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1',
|
2009-06-11 03:34:46 +00:00
|
|
|
get_string('ntlmsso_failed','auth_ldap'), 3);
|
2007-11-14 22:08:38 +00:00
|
|
|
}
|