From d9be2106ed6a156df2ff4c2378d58f7b4c63ded7 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Fri, 29 Aug 2008 12:42:39 +0000 Subject: [PATCH] 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) --- auth/mnet/auth.php | 10 +++++++++- auth/mnet/land.php | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 159b702e47..305d65e99f 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -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; } diff --git a/auth/mnet/land.php b/auth/mnet/land.php index 72e7f0a802..5008a2fa6f 100644 --- a/auth/mnet/land.php +++ b/auth/mnet/land.php @@ -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); ?> -- 2.39.5