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/04/06 20:47:01 UTC

svn commit: r762451 - in /incubator/shindig/trunk/php/src: common/OAuthLookupService.php social/servlet/ApiServlet.php

Author: chabotc
Date: Mon Apr  6 18:47:00 2009
New Revision: 762451

URL: http://svn.apache.org/viewvc?rev=762451&view=rev
Log:
Re-enables the exception on unsupported content-type and adds the content-type to the oauth lookup service call

Modified:
    incubator/shindig/trunk/php/src/common/OAuthLookupService.php
    incubator/shindig/trunk/php/src/social/servlet/ApiServlet.php

Modified: incubator/shindig/trunk/php/src/common/OAuthLookupService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/OAuthLookupService.php?rev=762451&r1=762450&r2=762451&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/OAuthLookupService.php (original)
+++ incubator/shindig/trunk/php/src/common/OAuthLookupService.php Mon Apr  6 18:47:00 2009
@@ -24,6 +24,6 @@
  */
 abstract class OAuthLookupService {
 
-  abstract public function getSecurityToken($oauthRequest, $appUrl, $userId);
+  abstract public function getSecurityToken($oauthRequest, $appUrl, $userId, $contentType);
 }
 

Modified: incubator/shindig/trunk/php/src/social/servlet/ApiServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/servlet/ApiServlet.php?rev=762451&r1=762450&r2=762451&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/servlet/ApiServlet.php (original)
+++ incubator/shindig/trunk/php/src/social/servlet/ApiServlet.php Mon Apr  6 18:47:00 2009
@@ -88,7 +88,7 @@
     }
     if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
       if (! isset($_SERVER['CONTENT_TYPE']) || ! in_array($_SERVER['CONTENT_TYPE'], $acceptedContentTypes)) {
-        //throw new Exception("[{$_SERVER['CONTENT_TYPE']}] When posting to the social end-point you *must* specify a content type, supported content types are: 'application/json', 'application/xml' and 'application/atom+xml'");
+        throw new Exception("[{$_SERVER['CONTENT_TYPE']}] When posting to the social end-point you *must* specify a content type, supported content types are: 'application/json', 'application/xml' and 'application/atom+xml'");
       }
     }
   }
@@ -104,7 +104,7 @@
       // look up the user and perms for this oauth request
       $oauthLookupService = Config::get('oauth_lookup_service');
       $oauthLookupService = new $oauthLookupService();
-      $token = $oauthLookupService->getSecurityToken($request, $appUrl, $userId);
+      $token = $oauthLookupService->getSecurityToken($request, $appUrl, $userId, $this->getContentType());
       if ($token) {
         $token->setAuthenticationMode(AuthenticationMode::$OAUTH_CONSUMER_REQUEST);
         return $token;
@@ -122,9 +122,6 @@
         // for private profiles etc in your code so their not publicly
         // accessable to anoymous users! Anonymous == owner = viewer = appId = modId = 0
         // create token with 0 values, no gadget url, no domain and 0 duration
-
-
-        //FIXME change this to a new AnonymousToken when reworking auth token
         $gadgetSigner = Config::get('security_token');
         return new $gadgetSigner(null, 0, 0, 0, 0, '', '', 0, Config::get('container_id'));
       } else {