MDL-16180: add support for bouncing user back to originating host in mnet:jump/land

useful for jumping/landing/jumping back as part of an SSO session start that is just the first step for something else (which might be portfolio)
This commit is contained in:
mjollnir_
2008-08-29 12:42:39 +00:00
parent 2eb07e7904
commit d9be2106ed
2 changed files with 13 additions and 1 deletions
+9 -1
View File
@@ -163,8 +163,13 @@ class auth_plugin_mnet extends auth_plugin_base {
/**
* Starts an RPC jump session and returns the jump redirect URL.
*
* @param int $mnethostid id of the mnet host to jump to
* @param string $wantsurl url to redirect to after the jump (usually on remote system)
* @param boolean $wantsurlbackhere defaults to false, means that the remote system should bounce us back here
* rather than somewhere inside *its* wwwroot
*/
function start_jump_session($mnethostid, $wantsurl) {
function start_jump_session($mnethostid, $wantsurl, $wantsurlbackhere=false) {
global $CFG, $USER, $MNET, $DB;
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
@@ -223,6 +228,9 @@ class auth_plugin_mnet extends auth_plugin_base {
//$transport = mnet_get_protocol($mnet_peer->transport);
$wantsurl = urlencode($wantsurl);
$url = "{$mnet_peer->wwwroot}{$mnet_peer->application->sso_land_url}?token={$mnet_session->token}&idp={$MNET->wwwroot}&wantsurl={$wantsurl}";
if ($wantsurlbackhere) {
$url .= '&remoteurl=1';
}
return $url;
}
+4
View File
@@ -26,6 +26,7 @@ if (!is_enabled_auth('mnet')) {
$token = required_param('token', PARAM_BASE64);
$remotewwwroot = required_param('idp', PARAM_URL);
$wantsurl = required_param('wantsurl', PARAM_LOCALURL);
$wantsremoteurl = optional_param('remoteurl', false, PARAM_BOOL);
// confirm the MNET session
$mnetauth = get_auth_plugin('mnet');
@@ -40,6 +41,9 @@ if (!empty($localuser->mnet_foreign_host_array)) {
}
// redirect
if ($wantsremoteurl) {
redirect($remotewwwroot . $wantsurl);
}
redirect($CFG->wwwroot . $wantsurl);
?>