Commit d3087a72 authored by Dale Davies's avatar Dale Davies Committed by Robert Lyon
Browse files

Bug 1954958: Adjusting oauth to work better with sslproxy



Change-Id: I1686c74c1639ad120c9d806111225c714447938e
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent a8f97c2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ require_once(get_config('docroot') . 'webservice/libs/oauth-php/OAuthServer.php'
require_once(get_config('docroot') . 'webservice/libs/oauth-php/OAuthStore.php');
OAuthStore::instance('Mahara');
global $server;
$server = new OAuthServer();
$server = new OAuthServer(get_full_script_path());

!isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] = null;

+6 −1
Original line number Diff line number Diff line
@@ -89,7 +89,12 @@ class webservice_rest_server extends webservice_base_server {
        $oauth_token = null;
        if (webservice_protocol_is_enabled('oauth')) {
            OAuthStore::instance('Mahara');
            $this->oauth_server = new OAuthServer();
            // Instantiating OAuthServer() with get_full_script_path() ensures that
            // the locally generated signature will contain a URI using the correct
            // protocol if this server is behind an sslproxy.
            // Otherwise OAuthServer() determines the protocol based only on a
            // check for $_SERVER['HTTPS'] and signature verification will fail.
            $this->oauth_server = new OAuthServer(get_full_script_path());
            $headers = OAuthRequestLogger::getAllHeaders();
            // try 2 Legged
            if (OAuthRequestVerifier::requestIsSigned()) {