OAuth 1.0a and 2 support
This commit is contained in:
42
main/mashape/authentication/OAuthAuthentication.php
Normal file
42
main/mashape/authentication/OAuthAuthentication.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . "/Authentication.php");
|
||||
|
||||
class OAuthAuthentication implements Authentication {
|
||||
|
||||
protected $consumerKey;
|
||||
protected $consumerSecret;
|
||||
protected $redirectUrl;
|
||||
protected $accessToken;
|
||||
protected $accessSecret;
|
||||
|
||||
function __construct($consumerKey, $consumerSecret, $redirectUrl) {
|
||||
$this->consumerKey = $consumerKey;
|
||||
$this->consumerSecret = $consumerSecret;
|
||||
$this->redirectUrl = $redirectUrl;
|
||||
}
|
||||
|
||||
public function addAccessToken($accessToken, $accessSecret = null) {
|
||||
$this->accessToken = $accessToken;
|
||||
$this->accessSecret = $accessSecret;
|
||||
}
|
||||
|
||||
public function getOAuthBaseParams() {
|
||||
$params = array(
|
||||
"consumerKey" => $this->consumerKey,
|
||||
"consumerSecret" => $this->consumerSecret,
|
||||
"redirectUrl" => $this->redirectUrl,
|
||||
);
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function handleParams() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function handleHeaders() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user