Файловый менеджер - Редактировать - /var/www/html/OAuth.zip
Ðазад
PK ! �f�� Common/AutoLoader.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * PSR-0 Autoloader * * @author ieter Hordijk <info@pieterhordijk.com> */ class AutoLoader { /** * @var string The namespace prefix for this instance. */ protected $namespace = ''; /** * @var string The filesystem prefix to use for this instance */ protected $path = ''; /** * Build the instance of the autoloader * * @param string $namespace The prefixed namespace this instance will load * @param string $path The filesystem path to the root of the namespace */ public function __construct($namespace, $path) { $this->namespace = ltrim($namespace, '\\'); $this->path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR; } /** * Try to load a class * * @param string $class The class name to load * * @return boolean If the loading was successful */ public function load($class) { $class = ltrim($class, '\\'); if (strpos($class, $this->namespace) === 0) { $nsparts = explode('\\', $class); $class = array_pop($nsparts); $nsparts[] = ''; $path = $this->path . implode(DIRECTORY_SEPARATOR, $nsparts); $path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; if (file_exists($path)) { require $path; return true; } } return false; } /** * Register the autoloader to PHP * * @return boolean The status of the registration */ public function register() { return spl_autoload_register(array($this, 'load')); } /** * Unregister the autoloader to PHP * * @return boolean The status of the unregistration */ public function unregister() { return spl_autoload_unregister(array($this, 'load')); } } PK ! B�r� � Common/Token/AbstractToken.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Token; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Base token implementation for any OAuth version. */ abstract class AbstractToken implements TokenInterface { /** * @var string */ protected $accessToken; /** * @var string */ protected $refreshToken; /** * @var int */ protected $endOfLife; /** * @var array */ protected $extraParams = array(); /** * @param string $accessToken * @param string $refreshToken * @param int $lifetime * @param array $extraParams */ public function __construct($accessToken = null, $refreshToken = null, $lifetime = null, $extraParams = array()) { $this->accessToken = $accessToken; $this->refreshToken = $refreshToken; $this->setLifetime($lifetime); $this->extraParams = $extraParams; } /** * @return string */ public function getAccessToken() { return $this->accessToken; } /** * @return string */ public function getRefreshToken() { return $this->refreshToken; } /** * @return int */ public function getEndOfLife() { return $this->endOfLife; } /** * @param array $extraParams */ public function setExtraParams(array $extraParams) { $this->extraParams = $extraParams; } /** * @return array */ public function getExtraParams() { return $this->extraParams; } /** * @param string $accessToken */ public function setAccessToken($accessToken) { $this->accessToken = $accessToken; } /** * @param int $endOfLife */ public function setEndOfLife($endOfLife) { $this->endOfLife = $endOfLife; } /** * @param int $lifetime */ public function setLifetime($lifetime) { if (0 === $lifetime || static::EOL_NEVER_EXPIRES === $lifetime) { $this->endOfLife = static::EOL_NEVER_EXPIRES; } elseif (null !== $lifetime) { $this->endOfLife = intval($lifetime) + time(); } else { $this->endOfLife = static::EOL_UNKNOWN; } } /** * @param string $refreshToken */ public function setRefreshToken($refreshToken) { $this->refreshToken = $refreshToken; } } PK ! <���E E 0 Common/Token/Exception/ExpiredTokenException.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Token\Exception; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Exception\Exception; /** * Exception thrown when an expired token is attempted to be used. */ class ExpiredTokenException extends Exception { } PK ! �V� ! Common/Token/Exception/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! �V� Common/Token/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! Й3�� � Common/Token/TokenInterface.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Token; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Base token interface for any OAuth version. */ interface TokenInterface { /** * Denotes an unknown end of life time. */ const EOL_UNKNOWN = -9001; /** * Denotes a token which never expires, should only happen in OAuth1. */ const EOL_NEVER_EXPIRES = -9002; /** * @return string */ public function getAccessToken(); /** * @return int */ public function getEndOfLife(); /** * @return array */ public function getExtraParams(); /** * @param string $accessToken */ public function setAccessToken($accessToken); /** * @param int $endOfLife */ public function setEndOfLife($endOfLife); /** * @param int $lifetime */ public function setLifetime($lifetime); /** * @param array $extraParams */ public function setExtraParams(array $extraParams); /** * @return string */ public function getRefreshToken(); /** * @param string $refreshToken */ public function setRefreshToken($refreshToken); } PK ! ��D�� � ! Common/Storage/SymfonySession.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\Exception\TokenNotFoundException; use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; use Symfony\Component\HttpFoundation\Session\SessionInterface; class SymfonySession implements TokenStorageInterface { private $session; private $sessionVariableName; private $stateVariableName; /** * @param SessionInterface $session * @param bool $startSession * @param string $sessionVariableName * @param string $stateVariableName */ public function __construct( SessionInterface $session, $startSession = true, $sessionVariableName = 'lusitanian_oauth_token', $stateVariableName = 'lusitanian_oauth_state' ) { $this->session = $session; $this->sessionVariableName = $sessionVariableName; $this->stateVariableName = $stateVariableName; } /** * {@inheritDoc} */ public function retrieveAccessToken($service) { if ($this->hasAccessToken($service)) { // get from session $tokens = $this->session->get($this->sessionVariableName); // one item return $tokens[$service]; } throw new TokenNotFoundException('Token not found in session, are you sure you stored it?'); } /** * {@inheritDoc} */ public function storeAccessToken($service, TokenInterface $token) { // get previously saved tokens $tokens = $this->session->get($this->sessionVariableName); if (!is_array($tokens)) { $tokens = array(); } $tokens[$service] = $token; // save $this->session->set($this->sessionVariableName, $tokens); // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAccessToken($service) { // get from session $tokens = $this->session->get($this->sessionVariableName); return is_array($tokens) && isset($tokens[$service]) && $tokens[$service] instanceof TokenInterface; } /** * {@inheritDoc} */ public function clearToken($service) { // get previously saved tokens $tokens = $this->session->get($this->sessionVariableName); if (is_array($tokens) && array_key_exists($service, $tokens)) { unset($tokens[$service]); // Replace the stored tokens array $this->session->set($this->sessionVariableName, $tokens); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllTokens() { $this->session->remove($this->sessionVariableName); // allow chaining return $this; } /** * {@inheritDoc} */ public function retrieveAuthorizationState($service) { if ($this->hasAuthorizationState($service)) { // get from session $states = $this->session->get($this->stateVariableName); // one item return $states[$service]; } throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?'); } /** * {@inheritDoc} */ public function storeAuthorizationState($service, $state) { // get previously saved tokens $states = $this->session->get($this->stateVariableName); if (!is_array($states)) { $states = array(); } $states[$service] = $state; // save $this->session->set($this->stateVariableName, $states); // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAuthorizationState($service) { // get from session $states = $this->session->get($this->stateVariableName); return is_array($states) && isset($states[$service]) && null !== $states[$service]; } /** * {@inheritDoc} */ public function clearAuthorizationState($service) { // get previously saved tokens $states = $this->session->get($this->stateVariableName); if (is_array($states) && array_key_exists($service, $states)) { unset($states[$service]); // Replace the stored tokens array $this->session->set($this->stateVariableName, $states); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllAuthorizationStates() { $this->session->remove($this->stateVariableName); // allow chaining return $this; } /** * @return Session */ public function getSession() { return $this->session; } } PK ! }(A�a a Common/Storage/Memory.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\Exception\TokenNotFoundException; use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; /* * Stores a token in-memory only (destroyed at end of script execution). */ class Memory implements TokenStorageInterface { /** * @var object|TokenInterface */ protected $tokens; /** * @var array */ protected $states; public function __construct() { $this->tokens = array(); $this->states = array(); } /** * {@inheritDoc} */ public function retrieveAccessToken($service) { if ($this->hasAccessToken($service)) { return $this->tokens[$service]; } throw new TokenNotFoundException('Token not stored'); } /** * {@inheritDoc} */ public function storeAccessToken($service, TokenInterface $token) { $this->tokens[$service] = $token; // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAccessToken($service) { return isset($this->tokens[$service]) && $this->tokens[$service] instanceof TokenInterface; } /** * {@inheritDoc} */ public function clearToken($service) { if (array_key_exists($service, $this->tokens)) { unset($this->tokens[$service]); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllTokens() { $this->tokens = array(); // allow chaining return $this; } /** * {@inheritDoc} */ public function retrieveAuthorizationState($service) { if ($this->hasAuthorizationState($service)) { return $this->states[$service]; } throw new AuthorizationStateNotFoundException('State not stored'); } /** * {@inheritDoc} */ public function storeAuthorizationState($service, $state) { $this->states[$service] = $state; // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAuthorizationState($service) { return isset($this->states[$service]) && null !== $this->states[$service]; } /** * {@inheritDoc} */ public function clearAuthorizationState($service) { if (array_key_exists($service, $this->states)) { unset($this->states[$service]); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllAuthorizationStates() { $this->states = array(); // allow chaining return $this; } } PK ! 5�f� 3 Common/Storage/Exception/TokenNotFoundException.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage\Exception; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Exception thrown when a token is not found in storage. */ class TokenNotFoundException extends StorageException { } PK ! �V� # Common/Storage/Exception/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! ��L, , @ Common/Storage/Exception/AuthorizationStateNotFoundException.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage\Exception; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Exception thrown when a state is not found in storage. */ class AuthorizationStateNotFoundException extends StorageException { } PK ! B� ) - Common/Storage/Exception/StorageException.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage\Exception; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Exception\Exception; /** * Generic storage exception. */ class StorageException extends Exception { } PK ! ѷm t t Common/Storage/Session.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\Exception\TokenNotFoundException; use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; /** * Stores a token in a PHP session. */ class Session implements TokenStorageInterface { /** * @var string */ protected $sessionVariableName; /** * @var string */ protected $stateVariableName; /** * @param bool $startSession Whether or not to start the session upon construction. * @param string $sessionVariableName the variable name to use within the _SESSION superglobal * @param string $stateVariableName */ public function __construct( $startSession = true, $sessionVariableName = 'lusitanian_oauth_token', $stateVariableName = 'lusitanian_oauth_state' ) { try { if ($startSession) { @session_start(); } } catch (\Exception $e) { } $this->sessionVariableName = $sessionVariableName; $this->stateVariableName = $stateVariableName; if (!isset($_SESSION[$sessionVariableName])) { $_SESSION[$sessionVariableName] = array(); } if (!isset($_SESSION[$stateVariableName])) { $_SESSION[$stateVariableName] = array(); } } /** * {@inheritDoc} */ public function retrieveAccessToken($service) { if ($this->hasAccessToken($service)) { return unserialize($_SESSION[$this->sessionVariableName][$service]); } throw new TokenNotFoundException('Token not found in session, are you sure you stored it?'); } /** * {@inheritDoc} */ public function storeAccessToken($service, TokenInterface $token) { $serializedToken = serialize($token); if (isset($_SESSION[$this->sessionVariableName]) && is_array($_SESSION[$this->sessionVariableName]) ) { $_SESSION[$this->sessionVariableName][$service] = $serializedToken; } else { $_SESSION[$this->sessionVariableName] = array( $service => $serializedToken, ); } // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAccessToken($service) { return isset($_SESSION[$this->sessionVariableName], $_SESSION[$this->sessionVariableName][$service]); } /** * {@inheritDoc} */ public function clearToken($service) { if (array_key_exists($service, $_SESSION[$this->sessionVariableName])) { unset($_SESSION[$this->sessionVariableName][$service]); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllTokens() { unset($_SESSION[$this->sessionVariableName]); // allow chaining return $this; } /** * {@inheritDoc} */ public function storeAuthorizationState($service, $state) { if (isset($_SESSION[$this->stateVariableName]) && is_array($_SESSION[$this->stateVariableName]) ) { $_SESSION[$this->stateVariableName][$service] = $state; } else { $_SESSION[$this->stateVariableName] = array( $service => $state, ); } // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAuthorizationState($service) { return isset($_SESSION[$this->stateVariableName], $_SESSION[$this->stateVariableName][$service]); } /** * {@inheritDoc} */ public function retrieveAuthorizationState($service) { if ($this->hasAuthorizationState($service)) { return $_SESSION[$this->stateVariableName][$service]; } throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?'); } /** * {@inheritDoc} */ public function clearAuthorizationState($service) { if (array_key_exists($service, $_SESSION[$this->stateVariableName])) { unset($_SESSION[$this->stateVariableName][$service]); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllAuthorizationStates() { unset($_SESSION[$this->stateVariableName]); // allow chaining return $this; } public function __destruct() { // session_write_close(); } } PK ! �V� Common/Storage/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! \�*a� � Common/Storage/Redis.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\Exception\TokenNotFoundException; use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; use Predis\Client as Predis; /* * Stores a token in a Redis server. Requires the Predis library available at https://github.com/nrk/predis */ class Redis implements TokenStorageInterface { /** * @var string */ protected $key; protected $stateKey; /** * @var object|\Redis */ protected $redis; /** * @var object|TokenInterface */ protected $cachedTokens; /** * @var object */ protected $cachedStates; /** * @param Predis $redis An instantiated and connected redis client * @param string $key The key to store the token under in redis * @param string $stateKey The key to store the state under in redis. */ public function __construct(Predis $redis, $key, $stateKey) { $this->redis = $redis; $this->key = $key; $this->stateKey = $stateKey; $this->cachedTokens = array(); $this->cachedStates = array(); } /** * {@inheritDoc} */ public function retrieveAccessToken($service) { if (!$this->hasAccessToken($service)) { throw new TokenNotFoundException('Token not found in redis'); } if (isset($this->cachedTokens[$service])) { return $this->cachedTokens[$service]; } $val = $this->redis->hget($this->key, $service); return $this->cachedTokens[$service] = unserialize($val); } /** * {@inheritDoc} */ public function storeAccessToken($service, TokenInterface $token) { // (over)write the token $this->redis->hset($this->key, $service, serialize($token)); $this->cachedTokens[$service] = $token; // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAccessToken($service) { if (isset($this->cachedTokens[$service]) && $this->cachedTokens[$service] instanceof TokenInterface ) { return true; } return $this->redis->hexists($this->key, $service); } /** * {@inheritDoc} */ public function clearToken($service) { $this->redis->hdel($this->key, $service); unset($this->cachedTokens[$service]); // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllTokens() { // memory $this->cachedTokens = array(); // redis $keys = $this->redis->hkeys($this->key); $me = $this; // 5.3 compat // pipeline for performance $this->redis->pipeline( function ($pipe) use ($keys, $me) { foreach ($keys as $k) { $pipe->hdel($me->getKey(), $k); } } ); // allow chaining return $this; } /** * {@inheritDoc} */ public function retrieveAuthorizationState($service) { if (!$this->hasAuthorizationState($service)) { throw new AuthorizationStateNotFoundException('State not found in redis'); } if (isset($this->cachedStates[$service])) { return $this->cachedStates[$service]; } $val = $this->redis->hget($this->stateKey, $service); return $this->cachedStates[$service] = unserialize($val); } /** * {@inheritDoc} */ public function storeAuthorizationState($service, $state) { // (over)write the token $this->redis->hset($this->stateKey, $service, $state); $this->cachedStates[$service] = $state; // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAuthorizationState($service) { if (isset($this->cachedStates[$service]) && null !== $this->cachedStates[$service] ) { return true; } return $this->redis->hexists($this->stateKey, $service); } /** * {@inheritDoc} */ public function clearAuthorizationState($service) { $this->redis->hdel($this->stateKey, $service); unset($this->cachedStates[$service]); // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllAuthorizationStates() { // memory $this->cachedStates = array(); // redis $keys = $this->redis->hkeys($this->stateKey); $me = $this; // 5.3 compat // pipeline for performance $this->redis->pipeline( function ($pipe) use ($keys, $me) { foreach ($keys as $k) { $pipe->hdel($me->getKey(), $k); } } ); // allow chaining return $this; } /** * @return Predis $redis */ public function getRedis() { return $this->redis; } /** * @return string $key */ public function getKey() { return $this->key; } } PK ! ���VT T ( Common/Storage/TokenStorageInterface.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Storage; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\Exception\TokenNotFoundException; /** * All token storage providers must implement this interface. */ interface TokenStorageInterface { /** * @param string $service * * @return TokenInterface * * @throws TokenNotFoundException */ public function retrieveAccessToken($service); /** * @param string $service * @param TokenInterface $token * * @return TokenStorageInterface */ public function storeAccessToken($service, TokenInterface $token); /** * @param string $service * * @return bool */ public function hasAccessToken($service); /** * Delete the users token. Aka, log out. * * @param string $service * * @return TokenStorageInterface */ public function clearToken($service); /** * Delete *ALL* user tokens. Use with care. Most of the time you will likely * want to use clearToken() instead. * * @return TokenStorageInterface */ public function clearAllTokens(); /** * Store the authorization state related to a given service * * @param string $service * @param string $state * * @return TokenStorageInterface */ public function storeAuthorizationState($service, $state); /** * Check if an authorization state for a given service exists * * @param string $service * * @return bool */ public function hasAuthorizationState($service); /** * Retrieve the authorization state for a given service * * @param string $service * * @return string */ public function retrieveAuthorizationState($service); /** * Clear the authorization state of a given service * * @param string $service * * @return TokenStorageInterface */ public function clearAuthorizationState($service); /** * Delete *ALL* user authorization states. Use with care. Most of the time you will likely * want to use clearAuthorization() instead. * * @return TokenStorageInterface */ public function clearAllAuthorizationStates(); } PK ! _r� � Common/Exception/Exception.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Exception; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Generic library-level exception. */ class Exception extends \Exception { } PK ! �V� Common/Exception/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! �V� Common/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! �+w0 0 % Common/Http/Client/AbstractClient.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Http\Client; defined ( '_JEXEC' ) or die ( 'Restricted access' ); /** * Abstract HTTP client */ abstract class AbstractClient implements ClientInterface { /** * @var string The user agent string passed to services */ protected $userAgent; /** * @var int The maximum number of redirects */ protected $maxRedirects = 5; /** * @var int The maximum timeout */ protected $timeout = 15; /** * Creates instance * * @param string $userAgent The UA string the client will use */ public function __construct($userAgent = 'PHPoAuthLib') { $this->userAgent = $userAgent; } /** * @param int $redirects Maximum redirects for client * * @return ClientInterface */ public function setMaxRedirects($redirects) { $this->maxRedirects = $redirects; return $this; } /** * @param int $timeout Request timeout time for client in seconds * * @return ClientInterface */ public function setTimeout($timeout) { $this->timeout = $timeout; return $this; } /** * @param array $headers */ public function normalizeHeaders(&$headers) { // Normalize headers array_walk( $headers, function (&$val, $key) { $key = ucfirst(strtolower($key)); $val = ucfirst(strtolower($key)) . ': ' . $val; } ); } } PK ! �x�n� � ! Common/Http/Client/CurlClient.phpnu �[��� <?php // namespace administrator\components\com_jchat\framework; /** * * @package JCHAT::CONFIG::administrator::components::com_jchat * @subpackage framework * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ namespace OAuth\Common\Http\Client; defined ( '_JEXEC' ) or die ( 'Restricted access' ); use OAuth\Common\Http\Exception\TokenResponseException; use OAuth\Common\Http\Uri\UriInterface; /** * Client implementation for cURL */ class CurlClient extends AbstractClient { /** * If true, explicitly sets cURL to use SSL version 3. Use this if cURL * compiles with GnuTLS SSL. * * @var bool */ private $forceSSL3 = false; /** * Additional parameters (as `key => value` pairs) to be passed to `curl_setopt` * * @var array */ private $parameters = array(); /** * Additional `curl_setopt` parameters * * @param array $parameters */ public function setCurlParameters(array $parameters) { $this->parameters = $parameters; } /** * @param bool $force * * @return CurlClient */ public function setForceSSL3($force) { $this->forceSSL3 = $force; return $this; } /** * Any implementing HTTP providers should send a request to the provided endpoint with the parameters. * They should return, in string form, the response body and throw an exception on error. * * @param UriInterface $endpoint * @param mixed $requestBody * @param array $extraHeaders * @param string $method * * @return string * * @throws TokenResponseException * @throws \InvalidArgumentException */ public function retrieveResponse( UriInterface $endpoint, $requestBody, array $extraHeaders = array(), $method = 'POST' ) { // Normalize method name $method = strtoupper($method); $this->normalizeHeaders($extraHeaders); if ($method === 'GET' && !empty($requestBody)) { throw new \InvalidArgumentException('No body expected for "GET" request.'); } if (!isset($extraHeaders['Content-type']) && $method === 'POST' && is_array($requestBody)) { $extraHeaders['Content-type'] = 'Content-type: application/x-www-form-urlencoded'; } $extraHeaders['Host'] = 'Host: '.$endpoint->getHost(); $extraHeaders['Connection'] = 'Connection: close'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri()); if ($method === 'POST' || $method === 'PUT') { if ($requestBody && is_array($requestBody)) { $requestBody = http_build_query($requestBody, '', '&'); } if ($method === 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); } else { curl_setopt($ch, CURLOPT_POST, true); } curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody); } else { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); } if ($this->maxRedirects > 0) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects); } curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders); curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); foreach ($this->parameters as $key => $value) { curl_setopt($ch, $key, $value); } if ($this->forceSSL3) { curl_setopt($ch, CURLOPT_SSLVERSION, 3); } $response = curl_exec($ch); $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (false === $response) { $errNo = curl_errno($ch); $errStr = curl_error($ch); curl_close($ch); if (empty($errStr)) { throw new TokenResponseException('Failed to request resource.', $responseCode); } throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode); } curl_close($ch); return $response; } } PK ! �V� Common/Http/Client/index.htmlnu �[��� <!DOCTYPE html><title></title> PK ! ��� � &