From a7906d813ad342f06d4834c10c1200002f7342d2 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 3 Aug 2012 11:47:05 +0000 Subject: [PATCH] Move OAuth classes into lib/oauth --- lib/api.php | 4 ++-- lib/{oauth.php => oauth/server.php} | 9 ++++++++- lib/oauth/store.php | 29 +++++++++++++++++++++++++++++ settings/oauth.php | 2 +- 4 files changed, 40 insertions(+), 4 deletions(-) rename lib/{oauth.php => oauth/server.php} (90%) create mode 100644 lib/oauth/store.php diff --git a/lib/api.php b/lib/api.php index c8bd0aec2fa..8fdfc63070b 100644 --- a/lib/api.php +++ b/lib/api.php @@ -23,7 +23,7 @@ * License along with this library. If not, see . * */ - + class OC_API { private static $server; @@ -32,7 +32,7 @@ class OC_API { * initialises the OAuth store and server */ private static function init() { - self::$server = new OC_OAuthServer(new OC_OAuthStore()); + self::$server = new OC_OAuth_Server(new OC_OAuth_Store()); } /** diff --git a/lib/oauth.php b/lib/oauth/server.php similarity index 90% rename from lib/oauth.php rename to lib/oauth/server.php index b72d9aab446..c563c527601 100644 --- a/lib/oauth.php +++ b/lib/oauth/server.php @@ -22,7 +22,9 @@ * */ -class OC_OAuthServer extends OAuthServer { +require_once(OC::$THIRDPARTYROOT.'/3rdparty/OAuth/OAuth.php'); + +class OC_OAuth_Server extends OAuthServer { public function fetch_request_token(&$request) { $this->get_version($request); @@ -34,6 +36,11 @@ class OC_OAuthServer extends OAuthServer { return $this->data_store->new_request_token($consumer, $scope, $callback); } + /** + * authorises a request token + * @param string $request the request token to authorise + * @return What does it return? + */ public function authoriseRequestToken(&$request) { $this->get_version($request); $consumer = $this->get_consumer($request); diff --git a/lib/oauth/store.php b/lib/oauth/store.php new file mode 100644 index 00000000000..2f58e46b5b0 --- /dev/null +++ b/lib/oauth/store.php @@ -0,0 +1,29 @@ +. +* +*/ + +class OC_OAuth_Store extends OAuthDataStore { + + // To follow. + +} \ No newline at end of file diff --git a/settings/oauth.php b/settings/oauth.php index b04c798b1b0..7f30161d852 100644 --- a/settings/oauth.php +++ b/settings/oauth.php @@ -9,7 +9,7 @@ require_once('../lib/base.php'); // Logic $operation = isset($_GET['operation']) ? $_GET['operation'] : ''; -$server = new OC_OAuthServer(new OC_OAuthStore()); +$server = new OC_OAuth_Server(new OC_OAuth_Store()); switch($operation){ case 'register':