You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ag...@apache.org on 2009/09/03 18:56:06 UTC

svn commit: r811026 - in /incubator/shindig/trunk/php/src/gadgets: ProxyBase.php oauth/OAuth.php oauth/OAuthFetcher.php oauth/OAuthStore.php

Author: agektmr
Date: Thu Sep  3 16:56:06 2009
New Revision: 811026

URL: http://svn.apache.org/viewvc?rev=811026&view=rev
Log:
tweaks to make OAuth Proxy work

Modified:
    incubator/shindig/trunk/php/src/gadgets/ProxyBase.php
    incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php
    incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php
    incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php

Modified: incubator/shindig/trunk/php/src/gadgets/ProxyBase.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyBase.php?rev=811026&r1=811025&r2=811026&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyBase.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyBase.php Thu Sep  3 16:56:06 2009
@@ -69,7 +69,7 @@
           break;
         case 'OAUTH':
           $request->setAuthType(RemoteContentRequest::$AUTH_OAUTH);
-          $request->setOAuthRequestParams(new OAuthRequestParams($_POST));
+          $request->setOAuthRequestParams(new OAuthRequestParams($_REQUEST));
           break;
       }
       $token = $this->context->extractAndValidateToken($signer);

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=811026&r1=811025&r2=811026&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuth.php Thu Sep  3 16:56:06 2009
@@ -555,7 +555,7 @@
   public static function addParameters($url, $oauthParams) {
     $url .= strchr($url, '?') === false ? '?' : '&';
     foreach ($oauthParams as $key => $value) {
-      $url .= "$key=$value&";
+      $url .= OAuthUtil::urldecodeRFC3986($key)."=".OAuthUtil::urldecodeRFC3986($value)."&";
     }
     return $url;
   }

Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php?rev=811026&r1=811025&r2=811026&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php Thu Sep  3 16:56:06 2009
@@ -235,9 +235,9 @@
    * @return RemoteContentRequest
    */
   public function fetchRequest(RemoteContentRequest $request) {
+    $this->checkCanApprove();
     if ($this->needApproval()) {
       // This is section 6.1 of the OAuth spec.
-      $this->checkCanApprove();
       $this->fetchRequestToken($request);
       // This is section 6.2 of the OAuth spec.
       $this->buildClientApprovalState();
@@ -247,7 +247,6 @@
       return $this->buildOAuthApprovalResponse();
     } elseif ($this->needAccessToken()) {
       // This is section 6.3 of the OAuth spec
-      $this->checkCanApprove();
       $this->exchangeRequestToken($request);
       $this->saveAccessToken();
       $this->buildClientAccessState();
@@ -286,7 +285,7 @@
     if ($pageOwner != $pageViewer) {
       throw new GadgetException("Only page owners can grant OAuth approval");
     }
-    if ($stateOwner != null && ! $stateOwner == $pageOwner) {
+    if ($stateOwner != null && $stateOwner != $pageOwner) {
       throw new GadgetException("Client state belongs to a different person.");
     }
   }

Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php?rev=811026&r1=811025&r2=811026&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php Thu Sep  3 16:56:06 2009
@@ -56,7 +56,7 @@
   public static $SignatureType = array('HMAC_SHA1' => 'HMAC_SHA1', 'RSA_SHA1' => 'RSA_SHA1',
       'PLAINTEXT' => 'PLAINTEXT');
   public static $KeyType = array('HMAC_SYMMETRIC' => 'HMAC_SYMMETRIC', 'RSA_PRIVATE' => 'RSA_PRIVATE');
-  public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth-header', 'POST_BODY' => 'post-body',-
+  public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth-header', 'POST_BODY' => 'post-body',
       'URI_QUERY' => 'uri-query');
 }