1
0
Fork 0

Remove require calls to library/OAuth1

This commit is contained in:
Hypolite Petovan 2018-01-30 23:29:05 -05:00
parent 6edf84f528
commit 13849299f9
2 changed files with 10 additions and 15 deletions

View file

@ -1,10 +1,9 @@
<?php
/**
* @file src/Protocol/OAuth1.php
* @file src/Network/FKOAuth1.php
*/
namespace Friendica\Network;
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -12,10 +11,8 @@ use Friendica\Database\DBM;
use Friendica\Network\FKOAuthDataStore;
use dba;
use OAuthServer;
use OAuthSignatureMethod_PLAINTEXT;
use OAuthSignatureMethod_HMAC_SHA1;
require_once "library/OAuth1.php";
use OAuthSignatureMethod_PLAINTEXT;
/**
* @brief OAuth protocol

View file

@ -1,7 +1,7 @@
<?php
/**
* @file src/Protocol/FKOAuthDataStore.php
* @file src/Network/FKOAuthDataStore.php
* OAuth server
* Based on oauth2-php <http://code.google.com/p/oauth2-php/>
*
@ -9,20 +9,18 @@
namespace Friendica\Network;
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use dba;
use OAuthConsumer;
use OAuthDataStore;
use OAuthToken;
define('REQUEST_TOKEN_DURATION', 300);
define('ACCESS_TOKEN_DURATION', 31536000);
require_once 'include/dba.php';
require_once "library/OAuth1.php";
/**
* @brief OAuthDataStore class
*/
@ -48,7 +46,7 @@ class FKOAuthDataStore extends OAuthDataStore
$r = dba::inArray($s);
if (DBM::is_result($r)) {
return new \OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
return new OAuthConsumer($r[0]['client_id'], $r[0]['pw'], $r[0]['redirect_uri']);
}
return null;
@ -68,7 +66,7 @@ class FKOAuthDataStore extends OAuthDataStore
$r = dba::inArray($s);
if (DBM::is_result($r)) {
$ot = new \OAuthToken($r[0]['id'], $r[0]['secret']);
$ot = new OAuthToken($r[0]['id'], $r[0]['secret']);
$ot->scope = $r[0]['scope'];
$ot->expires = $r[0]['expires'];
$ot->uid = $r[0]['uid'];
@ -89,7 +87,7 @@ class FKOAuthDataStore extends OAuthDataStore
{
$token = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
if (DBM::is_result($token)) {
return new \OAuthToken($token['id'], $token['secret']);
return new OAuthToken($token['id'], $token['secret']);
}
return null;
@ -126,7 +124,7 @@ class FKOAuthDataStore extends OAuthDataStore
return null;
}
return new \OAuthToken($key, $sec);
return new OAuthToken($key, $sec);
}
/**
@ -165,7 +163,7 @@ class FKOAuthDataStore extends OAuthDataStore
);
if ($r) {
$ret = new \OAuthToken($key, $sec);
$ret = new OAuthToken($key, $sec);
}
}