You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/11/18 00:31:23 UTC

svn commit: r1036283 - in /shindig/trunk/php: src/gadgets/oauth/ src/gadgets/sample/ test/social/

Author: lindner
Date: Wed Nov 17 23:31:22 2010
New Revision: 1036283

URL: http://svn.apache.org/viewvc?rev=1036283&view=rev
Log:
remove CRs

Modified:
    shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php
    shindig/trunk/php/src/gadgets/oauth/OAuthError.php
    shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php
    shindig/trunk/php/src/gadgets/oauth/OAuthService.php
    shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php
    shindig/trunk/php/src/gadgets/oauth/OAuthStore.php
    shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php
    shindig/trunk/php/test/social/GroupIdTest.php
    shindig/trunk/php/test/social/RestFulCollectionTest.php

Modified: shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php Wed Nov 17 23:31:22 2010
@@ -21,16 +21,16 @@
 class OAuthStoreException extends GadgetException {
 }
 
-/**
- * Higher-level interface that allows callers to store and retrieve
- * OAuth-related data directly from {@code GadgetSpec}s, {@code GadgetContext}s,
- * etc. See {@link OAuthStore} for a more detailed explanation of the OAuth
- * Data Store.
+/**
+ * Higher-level interface that allows callers to store and retrieve
+ * OAuth-related data directly from {@code GadgetSpec}s, {@code GadgetContext}s,
+ * etc. See {@link OAuthStore} for a more detailed explanation of the OAuth
+ * Data Store.
  */
 class GadgetOAuthTokenStore {
 
-  // we use POST if no HTTP method is specified for access and request URLs
-  // (user authorization always uses GET)
+  // we use POST if no HTTP method is specified for access and request URLs
+  // (user authorization always uses GET)
   public static $DEFAULT_HTTP_METHOD = "POST";
 
   /**
@@ -48,26 +48,26 @@ class GadgetOAuthTokenStore {
    */
   private $specFactory;
 
-  /**
-   * Public constructor.
-   *
-   * @param store an {@link OAuthStore} that can store and retrieve OAuth
-   *              tokens, as well as information about service providers.
+  /**
+   * Public constructor.
+   *
+   * @param store an {@link OAuthStore} that can store and retrieve OAuth
+   *              tokens, as well as information about service providers.
    */
   public function __construct($store, $specFactory) {
     $this->specFactory = $specFactory;
     $this->store = $store;
   }
 
-  /**
-   * Stores a negotiated consumer key and secret in the gadget store.
-   * The "secret" can either be a consumer secret in the strict OAuth sense,
-   * or it can be a PKCS8-then-Base64 encoded private key that we'll be using
-   * with this service provider.
-   *
-   * @param gadgetUrl the URL of the gadget
-   * @param serviceName the service provider with whom we have negotiated a
-   *                    consumer key and secret.
+  /**
+   * Stores a negotiated consumer key and secret in the gadget store.
+   * The "secret" can either be a consumer secret in the strict OAuth sense,
+   * or it can be a PKCS8-then-Base64 encoded private key that we'll be using
+   * with this service provider.
+   *
+   * @param gadgetUrl the URL of the gadget
+   * @param serviceName the service provider with whom we have negotiated a
+   *                    consumer key and secret.
    */
   public function storeConsumerKeyAndSecret($gadgetUrl, $serviceName, $keyAndSecret) {
     $providerKey = new ProviderKey();
@@ -76,10 +76,10 @@ class GadgetOAuthTokenStore {
     $this->store->setOAuthConsumerKeyAndSecret($providerKey, $keyAndSecret);
   }
 
-  /**
-   * Stores an access token in the OAuth Data Store.
-   * @param tokenKey information about the Gadget storing the token.
-   * @param tokenInfo the TokenInfo to be stored in the OAuth data store.
+  /**
+   * Stores an access token in the OAuth Data Store.
+   * @param tokenKey information about the Gadget storing the token.
+   * @param tokenInfo the TokenInfo to be stored in the OAuth data store.
    */
   public function storeTokenKeyAndSecret($tokenKey, $tokenInfo) {
     $getGadgetUri = $tokenKey->getGadgetUri();
@@ -97,14 +97,14 @@ class GadgetOAuthTokenStore {
     $this->store->removeTokenAndSecret($tokenKey);
   }
 
-  /**
-   * Retrieve an OAuthAccessor that is ready to sign OAuthMessages.
-   *
-   * @param tokenKey information about the gadget retrieving the accessor.
-   *
-   * @return an OAuthAccessorInfo containing an OAuthAccessor (whic can be
-   *         passed to an OAuthMessage.sign method), as well as httpMethod and
-   *         signatureType fields.
+  /**
+   * Retrieve an OAuthAccessor that is ready to sign OAuthMessages.
+   *
+   * @param tokenKey information about the gadget retrieving the accessor.
+   *
+   * @return an OAuthAccessorInfo containing an OAuthAccessor (whic can be
+   *         passed to an OAuthMessage.sign method), as well as httpMethod and
+   *         signatureType fields.
    */
   public function getOAuthAccessor(TokenKey $tokenKey, $ignoreCache) {
     $gadgetUri = $tokenKey->getGadgetUri();
@@ -120,10 +120,10 @@ class GadgetOAuthTokenStore {
     return $this->store->getOAuthAccessorTokenKey($tokenKey, $provInfo);
   }
 
-  /**
-   * Reads OAuth provider information out of gadget spec.
-   * @param spec
-   * @return a GadgetInfo
+  /**
+   * Reads OAuth provider information out of gadget spec.
+   * @param spec
+   * @return a GadgetInfo
    */
   public static function getProviderInfo(GadgetSpec $spec, $serviceName) {
     $oauthSpec = $spec->oauth;
@@ -173,27 +173,27 @@ class GadgetOAuthTokenStore {
     $provInfo = new ProviderInfo();
     $provInfo->setHttpMethod($httpMethod);
     $provInfo->setParamLocation($paramLocation);
-    // TODO: for now, we'll just set the signature type to HMAC_SHA1
-    // as this will be ignored later on when retrieving consumer information.
-    // There, if we find a negotiated HMAC key, we will use HMAC_SHA1. If we
-    // find a negotiated RSA key, we will use RSA_SHA1. And if we find neither,
-    // we may use RSA_SHA1 with a default signing key.
+    // TODO: for now, we'll just set the signature type to HMAC_SHA1
+    // as this will be ignored later on when retrieving consumer information.
+    // There, if we find a negotiated HMAC key, we will use HMAC_SHA1. If we
+    // find a negotiated RSA key, we will use RSA_SHA1. And if we find neither,
+    // we may use RSA_SHA1 with a default signing key.
     $provInfo->setSignatureType(OAuthStoreVars::$SignatureType['HMAC_SHA1']);
     $provInfo->setProvider($provider);
     return $provInfo;
   }
 
-  /**
-   * Extracts a single oauth-related parameter from a key-value map,
-   * throwing an exception if the parameter could not be found (unless the
-   * parameter is optional, in which case null is returned).
-   *
-   * @param params the key-value map from which to pull the value (parameter)
-   * @param paramName the name of the parameter (key).
-   * @param isOptional if it's optional, don't throw an exception if it's not
-   *                   found.
-   * @return the value corresponding to the key (paramName)
-   * @throws GadgetException if the parameter value couldn't be found.
+  /**
+   * Extracts a single oauth-related parameter from a key-value map,
+   * throwing an exception if the parameter could not be found (unless the
+   * parameter is optional, in which case null is returned).
+   *
+   * @param params the key-value map from which to pull the value (parameter)
+   * @param paramName the name of the parameter (key).
+   * @param isOptional if it's optional, don't throw an exception if it's not
+   *                   found.
+   * @return the value corresponding to the key (paramName)
+   * @throws GadgetException if the parameter value couldn't be found.
    */
   static function getOAuthParameter($params, $paramName, $isOptional) {
     $param = @$params[$paramName];
@@ -224,4 +224,5 @@ class GadgetInfo {
   public function setProviderInfo(ProviderInfo $providerInfo) {
     $this->providerInfo = $providerInfo;
   }
-}
+}
+

Modified: shindig/trunk/php/src/gadgets/oauth/OAuthError.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthError.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthError.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/OAuthError.php Wed Nov 17 23:31:22 2010
@@ -18,18 +18,18 @@
  * under the License.
  */
 
-/**
- * Error strings to be returned to gadgets as "oauthError" data.
+/**
+ * Error strings to be returned to gadgets as "oauthError" data.
  */
 class OAuthError {
-  /**
-   * The request cannot be completed because the OAuth configuration for
-   * the gadget is incorrect.
+  /**
+   * The request cannot be completed because the OAuth configuration for
+   * the gadget is incorrect.
    */
   public static $BAD_OAUTH_CONFIGURATION = "BAD_OAUTH_CONFIGURATION";
   
-  /**
-   * The request cannot be completed for an unspecified reason.
+  /**
+   * The request cannot be completed for an unspecified reason.
    */
   public static $UNKNOWN_PROBLEM = "UNKNOWN_PROBLEM";
-}
+}

Modified: shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php Wed Nov 17 23:31:22 2010
@@ -39,9 +39,9 @@ class OAuthFetcherFactory {
     }
   }
 
-  /**
-   * Initialize the OAuth factory with a default implementation of
-   * BlobCrypter and consumer keys/secrets read from oauth.js
+  /**
+   * Initialize the OAuth factory with a default implementation of
+   * BlobCrypter and consumer keys/secrets read from oauth.js
    */
   public function OAuthFetcherFactoryInit($fetcher) {
     try {

Modified: shindig/trunk/php/src/gadgets/oauth/OAuthService.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthService.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthService.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/OAuthService.php Wed Nov 17 23:31:22 2010
@@ -18,8 +18,8 @@
  * under the License.
  */
 
-/**
- * The OAuth service located in the gadget xml inside ModulePrefs -> OAuth.
+/**
+ * The OAuth service located in the gadget xml inside ModulePrefs -> OAuth.
  **/
 class OAuthService {
   
@@ -125,17 +125,17 @@ class OAuthService {
   }
 }
 
-/**
- * Method to use for requests to an OAuth request token or access token URL.
+/**
+ * Method to use for requests to an OAuth request token or access token URL.
  */
 class Method {
   public static $GET = "GET";
   public static $POST = "POST";
 }
 
-/**
- * Location for OAuth parameters in requests to an OAuth request token,
- * access token, or resource URL.  (Lowercase to match gadget spec schema)
+/**
+ * Location for OAuth parameters in requests to an OAuth request token,
+ * access token, or resource URL.  (Lowercase to match gadget spec schema)
  */
 class Location {
   public static $header = "auth-header";
@@ -143,8 +143,8 @@ class Location {
   public static $body = "post-body";
 }
 
-/**
- * Description of an OAuth request token or access token URL.
+/**
+ * Description of an OAuth request token or access token URL.
  */
 class EndPoint {
   public $url;

Modified: shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php Wed Nov 17 23:31:22 2010
@@ -18,9 +18,9 @@
  * under the License.
  */
 
-/**
- * The OAuth preferences located in the gadget xml inside ModulePrefs.
- * Now, it only has 1 property, but this class was designed to be reusable
+/**
+ * The OAuth preferences located in the gadget xml inside ModulePrefs.
+ * Now, it only has 1 property, but this class was designed to be reusable
  **/
 class OAuthSpec {
   

Modified: shindig/trunk/php/src/gadgets/oauth/OAuthStore.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthStore.php (original)
+++ shindig/trunk/php/src/gadgets/oauth/OAuthStore.php Wed Nov 17 23:31:22 2010
@@ -26,26 +26,26 @@ interface OAuthStore {
 
   public function removeTokenAndSecret($tokenKey);
 
-  /**
-   * Retrieve an OAuthAccessor that is ready to sign OAuthMessages for
-   * resource access.
-   * @param tokenKey a structure uniquely identifying the token: a userId,
-   *                 a gadgetId, a moduleId (in case there are more than one
-   *                 gadget of the same type on a page), a tokenName (which
-   *                 distinguishes this token from others that the same gadget
-   *                 might hold for the same service provider) and a serviceName
-   *                 (which is the same as the service name in the ProviderKey
-   *                 structure).
-   * @param provInfo provider information. The store combines information stored
-   *                 in the store (consumer key/secret, token, token secret,
-   *                 etc.) with the provider information (access URL, request
-   *                 URL etc.) passed in here to create an AccessorInfo object.
-   *                 If no information can be found in the
-   *                 store, it may use default keys that identify the container,
-   *                 as opposed to consumer keys and secrets that are specific
-   *                 to this gadget.
-   * @return an OAuthAccessor object than can be passed to an OAuthMessage.sign
-   *         method.
+  /**
+   * Retrieve an OAuthAccessor that is ready to sign OAuthMessages for
+   * resource access.
+   * @param tokenKey a structure uniquely identifying the token: a userId,
+   *                 a gadgetId, a moduleId (in case there are more than one
+   *                 gadget of the same type on a page), a tokenName (which
+   *                 distinguishes this token from others that the same gadget
+   *                 might hold for the same service provider) and a serviceName
+   *                 (which is the same as the service name in the ProviderKey
+   *                 structure).
+   * @param provInfo provider information. The store combines information stored
+   *                 in the store (consumer key/secret, token, token secret,
+   *                 etc.) with the provider information (access URL, request
+   *                 URL etc.) passed in here to create an AccessorInfo object.
+   *                 If no information can be found in the
+   *                 store, it may use default keys that identify the container,
+   *                 as opposed to consumer keys and secrets that are specific
+   *                 to this gadget.
+   * @return an OAuthAccessor object than can be passed to an OAuthMessage.sign
+   *         method.
    */
   public function getOAuthAccessorTokenKey(TokenKey $tokenKey, ProviderInfo $provInfo);
 

Modified: shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php (original)
+++ shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php Wed Nov 17 23:31:22 2010
@@ -18,8 +18,8 @@
  * under the License.
  */
 
-/**
- * Basic implementation of a gadget spec factory.
+/**
+ * Basic implementation of a gadget spec factory.
  */
 class BasicGadgetSpecFactory {
   private $cache;
@@ -30,16 +30,16 @@ class BasicGadgetSpecFactory {
     return $this->getGadgetSpecUri($context->getUrl(), $context->getIgnoreCache());
   }
 
-  /**
-   * Retrieves a gadget specification from the cache or from the Internet.
+  /**
+   * Retrieves a gadget specification from the cache or from the Internet.
    */
   public function getGadgetSpecUri($url, $ignoreCache) {
     return $this->fetchFromWeb($url, $ignoreCache);
   }
 
-  /**
-   * Retrieves a gadget specification from the Internet, processes its views and
-   * adds it to the cache.
+  /**
+   * Retrieves a gadget specification from the Internet, processes its views and
+   * adds it to the cache.
    */
   private function fetchFromWeb($url, $ignoreCache) {
     $remoteContentRequest = new RemoteContentRequest($url);
@@ -52,4 +52,4 @@ class BasicGadgetSpecFactory {
     $gadgetSpec = $gadgetSpecParser->parse($spec->getResponseContent(), $this->context);
     return $gadgetSpec;
   }
-}
+}

Modified: shindig/trunk/php/test/social/GroupIdTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/social/GroupIdTest.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/test/social/GroupIdTest.php (original)
+++ shindig/trunk/php/test/social/GroupIdTest.php Wed Nov 17 23:31:22 2010
@@ -70,8 +70,8 @@ class GroupIdTest extends PHPUnit_Framew
     $this->assertEquals('all', $this->GroupId->getType());
   }
 
-  /**
-   * Tests GroupId->fromJson()
+  /**
+   * Tests GroupId->fromJson()
    */
   public function testFromJson() {
     $json = 'jsonid';

Modified: shindig/trunk/php/test/social/RestFulCollectionTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/social/RestFulCollectionTest.php?rev=1036283&r1=1036282&r2=1036283&view=diff
==============================================================================
--- shindig/trunk/php/test/social/RestFulCollectionTest.php (original)
+++ shindig/trunk/php/test/social/RestFulCollectionTest.php Wed Nov 17 23:31:22 2010
@@ -58,8 +58,8 @@ class RestFulCollectionTest extends PHPU
     $this->RestFulCollection->__construct($entry, 1, 1);
   }
 
-  /**
-   * Tests RestFulCollection->getEntry()
+  /**
+   * Tests RestFulCollection->getEntry()
    */
   public function testGetEntry() {
     $entry = array('Entry');
@@ -67,24 +67,24 @@ class RestFulCollectionTest extends PHPU
     $this->assertEquals($entry, $this->RestFulCollection->getEntry());
   }
 
-  /**
-   * Tests RestFulCollection->getStartIndex()
+  /**
+   * Tests RestFulCollection->getStartIndex()
    */
   public function testGetStartIndex() {
     $this->RestFulCollection->setStartIndex(1);
     $this->assertEquals(1, $this->RestFulCollection->getStartIndex());
   }
 
-  /**
-   * Tests RestFulCollection->getTotalResults()
+  /**
+   * Tests RestFulCollection->getTotalResults()
    */
   public function testGetTotalResults() {
     $this->RestFulCollection->setTotalResults(1);
     $this->assertEquals(1, $this->RestFulCollection->getTotalResults());
   }
 
-  /**
-   * Tests RestFulCollection->createFromEntry()
+  /**
+   * Tests RestFulCollection->createFromEntry()
    */
   public function testCreateFromEntry() {
     $entry = array('Entry');