]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16180: add support for bouncing user back to originating host in mnet:jump/land
authormjollnir_ <mjollnir_>
Fri, 29 Aug 2008 12:42:39 +0000 (12:42 +0000)
committermjollnir_ <mjollnir_>
Fri, 29 Aug 2008 12:42:39 +0000 (12:42 +0000)
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
auth/mnet/land.php

index 159b702e472549162a272d27ee321b0eda6f08d7..305d65e99ff40f390ea999ecaeb5bf5fb4a72bec 100644 (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;
     }
index 72e7f0a8024b6c7e89f67f3e4df9586d4e109ab7..5008a2fa6f3f8ca274b7c16d4aa7cf27f81b1c93 100644 (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);
 
 ?>