Skip to content

Commit

Permalink
MDL-16180: add support for bouncing user back to originating host in …
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
mjollnir_ committed Aug 29, 2008
1 parent 2eb07e7 commit d9be210
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion auth/mnet/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ function generate_token() {

/**
* 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';

Expand Down Expand Up @@ -223,6 +228,9 @@ function start_jump_session($mnethostid, $wantsurl) {
//$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;
}
Expand Down
4 changes: 4 additions & 0 deletions auth/mnet/land.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
$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');
Expand All @@ -40,6 +41,9 @@
}

// redirect
if ($wantsremoteurl) {
redirect($remotewwwroot . $wantsurl);
}
redirect($CFG->wwwroot . $wantsurl);

?>

0 comments on commit d9be210

Please sign in to comment.