aboutsummaryrefslogtreecommitdiffstats
path: root/library/OAuth1.php
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-11-07 17:41:23 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2011-11-07 17:41:23 +0100
commit00c342e13d833fd215e5dc03a508e1abe660fe21 (patch)
treed276554274475d8a0e2d8e1e9ae34035dd64085a /library/OAuth1.php
parent355026ab7a53838c8e7a7b5717626ee057e5cd4c (diff)
parentb070666120fc6cbc0d90a0ad160274f8ecf7a027 (diff)
downloadvolse-hubzilla-00c342e13d833fd215e5dc03a508e1abe660fe21.tar.gz
volse-hubzilla-00c342e13d833fd215e5dc03a508e1abe660fe21.tar.bz2
volse-hubzilla-00c342e13d833fd215e5dc03a508e1abe660fe21.zip
Merge branch 'oauthapi'
Diffstat (limited to 'library/OAuth1.php')
-rw-r--r--library/OAuth1.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/library/OAuth1.php b/library/OAuth1.php
index 67a94c479..3b211b146 100644
--- a/library/OAuth1.php
+++ b/library/OAuth1.php
@@ -27,6 +27,10 @@ class OAuthToken {
public $key;
public $secret;
+ public $expires;
+ public $scope;
+ public $uid;
+
/**
* key = the token
* secret = the token secret
@@ -85,7 +89,8 @@ abstract class OAuthSignatureMethod {
*/
public function check_signature($request, $consumer, $token, $signature) {
$built = $this->build_signature($request, $consumer, $token);
- return $built == $signature;
+ //echo "<pre>"; var_dump($signature, $built, ($built == $signature)); killme();
+ return ($built == $signature);
}
}
@@ -113,7 +118,9 @@ class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {
$key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
$key = implode('&', $key_parts);
- return base64_encode(hash_hmac('sha1', $base_string, $key, true));
+
+ $r = base64_encode(hash_hmac('sha1', $base_string, $key, true));
+ return $r;
}
}
@@ -282,7 +289,12 @@ class OAuthRequest {
}
}
-
+ // fix for friendika redirect system
+
+ $http_url = substr($http_url, 0, strpos($http_url,$parameters['q'])+strlen($parameters['q']));
+ unset( $parameters['q'] );
+
+ //echo "<pre>".__function__."\n"; var_dump($http_method, $http_url, $parameters, $_SERVER['REQUEST_URI']); killme();
return new OAuthRequest($http_method, $http_url, $parameters);
}
@@ -544,6 +556,7 @@ class OAuthServer {
public function verify_request(&$request) {
$this->get_version($request);
$consumer = $this->get_consumer($request);
+ //echo __file__.__line__.__function__."<pre>"; var_dump($consumer); die();
$token = $this->get_token($request, $consumer, "access");
$this->check_signature($request, $consumer, $token);
return array($consumer, $token);
@@ -642,6 +655,7 @@ class OAuthServer {
$token,
$signature
);
+
if (!$valid_sig) {
throw new OAuthException("Invalid signature");