mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
mnet: new auth plugin
This commit is contained in:
parent
d09d923b92
commit
c72fe8018d
1014
auth/mnet/auth.php
Normal file
1014
auth/mnet/auth.php
Normal file
File diff suppressed because it is too large
Load Diff
61
auth/mnet/config.html
Normal file
61
auth/mnet/config.html
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
// set to defaults if undefined
|
||||
if (!isset($config->rpc_negotiation_timeout)) {
|
||||
$config->host = '30';
|
||||
}
|
||||
if (!isset ($config->auto_add_remote_users)) {
|
||||
$config->auto_add_remote_users = '0';
|
||||
}
|
||||
|
||||
$yesno = array(get_string('no'), get_string('yes'));
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"> rpc_negotiation_timeout: </td>
|
||||
<td>
|
||||
<input name="rpc_negotiation_timeout" type="text" size="5" value="<?php echo $config->rpc_negotiation_timeout ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['rpc_negotiation_timeout'])) {
|
||||
formerr($err['rpc_negotiation_timeout']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
print_string('auth_mnet_rpc_negotiation_timeout', 'auth');
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"> auto_add_remote_users: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
choose_from_menu($yesno, 'auto_add_remote_users', $config->auto_add_remote_users, '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
print_string('auth_mnet_auto_add_remote_users', 'auth');
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
// global $user_fields;
|
||||
// print_auth_lock_options('mnet', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
?>
|
||||
</table>
|
31
auth/mnet/jump.php
Normal file
31
auth/mnet/jump.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author Martin Dougiamas
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package moodle multiauth
|
||||
*
|
||||
* Authentication Plugin: Moodle Network Authentication
|
||||
*
|
||||
* Multiple host authentication support for Moodle Network.
|
||||
*
|
||||
* 2006-11-01 File created.
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
|
||||
|
||||
// grab the GET params - wantsurl could be anything - take it
|
||||
// with PARAM_RAW
|
||||
$hostid = required_param('hostid', PARAM_INT);
|
||||
$wantsurl = optional_param('wantsurl', '/', PARAM_RAW);
|
||||
|
||||
// start the mnet session and redirect browser to remote URL
|
||||
$mnetauth = get_auth_plugin('mnet');
|
||||
$url = $mnetauth->start_jump_session($hostid, $wantsurl);
|
||||
|
||||
if (empty($url)) {
|
||||
error('DEBUG: Jump session was not started correctly or blank URL returned.'); // TODO: errors
|
||||
}
|
||||
redirect($url);
|
||||
|
||||
?>
|
35
auth/mnet/land.php
Normal file
35
auth/mnet/land.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author Martin Dougiamas
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package moodle multiauth
|
||||
*
|
||||
* Authentication Plugin: Moodle Network Authentication
|
||||
*
|
||||
* Multiple host authentication support for Moodle Network.
|
||||
*
|
||||
* 2006-11-01 File created.
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
|
||||
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
|
||||
|
||||
// grab the GET params
|
||||
$token = required_param('token', PARAM_BASE64);
|
||||
$remotewwwroot = required_param('idp', PARAM_URL);
|
||||
$wantsurl = required_param('wantsurl', PARAM_LOCALURL);
|
||||
|
||||
// confirm the MNET session
|
||||
$mnetauth = get_auth_plugin('mnet');
|
||||
$localuser = $mnetauth->confirm_mnet_session($token, $remotewwwroot);
|
||||
|
||||
// log in
|
||||
$CFG->auth = 'mnet';
|
||||
$USER = get_complete_user_data('id', $localuser->id);
|
||||
load_all_capabilities();
|
||||
|
||||
// redirect
|
||||
redirect($CFG->wwwroot . $wantsurl);
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user