Move OAuth classes into lib/oauth

This commit is contained in:
Tom Needham 2012-08-03 11:47:05 +00:00
parent 88c6928bad
commit a7906d813a
4 changed files with 40 additions and 4 deletions

View File

@ -32,7 +32,7 @@ class OC_API {
* initialises the OAuth store and server * initialises the OAuth store and server
*/ */
private static function init() { private static function init() {
self::$server = new OC_OAuthServer(new OC_OAuthStore()); self::$server = new OC_OAuth_Server(new OC_OAuth_Store());
} }
/** /**

View File

@ -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) { public function fetch_request_token(&$request) {
$this->get_version($request); $this->get_version($request);
@ -34,6 +36,11 @@ class OC_OAuthServer extends OAuthServer {
return $this->data_store->new_request_token($consumer, $scope, $callback); 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) { public function authoriseRequestToken(&$request) {
$this->get_version($request); $this->get_version($request);
$consumer = $this->get_consumer($request); $consumer = $this->get_consumer($request);

29
lib/oauth/store.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* ownCloud
*
* @author Tom Needham
* @author Michael Gapczynski
* @copyright 2012 Tom Needham tom@owncloud.com
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_OAuth_Store extends OAuthDataStore {
// To follow.
}

View File

@ -9,7 +9,7 @@ require_once('../lib/base.php');
// Logic // Logic
$operation = isset($_GET['operation']) ? $_GET['operation'] : ''; $operation = isset($_GET['operation']) ? $_GET['operation'] : '';
$server = new OC_OAuthServer(new OC_OAuthStore()); $server = new OC_OAuth_Server(new OC_OAuth_Store());
switch($operation){ switch($operation){
case 'register': case 'register':