Author: chabotc
Date: Sun Jan 18 02:04:14 2009
New Revision: 735423
URL: http://svn.apache.org/viewvc?rev=735423&view=rev
Log:
SHINDIG-854 by Eiji Kitamura, fixes the following issues for the oauth proxy
service:
- According to XSD, each url for OAuthServices (request, authorization, access)
isn't mandatory. Current implementation is assuming they are existing.
- parseEndPoint had better trim its paramers.
- Some parameters (OAuth/serv...@name, OAuth/Service/requ...@url,
OAuth/Service/acc...@url, OAuth/Service/authorizat...@url) are required but not
checked on current code.
- OAuth param_location isn't conforming to the spec.
Modified:
incubator/shindig/trunk/php/src/gadgets/UserPrefs.php
incubator/shindig/trunk/php/src/gadgets/oauth/OAuthService.php
Modified: incubator/shindig/trunk/php/src/gadgets/UserPrefs.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/UserPrefs.php?rev=735423&r1=735422&r2=735423&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/UserPrefs.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/UserPrefs.php Sun Jan 18 02:04:14
2009
@@ -32,4 +32,4 @@
public function getPref($name) {
return isset($this->prefs[$name]) ? $this->prefs[$name] : null;
}
-}
\ No newline at end of file
+}
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthService.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthService.php?rev=735423&r1=735422&r2=735423&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthService.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthService.php Sun Jan 18
02:04:14 2009
@@ -35,23 +35,29 @@
public function __construct($service) {
$attrs = $service->attributes();
$this->name = (string)$attrs['name'];
- $this->requestUrl = $this->parseEndPoint($service->Request->attributes());
- $this->authorizationUrl =
$this->parseEndPoint($service->Authorization->attributes());
- $this->accessUrl = $this->parseEndPoint($service->Access->attributes());
+ if (isset($service->Request)) {
+ $this->requestUrl =
$this->parseEndPoint($service->Request->attributes());
+ }
+ if (isset($service->Authorization)) {
+ $this->authorizationUrl =
$this->parseEndPoint($service->Authorization->attributes());
+ }
+ if (isset($service->Access)) {
+ $this->accessUrl = $this->parseEndPoint($service->Access->attributes());
+ }
}
private function parseEndPoint($element) {
- $url = (string)$element[OAuthService::$URL_ATTR];
+ $url = trim((string)$element[OAuthService::$URL_ATTR]);
if (empty($url)) {
throw new SpecParserException("Not an HTTP url");
}
$location = Location::$header;
- $locationString = (string)$element[OAuthService::$PARAM_LOCATION_ATTR];
+ $locationString =
trim((string)$element[OAuthService::$PARAM_LOCATION_ATTR]);
if (! empty($locationString)) {
$location = $locationString;
}
$method = Method::$GET;
- $methodString = (string)$element[OAuthService::$METHOD_ATTR];
+ $methodString = trim((string)$element[OAuthService::$METHOD_ATTR]);
if (! empty($methodString)) {
$method = $methodString;
}
@@ -88,9 +94,9 @@
* access token, or resource URL. (Lowercase to match gadget spec schema)
*/
class Location {
- public static $header = "header";
- public static $url = "url";
- public static $body = "body";
+ public static $header = "auth-header";
+ public static $url = "url-query";
+ public static $body = "post-body";
}
/**