/usr/share/php/Horde/Service/Twitter/Auth/Oauth.php is in php-horde-service-twitter 2.1.5-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | <?php
/**
* Horde_Service_Twitter_Auth class to abstract all auth related tasks
*
* Basically implements Horde_Oauth_Client and passes the calls along to the
* protected oauth object.
*
* Copyright 2009-2015 Horde LLC (http://www.horde.org/)
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Service_Twitter
*/
class Horde_Service_Twitter_Auth_Oauth extends Horde_Service_Twitter_Auth
{
/**
*
* @var Horde_OAuth_Token
*/
protected $_token;
public function __construct(Horde_OAuth_Consumer $oauth)
{
$this->_config['oauth'] = $oauth;
}
/**
* Obtain the URL used to get an authorization token.
*
* @param Horde_Oauth_Token $requestToken The request token
*
* @return string The Url
*/
public function getUserAuthorizationUrl($requestToken)
{
return $this->oauth->getUserAuthorizationUrl($requestToken);
}
/**
* Set the access token
*
* @param Horde_OAuth_Token $token
*/
public function setToken(Horde_OAuth_Token $token)
{
$this->_token = $token;
}
/**
* Obtain the access token. This is the token that should be persisted to
* storage.
*
* @param Horde_Controller_Request_Http Http request object
* @param string $requestSecret The token secret returned by
* Twitter after the user authorizes
* the application.
* @return Horde_Oauth_Token
* @throws Horde_Service_Twitter_Exception
*/
public function getAccessToken(Horde_Controller_Request_Http $request, $requestSecret = null)
{
if (!empty($this->_token)) {
return $this->_token;
}
$params = $request->getGetVars();
if (empty($params['oauth_token'])) {
return false;
}
$token = new Horde_Oauth_Token($params['oauth_token'], $requestSecret);
try {
return $this->oauth->getAccessToken($token, array('oauth_verifier' => $requestSecret));
} catch (Horde_Oauth_Exception $e) {
throw new Horde_Service_Twitter_Exception($e->getMessage());
}
}
/**
* Obtain the OAuth request token
*
* @param array $params
*
* @return Horde_OAuth_Token The request token
* @throws Horde_Service_Twitter_Exception
*/
public function getRequestToken($params = array())
{
try {
return $this->oauth->getRequestToken($params);
} catch (Horde_Oauth_Exception $e) {
throw new Horde_Service_Twitter_Exception($e->getMessage());
}
}
}
|