Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / auth / ldap / ntlmsso_finish.php
blobc64e75570fd53dfab04e2d3d7997331ce83a11fa
1 <?php
3 require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
5 //HTTPS is potentially required in this page
6 httpsrequired();
8 /// Define variables used in page
9 if (!$site = get_site()) {
10 error("No site found!");
13 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
14 if (!in_array('ldap',$authsequence,true)) {
15 print_error('ldap_isdisabled','auth');
18 $authplugin = get_auth_plugin('ldap');
19 if (empty($authplugin->config->ntlmsso_enabled)) {
20 print_error('ntlmsso_isdisabled','auth');
23 // If ntlmsso_finish() succeeds, then the code never returns,
24 // so we only worry about failure.
25 if (!$authplugin->ntlmsso_finish()) {
26 // Redirect to login, saying "don't try again!"
27 redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1',
28 get_string('ntlmsso_failed','auth'), 3);