You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/05/10 13:09:05 UTC

svn commit: r655046 - in /incubator/shindig/trunk/php: ./ src/common/ src/common/samplecontainer/ src/gadgets/ src/gadgets/http/ src/gadgets/samplecontainer/ src/socialdata/http/ src/socialdata/opensocial/

Author: chabotc
Date: Sat May 10 04:09:05 2008
New Revision: 655046

URL: http://svn.apache.org/viewvc?rev=655046&view=rev
Log:
Renamed GadgetToken to SecurityToken, and moved from gadgets to common

Added:
    incubator/shindig/trunk/php/src/common/SecurityToken.php
      - copied, changed from r654993, incubator/shindig/trunk/php/src/gadgets/GadgetToken.php
    incubator/shindig/trunk/php/src/common/SecurityTokenDecoder.php
      - copied, changed from r654993, incubator/shindig/trunk/php/src/gadgets/GadgetTokenDecoder.php
    incubator/shindig/trunk/php/src/common/samplecontainer/
    incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityToken.php
      - copied, changed from r654993, incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetToken.php
    incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php
      - copied, changed from r654993, incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php
Removed:
    incubator/shindig/trunk/php/src/gadgets/GadgetToken.php
    incubator/shindig/trunk/php/src/gadgets/GadgetTokenDecoder.php
    incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetToken.php
    incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php
Modified:
    incubator/shindig/trunk/php/config.php
    incubator/shindig/trunk/php/index.php
    incubator/shindig/trunk/php/src/gadgets/GadgetSigner.php
    incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php
    incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php
    incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php
    incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php
    incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php

Modified: incubator/shindig/trunk/php/config.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/config.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/config.php (original)
+++ incubator/shindig/trunk/php/config.php Sat May 10 04:09:05 2008
@@ -49,8 +49,8 @@
 	// backends the gadget server uses for its logic functionality. 
 	'blacklist_class' => 'BasicGadgetBlacklist',
 	'remote_content' => 'BasicRemoteContent',
-	'gadget_signer' => 'BasicGadgetTokenDecoder',
-	'gadget_token' => 'BasicGadgetToken',
+	'security_token_signer' => 'BasicSecurityTokenDecoder',
+	'security_token' => 'BasicSecurityToken',
 	'data_cache' => 'CacheFile', 
 	
 	// gadget server specific settings

