You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ch...@apache.org on 2009/09/05 16:44:28 UTC

svn commit: r811657 - in /incubator/shindig/trunk/php: config/container.php src/gadgets/MakeRequestOptions.php src/gadgets/oauth/OAuthFetcherFactory.php

Author: chabotc
Date: Sat Sep  5 14:44:28 2009
New Revision: 811657

URL: http://svn.apache.org/viewvc?rev=811657&view=rev
Log:
2 hotfixes to makeRequest to make things work without critical errors

Modified:
    incubator/shindig/trunk/php/config/container.php
    incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php
    incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php

Modified: incubator/shindig/trunk/php/config/container.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/config/container.php?rev=811657&r1=811656&r2=811657&view=diff
==============================================================================
--- incubator/shindig/trunk/php/config/container.php (original)
+++ incubator/shindig/trunk/php/config/container.php Sat Sep  5 14:44:28 2009
@@ -112,7 +112,7 @@
   // Force these libraries to be external (included through <script src="..."> tags), this way they could be cached by the browser
   'focedJsLibs' => '',
 
-  // After checking the internal __autoload function, shindig can also call the 'extension_autoloader' function to load an 
+  // After checking the internal __autoload function, shindig can also call the 'extension_autoloader' function to load an
   // unknown custom class, this is particuarly useful for when intergrating shindig into an existing framework that also depends on autoloading
   'extension_autoloader' => false,
 
@@ -123,6 +123,8 @@
   'security_token_signer' => 'BasicSecurityTokenDecoder',
   'security_token' => 'BasicSecurityToken',
   'oauth_lookup_service' => 'BasicOAuthLookupService',
+  // The OAuth Store is used to store the (gadgets/)oauth proxy credentials it obtained on behalf of the user/gadget combo
+  'oauth_store' => 'BasicOAuthStore',
 
   // Caching back-end's to use. Shindig ships with CacheStorageFile, CacheStorageApc and CacheStorageMemcache support
   // The data cache is primarily used for remote content (proxied files, gadget spec, etc)

Modified: incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php?rev=811657&r1=811656&r2=811657&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php Sat Sep  5 14:44:28 2009
@@ -102,11 +102,14 @@
    *     array.
    */
   private function assertParameterIsOneOf($param, $values) {
+  	if (empty($param)) {
+  		return;
+  	}
     if (is_string($param)) {
       $param = strtoupper($param);
     }
     if (!in_array($param, $values)) {
-      throw new MakeRequestParameterException($name . " parameter must be one of " . implode(', ', $values));
+      throw new MakeRequestParameterException($param . " parameter must be one of " . implode(', ', $values));
     }
     return $param;
   }
@@ -201,7 +204,7 @@
             ->setOAuthUseToken(MakeRequestOptions::getRequestParam('OAUTH_USE_TOKEN'))
             ->setOAuthClientState(MakeRequestOptions::getRequestParam('oauthState'))
             ->setSecurityTokenString(MakeRequestOptions::getRequestParam('st'));
-            
+
     return $options;
   }
 
@@ -348,7 +351,7 @@
   /**
    * Sets the authorization type of the request.  Must be one of
    * {@link MakeRequestOptions::$VALID_AUTHZ}.
-   * 
+   *
    * @param string $authz The value to use.
    * @return MakeRequestOptions This object (for chaining purporses).
    */

Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php?rev=811657&r1=811656&r2=811657&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php Sat Sep  5 14:44:28 2009
@@ -22,10 +22,10 @@
  * Produces OAuth content fetchers for input tokens.
  */
 class OAuthFetcherFactory {
-  
+
   /** used to encrypt state stored on the client */
   protected $oauthCrypter;
-  
+
   /** persistent storage for OAuth tokens */
   protected $tokenStore;
 
@@ -48,7 +48,8 @@
       $BBC = new BasicBlobCrypter();
       $this->oauthCrypter = new BasicBlobCrypter(srand($BBC->MASTER_KEY_MIN_LEN));
       $specFactory = new BasicGadgetSpecFactory();
-      $basicStore = new BasicGadgetOAuthTokenStore(new BasicOAuthStore(), $specFactory);
+      $OAuthStore = Config::get('oauth_store');
+      $basicStore = new BasicGadgetOAuthTokenStore(new $OAuthStore, $specFactory);
       $basicStore->initFromConfigFile($fetcher);
       $this->tokenStore = $basicStore;
     } catch (Exeption $e) {}