Author: chabotc
Date: Wed Mar 25 17:19:04 2009
New Revision: 758351
URL: http://svn.apache.org/viewvc?rev=758351&view=rev
Log:
The oauth signatures for proxied content were incorrect due to a missing method
in the base string, now everything validates as it should
Modified:
incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php
incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php
Modified: incubator/shindig/trunk/php/src/common/RemoteContentRequest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/RemoteContentRequest.php?rev=758351&r1=758350&r2=758351&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/RemoteContentRequest.php (original)
+++ incubator/shindig/trunk/php/src/common/RemoteContentRequest.php Wed Mar 25
17:19:04 2009
@@ -183,6 +183,10 @@
return $this->method;
}
+ public function setMethod($method) {
+ $this->method = $method;
+ }
+
public function getOptions() {
if (empty($this->options)) {
return new Options();
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php?rev=758351&r1=758350&r2=758351&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php Wed Mar 25 17:19:04
2009
@@ -271,8 +271,8 @@
*/
public static function from_consumer_and_token($consumer, $token,
$http_method, $http_url, $parameters = NULL) {
$parameters = is_array($parameters) ? $parameters : array();
- $defaults = array("oauth_nonce" => OAuthRequest::generate_nonce(),
- "oauth_timestamp" => OAuthRequest::generate_timestamp(),
+ $defaults = array("oauth_nonce" => OAuthRequest::generate_nonce(),
+ "oauth_timestamp" => OAuthRequest::generate_timestamp(),
"oauth_consumer_key" => $consumer->key);
$parameters = array_merge($defaults, $parameters);
if (isset($token)) {
@@ -371,7 +371,7 @@
}
$this->parameters[$key] = $value;
}
- $parts = array($this->get_normalized_http_method(),
$this->get_normalized_http_url(),
+ $parts = array($this->get_normalized_http_method(),
$this->get_normalized_http_url(),
$this->get_signable_parameters());
$parts = array_map(array('OAuthUtil', 'urlencodeRFC3986'), $parts);
$this->parameters = $tmp;
@@ -394,7 +394,7 @@
// FIXME: port should handle according to
http://groups.google.com/group/oauth/browse_thread/thread/1b203a51d9590226
$port = (isset($parts['port']) && $parts['port'] != '80') ? ':' .
$parts['port'] : '';
$path = (isset($parts['path'])) ? $parts['path'] : '';
-
+
return $parts['scheme'] . '://' . $parts['host'] . $port . $path;
}
@@ -515,7 +515,7 @@
}
class OAuthUtil {
-
+
public static $AUTH_SCHEME = "OAuth";
private static $AUTHORIZATION = "\ *[a-zA-Z0-9*]\ +(.*)";
private static $NVP = "(\\S*)\\s*\\=\\s*\"([^\"]*)\"";
Modified: incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php?rev=758351&r1=758350&r2=758351&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php
(original)
+++ incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php Wed
Mar 25 17:19:04 2009
@@ -47,7 +47,7 @@
parse_str($uri['query'], $_GET);
$request = new RemoteContentRequest($href);
-
+ $request->setMethod('GET');
$request->setToken($token);
$request->setRefreshInterval($refreshInterval);
$request->setAuthType($authz);
@@ -81,14 +81,16 @@
$firstSeperator = strpos($href, '?') === false ? '?' : '&';
$href .= $firstSeperator . 'lang=' . urlencode($lang);
$href .= '&country=' . urlencode($country);
-
// our internal caching is based on the raw url, but the spec states that
the container should only cache for a
// unique url + lang + country + owner + viewer + appid, so we add those
to the url too, so caching works as it should
// (so in essense we *always* signOwner and signViewer)
+ //NOTE should check how this will work in the limited cache invalidation
scope
$href .= '&opensocial_owner_id=' . urlencode($token->getOwnerId());
$href .= '&opensocial_viewer_id=' . urlencode($token->getViewerId());
$href .= '&opensocial_app_id=' . urlencode($token->getAppId());
$href .= "&opensocial_app_url=" . urlencode($token->getAppUrl());
+ $container = isset($_GET['container']) ? $_GET['container'] :
(isset($_GET['synd']) ? $_GET['synd'] : 'default');
+ $href .= "&oauth_consumer_key=" . urlencode($container);
return $href;
}