Modified: incubator/shindig/trunk/php/index.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/index.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/index.php (original)
+++ incubator/shindig/trunk/php/index.php Sat May 10 04:09:05 2008
@@ -40,7 +40,7 @@
 // To load these, we scan our entire directory structure
 function __autoload($className)
 {
-	$locations = array('src/common', 'src/gadgets', 'src/gadgets/samplecontainer', 'src/gadgets/http', 'src/socialdata', 'src/socialdata/opensocial', 'src/socialdata/opensocial/model', 'src/socialdata/http', 'src/socialdata/samplecontainer');
+	$locations = array('src/common', 'src/common/samplecontainer', 'src/gadgets', 'src/gadgets/samplecontainer', 'src/gadgets/http', 'src/socialdata', 'src/socialdata/opensocial', 'src/socialdata/opensocial/model', 'src/socialdata/http', 'src/socialdata/samplecontainer');
 	// Check for the presense of this class in our all our directories.
 	$fileName = $className.'.php';
 	foreach ($locations as $path) {

Copied: incubator/shindig/trunk/php/src/common/SecurityToken.php (from r654993, incubator/shindig/trunk/php/src/gadgets/GadgetToken.php)
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/SecurityToken.php?p2=incubator/shindig/trunk/php/src/common/SecurityToken.php&p1=incubator/shindig/trunk/php/src/gadgets/GadgetToken.php&r1=654993&r2=655046&rev=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetToken.php (original)
+++ incubator/shindig/trunk/php/src/common/SecurityToken.php Sat May 10 04:09:05 2008
@@ -20,9 +20,9 @@
 
 /**
  * An abstract representation of a signing token.
- * Use in conjunction with @code GadgetTokenDecoder.
+ * Use in conjunction with @code SecurityTokenDecoder.
  */
-abstract class GadgetToken {
+abstract class SecurityToken {
 
   //FIXME Hmm seems php is refusing to let me make abstract static functions? odd
   static public function createFromToken($token, $maxage) {}

Copied: incubator/shindig/trunk/php/src/common/SecurityTokenDecoder.php (from r654993, incubator/shindig/trunk/php/src/gadgets/GadgetTokenDecoder.php)
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/SecurityTokenDecoder.php?p2=incubator/shindig/trunk/php/src/common/SecurityTokenDecoder.php&p1=incubator/shindig/trunk/php/src/gadgets/GadgetTokenDecoder.php&r1=654993&r2=655046&rev=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetTokenDecoder.php (original)
+++ incubator/shindig/trunk/php/src/common/SecurityTokenDecoder.php Sat May 10 04:09:05 2008
@@ -21,7 +21,7 @@
 /**
  *  Handles verification of gadget security tokens.
  */
-abstract class GadgetTokenDecoder {
+abstract class SecurityTokenDecoder {
 
   /**
    * Decrypts and verifies a gadget security token to return a gadget token.

Copied: incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityToken.php (from r654993, incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetToken.php)
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityToken.php?p2=incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityToken.php&p1=incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetToken.php&r1=654993&r2=655046&rev=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetToken.php (original)
+++ incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityToken.php Sat May 10 04:09:05 2008
@@ -21,7 +21,7 @@
 /**
  * Primitive token implementation that uses stings as tokens.
  */
-class BasicGadgetToken extends GadgetToken {
+class BasicSecurityToken extends SecurityToken {
   /** serialized form of the token */
   private $token;
   
@@ -54,7 +54,7 @@
    */
   static public function createFromToken($token, $maxAge)
   {
-	return new BasicGadgetToken($token, $maxAge, null, null, null, null, null, null);
+	return new BasicSecurityToken($token, $maxAge, null, null, null, null, null, null);
   }
   
   /**
@@ -69,7 +69,7 @@
    */
   static public function createFromValues($owner, $viewer, $app, $domain, $appUrl, $moduleId)
   {
-  	return new BasicGadgetToken(null, null, $owner, $viewer, $app, $domain, $appUrl, $moduleId);
+  	return new BasicSecurityToken(null, null, $owner, $viewer, $app, $domain, $appUrl, $moduleId);
   }
   
   
@@ -132,4 +132,4 @@
   public function getModuleId() {
     return intval($this->tokenData[$this->MODULE_KEY]);
   }
-}
\ No newline at end of file
+}

Copied: incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php (from r654993, incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php)
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php?p2=incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php&p1=incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php&r1=654993&r2=655046&rev=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/samplecontainer/BasicGadgetTokenDecoder.php (original)
+++ incubator/shindig/trunk/php/src/common/samplecontainer/BasicSecurityTokenDecoder.php Sat May 10 04:09:05 2008
@@ -18,7 +18,7 @@
  * under the License.
  */
 
-class BasicGadgetTokenDecoder extends GadgetTokenDecoder {
+class BasicSecurityTokenDecoder extends SecurityTokenDecoder {
 	private $OWNER_INDEX = 0;
 	private $VIEWER_INDEX = 1;
 	private $APP_ID_INDEX = 2;
@@ -41,9 +41,9 @@
 			// in the example files
 			if (Config::get('allow_plaintext_token') && count(explode(':', $stringToken)) == 6) {
 				$tokens = explode(":", $stringToken);
-				return new BasicGadgetToken(null, null, urldecode($tokens[$this->OWNER_INDEX]), urldecode($tokens[$this->VIEWER_INDEX]), urldecode($tokens[$this->APP_ID_INDEX]), urldecode($tokens[$this->CONTAINER_INDEX]), urldecode($tokens[$this->APP_URL_INDEX]), urldecode($tokens[$this->MODULE_ID_INDEX]));
+				return new BasicSecurityToken(null, null, urldecode($tokens[$this->OWNER_INDEX]), urldecode($tokens[$this->VIEWER_INDEX]), urldecode($tokens[$this->APP_ID_INDEX]), urldecode($tokens[$this->CONTAINER_INDEX]), urldecode($tokens[$this->APP_URL_INDEX]), urldecode($tokens[$this->MODULE_ID_INDEX]));
 			} else {
-				return BasicGadgetToken::createFromToken($stringToken, Config::get('st_max_age'));
+				return BasicSecurityToken::createFromToken($stringToken, Config::get('st_max_age'));
 			}
 		} catch (Exception $e) {
 			throw new GadgetException('INVALID_GADGET_TOKEN');

Modified: incubator/shindig/trunk/php/src/gadgets/GadgetSigner.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetSigner.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetSigner.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetSigner.php Sat May 10 04:09:05 2008
@@ -31,11 +31,11 @@
 	 * 
 	 * Or generates a token from an input string. This call must produce a token that
 	 * will validate against a token produced directly from a gadget so that the
-	 * following function will always returns a valid GadgetToken:
+	 * following function will always returns a valid SecurityToken:
 	 *
 	 * <code>
-	 * GadgetToken testToken(Gadget gadget, GadgetSigner signer) {
-	 *   GadgetToken token = signer.createToken(gadget);
+	 * SecurityToken testToken(Gadget gadget, GadgetSigner signer) {
+	 *   SecurityToken token = signer.createToken(gadget);
 	 *   return signer.createToken(token.toSerialForm());
 	 * }
 	 * </code>

Modified: incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php Sat May 10 04:09:05 2008
@@ -307,10 +307,10 @@
 	}
 	
 	/**
-	 * Signs a url with the GadgetToken
+	 * Signs a url with the SecurityToken
 	 *
 	 * @param string $originalUrl
-	 * @param GadgetToken $token
+	 * @param SecurityToken $token
 	 * @return unknown
 	 */
 	private function signUrl($originalUrl, $token)

Modified: incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/http/ProxyServlet.php Sat May 10 04:09:05 2008
@@ -19,7 +19,7 @@
  */
 require 'src/common/HttpServlet.php';
 require 'src/gadgets/GadgetContext.php';
-require 'src/gadgets/GadgetTokenDecoder.php';
+require 'src/common/SecurityTokenDecoder.php';
 require 'src/gadgets/ProxyHandler.php';
 require 'src/gadgets/GadgetException.php';
 require 'src/common/RemoteContentRequest.php';
@@ -48,7 +48,7 @@
 			header("HTTP/1.0 400 Bad Request", true);
 			echo "<html><body><h1>400 - Missing url parameter</h1></body></html>";
 		}
-		$gadgetSigner = Config::get('gadget_signer');
+		$gadgetSigner = Config::get('security_token_signer');
 		$gadgetSigner = new $gadgetSigner();
 		$proxyHandler = new ProxyHandler($context);
 		if (! empty($_GET['output']) && $_GET['output'] == 'js') {

Modified: incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/http/GadgetDataServlet.php Sat May 10 04:09:05 2008
@@ -19,8 +19,8 @@
 require 'src/common/HttpServlet.php';
 require 'src/socialdata/DataResponse.php';
 require 'src/socialdata/GadgetDataHandler.php';
-require 'src/gadgets/GadgetTokenDecoder.php';
-require 'src/gadgets/GadgetToken.php';
+require 'src/common/SecurityTokenDecoder.php';
+require 'src/common/SecurityToken.php';
 require 'src/common/BlobCrypter.php';
 require 'src/common/Crypto.php';
 require 'src/socialdata/RequestItem.php';
@@ -93,7 +93,7 @@
 		if (empty($token)) {
 			throw new Exception("INVALID_GADGET_TOKEN");
 		}
-		$gadgetSigner = Config::get('gadget_signer');
+		$gadgetSigner = Config::get('security_token_signer');
 		$gadgetSigner = new $gadgetSigner();
 		//FIXME currently don't have a propper token, impliment and re-enable this asap
 		$securityToken = $gadgetSigner->createToken($token);
@@ -122,4 +122,4 @@
 		echo header("HTTP/1.0 400 Bad Request", true, 400);
 		die("<h1>Bad Request</h1>");
 	}
-}
\ No newline at end of file
+}

Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/ActivitiesService.php Sat May 10 04:09:05 2008
@@ -22,7 +22,7 @@
 	/**
 	 * Returns a list of activities that correspond to the passed in person ids.
 	 * @param ids The ids of the people to fetch activities for.
-	 * @param token A valid GadgetToken
+	 * @param token A valid SecurityToken
 	 * @return a response item with the list of activities.
 	 */
 	abstract public function getActivities($ids, $token);
@@ -32,7 +32,7 @@
 	 * called, getActivities will be able to return the Activity.
 	 * @param personId The id of the person to create the activity for.
 	 * @param activity The activity to create.
-	 * @param token A valid GadgetToken
+	 * @param token A valid SecurityToken
 	 * @return a response item containing any errors
 	 */
 	abstract public function createActivity($personId, $activity, $token);

Modified: incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php?rev=655046&r1=655045&r2=655046&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/opensocial/DataService.php Sat May 10 04:09:05 2008
@@ -23,7 +23,7 @@
 	 * Fetch data for a list of ids.
 	 * @param ids The list of ids
 	 * @param keys The list of keys to fetch
-	 * @param token The GadgetToken for this request
+	 * @param token The SecurityToken for this request
 	 * @return ResponseItem a response item with the error code set if
 	 *     there was a problem
 	 */
@@ -35,7 +35,7 @@
 	 * @param id The person the data is for.
 	 * @param key The key of the data.
 	 * @param value The new value of the data.
-	 * @param token The GadgetToken for this request
+	 * @param token The SecurityToken for this request
 	 * @return ResponseItem a response item with the error code set if
 	 *     there was a problem
 	 */