MDL-22533 removing obsoleted sso infrastructure - this was announced very long ago ;-)

This commit is contained in:
Petr Skoda 2010-05-20 17:18:05 +00:00
parent 3a1055a548
commit 6c6f9d7fdc
4 changed files with 0 additions and 146 deletions

View file

@ -1,2 +0,0 @@
NOTICE:
/sso/ will be moved to /auth/ and deprecated; use user_authenticated_hook() instead

View file

@ -1,47 +0,0 @@
<?php
// expired.php - called by hive when the session has expired.
require('../../config.php');
require('lib.php');
require_login();
//MW theres no easy way to log in seamlessly. We need the users unhashed password.
// It's a security risk to carry that in $SESSION so we put up login form.
$PAGE->set_url('/sso/hive/expired.php');
echo $OUTPUT->header();
echo $OUTPUT->notification('Your session has expired. Please log in again.');
?>
<form action="login.php" method="post" id="login">
<table border="0" align="center">
<tr>
<td width="80%">
<table align="center" class="loginform">
<tr class="username">
<td align="right" class="c0">
<?php print_string("username") ?>:
</td>
<td class="c1">
<input type="text" name="username" size="15" value="<?php p($frm->username) ?>" alt="<?php print_string("username") ?>" />
</td>
</tr>
<tr class="password">
<td align="right" class="c0">
<?php print_string("password") ?>:
</td>
<td class="c1">
<input type="password" name="password" size="15" value="" alt="<?php print_string("password") ?>" />
</td>
</tr>
</table>
</td>
<td width="20%">
<input type="submit" value="<?php print_string("login") ?>" />
</td>
</tr>
</table>
</form>
<br />
<?php
echo $OUTPUT->close_window_button();

View file

@ -1,77 +0,0 @@
<?php
// Logs into Hive from HarvestRoad and stores session ID in Moodle session
// Martin Dougiamas, Moodle
//
// Example CFG variables to make this work:
// $CFG->sso = 'hive';
// $CFG->hiveprotocol = 'http';
// $CFG->hiveport = '80';
// $CFG->hivehost = 'turkey.harvestroad.com.au';
// $CFG->hivepath = '/cgi-bin/hive/hive.cgi';
// $CFG->hivecbid = '28';
function sso_user_login($username, $password) {
global $CFG, $SESSION;
include($CFG->libdir.'/snoopy/Snoopy.class.inc');
if (empty($CFG->hivehost)) {
return false; // Hive config variables not configured yet
}
/// Set up Snoopy
$snoopy = new Snoopy;
$submit_url = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath ;
$submit_vars['HIVE_UNAME'] = $username;
$submit_vars['HIVE_UPASS'] = $password;
$submit_vars['HIVE_ENDUSER']= $username;
$submit_vars['HIVE_REQ'] = '2112';
$submit_vars['HIVE_REF'] = 'hin:hive@API Login 3';
$submit_vars['HIVE_RET'] = 'ORG';
$submit_vars['HIVE_REM'] = '';
$submit_vars['HIVE_PROD'] = '0';
$submit_vars['HIVE_USERIP'] = getremoteaddr();
/// We use POST to call Hive with a bit more security
$snoopy->submit($submit_url,$submit_vars);
/// Extract HIVE_SESSION from headers
foreach ($snoopy->headers as $header) {
if (strpos($header, 'HIVE_SESSION=') !== false) {
$header = explode('HIVE_SESSION=', $header);
if (count($header) > 1) {
$cookie = explode(';', $header[1]);
$cookie = $cookie[0];
$SESSION->HIVE_SESSION = $cookie;
return true;
}
}
}
/// Try again with the guest username and password
$submit_vars['HIVE_UNAME'] = $CFG->hiveusername;
$submit_vars['HIVE_UPASS'] = $CFG->hivepassword;
$submit_vars['HIVE_ENDUSER']= $CFG->hiveusername;
$snoopy->submit($submit_url,$submit_vars);
foreach ($snoopy->headers as $header) {
if (strpos($header, 'HIVE_SESSION=') !== false) {
$header = explode('HIVE_SESSION=', $header);
if (count($header) > 1) {
$cookie = explode(';', $header[1]);
$cookie = $cookie[0];
$SESSION->HIVE_SESSION = $cookie;
return true;
}
}
}
return false; // No cookie found
}

View file

@ -1,20 +0,0 @@
<?php
// login.php - action of the login form put up by expired.php.
require('../../config.php');
require('lib.php');
require_login();
// get the login data
$frm = data_submitted();
// log back into Hive
if (sso_user_login($frm->username, $frm->password)) {
/// reopen Hive
redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php');
} else {
redirect($CFG->wwwroot.'/sso/hive/expired.php');
}