diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-06 06:57:39 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-06 06:57:39 -0500 |
commit | 420d0ca4dd6cf075204867de28c2e6d5b1b68184 (patch) | |
tree | e7723f4b0687d82300ca5b4d38e3ab0ff3fc13cf /vendor/lusitanian/oauth/src/OAuth/OAuth2/Service | |
parent | cfe1e13d4a2b964c950b5e3daa8cafab207f1158 (diff) |
Remove vendor again
Diffstat (limited to 'vendor/lusitanian/oauth/src/OAuth/OAuth2/Service')
31 files changed, 0 insertions, 3359 deletions
diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/AbstractService.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/AbstractService.php deleted file mode 100644 index 57dc76f2..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/AbstractService.php +++ /dev/null @@ -1,333 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Exception\Exception; -use OAuth\Common\Service\AbstractService as BaseAbstractService; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\OAuth2\Service\Exception\InvalidAuthorizationStateException; -use OAuth\OAuth2\Service\Exception\InvalidScopeException; -use OAuth\OAuth2\Service\Exception\MissingRefreshTokenException; -use OAuth\Common\Token\TokenInterface; -use OAuth\Common\Token\Exception\ExpiredTokenException; - -abstract class AbstractService extends BaseAbstractService implements ServiceInterface -{ - /** @const OAUTH_VERSION */ - const OAUTH_VERSION = 2; - - /** @var array */ - protected $scopes; - - /** @var UriInterface|null */ - protected $baseApiUri; - - /** @var bool */ - protected $stateParameterInAuthUrl; - - /** - * @param CredentialsInterface $credentials - * @param ClientInterface $httpClient - * @param TokenStorageInterface $storage - * @param array $scopes - * @param UriInterface|null $baseApiUri - * @param bool $stateParameterInAutUrl - * - * @throws InvalidScopeException - */ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null, - $stateParameterInAutUrl = false - ) { - parent::__construct($credentials, $httpClient, $storage); - $this->stateParameterInAuthUrl = $stateParameterInAutUrl; - - foreach ($scopes as $scope) { - if (!$this->isValidScope($scope)) { - throw new InvalidScopeException('Scope ' . $scope . ' is not valid for service ' . get_class($this)); - } - } - - $this->scopes = $scopes; - - $this->baseApiUri = $baseApiUri; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - if ($this->needsStateParameterInAuthUrl()) { - if (!isset($parameters['state'])) { - $parameters['state'] = $this->generateAuthorizationState(); - } - $this->storeAuthorizationState($parameters['state']); - } - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function requestAccessToken($code, $state = null) - { - if (null !== $state) { - $this->validateAuthorizationState($state); - } - - $bodyParams = array( - 'code' => $code, - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * Sends an authenticated API request to the path provided. - * If the path provided is not an absolute URI, the base API Uri (must be passed into constructor) will be used. - * - * @param string|UriInterface $path - * @param string $method HTTP method - * @param array $body Request body if applicable. - * @param array $extraHeaders Extra headers if applicable. These will override service-specific - * any defaults. - * - * @return string - * - * @throws ExpiredTokenException - * @throws Exception - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = $this->determineRequestUriFromPath($path, $this->baseApiUri); - $token = $this->storage->retrieveAccessToken($this->service()); - - if ($token->getEndOfLife() !== TokenInterface::EOL_NEVER_EXPIRES - && $token->getEndOfLife() !== TokenInterface::EOL_UNKNOWN - && time() > $token->getEndOfLife() - ) { - throw new ExpiredTokenException( - sprintf( - 'Token expired on %s at %s', - date('m/d/Y', $token->getEndOfLife()), - date('h:i:s A', $token->getEndOfLife()) - ) - ); - } - - // add the token where it may be needed - if (static::AUTHORIZATION_METHOD_HEADER_OAUTH === $this->getAuthorizationMethod()) { - $extraHeaders = array_merge(array('Authorization' => 'OAuth ' . $token->getAccessToken()), $extraHeaders); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING === $this->getAuthorizationMethod()) { - $uri->addToQuery('access_token', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V2 === $this->getAuthorizationMethod()) { - $uri->addToQuery('oauth2_access_token', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V3 === $this->getAuthorizationMethod()) { - $uri->addToQuery('apikey', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_HEADER_BEARER === $this->getAuthorizationMethod()) { - $extraHeaders = array_merge(array('Authorization' => 'Bearer ' . $token->getAccessToken()), $extraHeaders); - } - - $extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders); - - return $this->httpClient->retrieveResponse($uri, $body, $extraHeaders, $method); - } - - /** - * Accessor to the storage adapter to be able to retrieve tokens - * - * @return TokenStorageInterface - */ - public function getStorage() - { - return $this->storage; - } - - /** - * Refreshes an OAuth2 access token. - * - * @param TokenInterface $token - * - * @return TokenInterface $token - * - * @throws MissingRefreshTokenException - */ - public function refreshAccessToken(TokenInterface $token) - { - $refreshToken = $token->getRefreshToken(); - - if (empty($refreshToken)) { - throw new MissingRefreshTokenException(); - } - - $parameters = array( - 'grant_type' => 'refresh_token', - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'refresh_token' => $refreshToken, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $parameters, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * Return whether or not the passed scope value is valid. - * - * @param string $scope - * - * @return bool - */ - public function isValidScope($scope) - { - $reflectionClass = new \ReflectionClass(get_class($this)); - - return in_array($scope, $reflectionClass->getConstants(), true); - } - - /** - * Check if the given service need to generate a unique state token to build the authorization url - * - * @return bool - */ - public function needsStateParameterInAuthUrl() - { - return $this->stateParameterInAuthUrl; - } - - /** - * Validates the authorization state against a given one - * - * @param string $state - * @throws InvalidAuthorizationStateException - */ - protected function validateAuthorizationState($state) - { - if ($this->retrieveAuthorizationState() !== $state) { - throw new InvalidAuthorizationStateException(); - } - } - - /** - * Generates a random string to be used as state - * - * @return string - */ - protected function generateAuthorizationState() - { - return md5(rand()); - } - - /** - * Retrieves the authorization state for the current service - * - * @return string - */ - protected function retrieveAuthorizationState() - { - return $this->storage->retrieveAuthorizationState($this->service()); - } - - /** - * Stores a given authorization state into the storage - * - * @param string $state - */ - protected function storeAuthorizationState($state) - { - $this->storage->storeAuthorizationState($this->service(), $state); - } - - /** - * Return any additional headers always needed for this service implementation's OAuth calls. - * - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array(); - } - - /** - * Return any additional headers always needed for this service implementation's API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array(); - } - - /** - * Parses the access token response and returns a TokenInterface. - * - * @abstract - * - * @param string $responseBody - * - * @return TokenInterface - * - * @throws TokenResponseException - */ - abstract protected function parseAccessTokenResponse($responseBody); - - /** - * Returns a class constant from ServiceInterface defining the authorization method used for the API - * Header is the sane default. - * - * @return int - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_OAUTH; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Amazon.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Amazon.php deleted file mode 100644 index 035d1a55..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Amazon.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Amazon service. - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @link https://images-na.ssl-images-amazon.com/images/G/01/lwa/dev/docs/website-developer-guide._TTH_.pdf - */ -class Amazon extends AbstractService -{ - /** - * Defined scopes - * @link https://images-na.ssl-images-amazon.com/images/G/01/lwa/dev/docs/website-developer-guide._TTH_.pdf - */ - const SCOPE_PROFILE = 'profile'; - const SCOPE_POSTAL_CODE = 'postal_code'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.amazon.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.amazon.com/ap/oa'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.amazon.com/ap/oatoken'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error_description'] . '"'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitly.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitly.php deleted file mode 100644 index e01cbc42..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitly.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Bitly extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api-ssl.bitly.com/v3/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://bitly.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api-ssl.bitly.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // I'm invincible!!! - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function requestAccessToken($code, $state = null) - { - if (null !== $state) { - $this->validateAuthorizationState($state); - } - - $bodyParams = array( - 'code' => $code, - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - - // we can scream what we want that we want bitly to return a json encoded string (format=json), but the - // WOAH WATCH YOUR LANGUAGE ;) service doesn't seem to like screaming, hence we need to manually - // parse the result - $parsedResult = array(); - parse_str($responseBody, $parsedResult); - - $token = $this->parseAccessTokenResponse(json_encode($parsedResult)); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Box.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Box.php deleted file mode 100644 index 14696c59..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Box.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Box service. - * - * @author Antoine Corcy <contact@sbin.dk> - * @link https://developers.box.com/oauth/ - */ -class Box extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.box.com/2.0/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.box.com/api/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.box.com/api/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Buffer.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Buffer.php deleted file mode 100644 index 5905678e..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Buffer.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Client\ClientInterface; - -/** - * Buffer API. - * @author Sumukh Sridhara <@sumukhsridhara> - * @link https://bufferapp.com/developers/api - */ -class Buffer extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - if ($baseApiUri === null) { - $this->baseApiUri = new Uri('https://api.bufferapp.com/1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://bufferapp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.bufferapp.com/1/oauth2/token.json'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function requestRequestToken() - { - $responseBody = $this->httpClient->retrieveResponse( - $this->getRequestTokenEndpoint(), - array( - 'client_key' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $code = $this->parseRequestTokenResponse($responseBody); - - return $code; - } - - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['code'])) { - throw new TokenResponseException('Error in retrieving code.'); - } - return $data['code']; - } - - public function requestAccessToken($code) - { - $bodyParams = array( - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'code' => $code, - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if ($data === null || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dailymotion.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dailymotion.php deleted file mode 100644 index 095a467f..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dailymotion.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Dailymotion service. - * - * @author Mouhamed SEYE <mouhamed@seye.pro> - * @link http://www.dailymotion.com/doc/api/authentication.html - */ -class Dailymotion extends AbstractService -{ - /** - * Scopes - * - * @var string - */ - const SCOPE_EMAIL = 'email', - SCOPE_PROFILE = 'userinfo', - SCOPE_VIDEOS = 'manage_videos', - SCOPE_COMMENTS = 'manage_comments', - SCOPE_PLAYLIST = 'manage_playlists', - SCOPE_TILES = 'manage_tiles', - SCOPE_SUBSCRIPTIONS = 'manage_subscriptions', - SCOPE_FRIENDS = 'manage_friends', - SCOPE_FAVORITES = 'manage_favorites', - SCOPE_GROUPS = 'manage_groups'; - - /** - * Dialog form factors - * - * @var string - */ - const DISPLAY_PAGE = 'page', - DISPLAY_POPUP = 'popup', - DISPLAY_MOBILE = 'mobile'; - - /** - * {@inheritdoc} - */ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.dailymotion.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.dailymotion.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.dailymotion.com/oauth/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_OAUTH; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description']) || isset($data['error'])) { - throw new TokenResponseException( - sprintf( - 'Error in retrieving token: "%s"', - isset($data['error_description']) ? $data['error_description'] : $data['error'] - ) - ); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dropbox.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dropbox.php deleted file mode 100644 index 43ec6c7f..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Dropbox.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Dropbox service. - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @link https://www.dropbox.com/developers/core/docs - */ -class Dropbox extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.dropbox.com/1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.dropbox.com/1/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.dropbox.com/1/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php deleted file mode 100644 index 398df2fd..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service\Exception; - -use OAuth\Common\Exception\Exception; - -/** - * Exception thrown when an invalid accessType for the Google Service is specified - */ -class InvalidAccessTypeException extends Exception -{ -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAuthorizationStateException.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAuthorizationStateException.php deleted file mode 100644 index fe9d550a..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidAuthorizationStateException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service\Exception; - -/** - * Exception thrown when the state parameter received during the authorization process is invalid. - */ -class InvalidAuthorizationStateException extends \Exception -{ -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidScopeException.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidScopeException.php deleted file mode 100644 index c6a51c88..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/InvalidScopeException.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -/** - * @author David Desberg <david@daviddesberg.com> - * Released under the MIT license. - */ - -namespace OAuth\OAuth2\Service\Exception; - -use OAuth\Common\Exception\Exception; - -/** - * Exception thrown when a scope provided to a service is invalid. - */ -class InvalidScopeException extends Exception -{ -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php deleted file mode 100644 index 21eece6a..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -/** - * @author David Desberg <david@daviddesberg.com> - * Released under the MIT license. - */ - -namespace OAuth\OAuth2\Service\Exception; - -use OAuth\Common\Exception\Exception; - -/** - * Exception thrown when service is requested to refresh the access token but no refresh token can be found. - */ -class MissingRefreshTokenException extends Exception -{ -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php deleted file mode 100644 index 80b25c05..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\Common\Exception\Exception; -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Facebook extends AbstractService -{ - /** - * Facebook www url - used to build dialog urls - */ - const WWW_URL = 'https://www.facebook.com/'; - - /** - * Defined scopes - * - * If you don't think this is scary you should not be allowed on the web at all - * - * @link https://developers.facebook.com/docs/reference/login/ - * @link https://developers.facebook.com/tools/explorer For a list of permissions use 'Get Access Token' - */ - // email scopes - const SCOPE_EMAIL = 'email'; - // extended permissions - const SCOPE_READ_FRIENDLIST = 'read_friendlists'; - const SCOPE_READ_INSIGHTS = 'read_insights'; - const SCOPE_READ_MAILBOX = 'read_mailbox'; - const SCOPE_READ_PAGE_MAILBOXES = 'read_page_mailboxes'; - const SCOPE_READ_REQUESTS = 'read_requests'; - const SCOPE_READ_STREAM = 'read_stream'; - const SCOPE_VIDEO_UPLOAD = 'video_upload'; - const SCOPE_XMPP_LOGIN = 'xmpp_login'; - const SCOPE_USER_ONLINE_PRESENCE = 'user_online_presence'; - const SCOPE_FRIENDS_ONLINE_PRESENCE = 'friends_online_presence'; - const SCOPE_ADS_MANAGEMENT = 'ads_management'; - const SCOPE_ADS_READ = 'ads_read'; - const SCOPE_CREATE_EVENT = 'create_event'; - const SCOPE_CREATE_NOTE = 'create_note'; - const SCOPE_EXPORT_STREAM = 'export_stream'; - const SCOPE_MANAGE_FRIENDLIST = 'manage_friendlists'; - const SCOPE_MANAGE_NOTIFICATIONS = 'manage_notifications'; - const SCOPE_PHOTO_UPLOAD = 'photo_upload'; - const SCOPE_PUBLISH_ACTIONS = 'publish_actions'; - const SCOPE_PUBLISH_CHECKINS = 'publish_checkins'; - const SCOPE_PUBLISH_STREAM = 'publish_stream'; - const SCOPE_RSVP_EVENT = 'rsvp_event'; - const SCOPE_SHARE_ITEM = 'share_item'; - const SCOPE_SMS = 'sms'; - const SCOPE_STATUS_UPDATE = 'status_update'; - // Extended Profile Properties - const SCOPE_USER_FRIENDS = 'user_friends'; - const SCOPE_USER_ABOUT = 'user_about_me'; - const SCOPE_FRIENDS_ABOUT = 'friends_about_me'; - const SCOPE_USER_ACTIVITIES = 'user_activities'; - const SCOPE_FRIENDS_ACTIVITIES = 'friends_activities'; - const SCOPE_USER_BIRTHDAY = 'user_birthday'; - const SCOPE_FRIENDS_BIRTHDAY = 'friends_birthday'; - const SCOPE_USER_CHECKINS = 'user_checkins'; - const SCOPE_FRIENDS_CHECKINS = 'friends_checkins'; - const SCOPE_USER_EDUCATION = 'user_education_history'; - const SCOPE_FRIENDS_EDUCATION = 'friends_education_history'; - const SCOPE_USER_EVENTS = 'user_events'; - const SCOPE_FRIENDS_EVENTS = 'friends_events'; - const SCOPE_USER_GROUPS = 'user_groups'; - const SCOPE_FRIENDS_GROUPS = 'friends_groups'; - const SCOPE_USER_HOMETOWN = 'user_hometown'; - const SCOPE_FRIENDS_HOMETOWN = 'friends_hometown'; - const SCOPE_USER_INTERESTS = 'user_interests'; - const SCOPE_FRIEND_INTERESTS = 'friends_interests'; - const SCOPE_USER_LIKES = 'user_likes'; - const SCOPE_FRIENDS_LIKES = 'friends_likes'; - const SCOPE_USER_LOCATION = 'user_location'; - const SCOPE_FRIENDS_LOCATION = 'friends_location'; - const SCOPE_USER_NOTES = 'user_notes'; - const SCOPE_FRIENDS_NOTES = 'friends_notes'; - const SCOPE_USER_PHOTOS = 'user_photos'; - const SCOPE_USER_PHOTO_VIDEO_TAGS = 'user_photo_video_tags'; - const SCOPE_FRIENDS_PHOTOS = 'friends_photos'; - const SCOPE_FRIENDS_PHOTO_VIDEO_TAGS = 'friends_photo_video_tags'; - const SCOPE_USER_QUESTIONS = 'user_questions'; - const SCOPE_FRIENDS_QUESTIONS = 'friends_questions'; - const SCOPE_USER_RELATIONSHIPS = 'user_relationships'; - const SCOPE_FRIENDS_RELATIONSHIPS = 'friends_relationships'; - const SCOPE_USER_RELATIONSHIPS_DETAILS = 'user_relationship_details'; - const SCOPE_FRIENDS_RELATIONSHIPS_DETAILS = 'friends_relationship_details'; - const SCOPE_USER_RELIGION = 'user_religion_politics'; - const SCOPE_FRIENDS_RELIGION = 'friends_religion_politics'; - const SCOPE_USER_STATUS = 'user_status'; - const SCOPE_FRIENDS_STATUS = 'friends_status'; - const SCOPE_USER_SUBSCRIPTIONS = 'user_subscriptions'; - const SCOPE_FRIENDS_SUBSCRIPTIONS = 'friends_subscriptions'; - const SCOPE_USER_VIDEOS = 'user_videos'; - const SCOPE_FRIENDS_VIDEOS = 'friends_videos'; - const SCOPE_USER_WEBSITE = 'user_website'; - const SCOPE_FRIENDS_WEBSITE = 'friends_website'; - const SCOPE_USER_WORK = 'user_work_history'; - const SCOPE_FRIENDS_WORK = 'friends_work_history'; - // Open Graph Permissions - const SCOPE_USER_MUSIC = 'user_actions.music'; - const SCOPE_FRIENDS_MUSIC = 'friends_actions.music'; - const SCOPE_USER_NEWS = 'user_actions.news'; - const SCOPE_FRIENDS_NEWS = 'friends_actions.news'; - const SCOPE_USER_VIDEO = 'user_actions.video'; - const SCOPE_FRIENDS_VIDEO = 'friends_actions.video'; - const SCOPE_USER_APP = 'user_actions:APP_NAMESPACE'; - const SCOPE_FRIENDS_APP = 'friends_actions:APP_NAMESPACE'; - const SCOPE_USER_GAMES = 'user_games_activity'; - const SCOPE_FRIENDS_GAMES = 'friends_games_activity'; - //Page Permissions - const SCOPE_PAGES = 'manage_pages'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://graph.facebook.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.facebook.com/dialog/oauth'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://graph.facebook.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - // Facebook gives us a query string ... Oh wait. JSON is too simple, understand ? - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['expires'])) { - $token->setLifeTime($data['expires']); - } - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires']); - - $token->setExtraParams($data); - - return $token; - } - - public function getDialogUri($dialogPath, array $parameters) - { - if (!isset($parameters['redirect_uri'])) { - throw new Exception("Redirect uri is mandatory for this request"); - } - $parameters['app_id'] = $this->credentials->getConsumerId(); - $baseUrl = self::WWW_URL . 'dialog/' . $dialogPath; - $query = http_build_query($parameters); - return new Uri($baseUrl . '?' . $query); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Foursquare.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Foursquare.php deleted file mode 100644 index fdbabf98..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Foursquare.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Foursquare extends AbstractService -{ - private $apiVersionDate = '20130829'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.foursquare.com/v2/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://foursquare.com/oauth2/authenticate'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://foursquare.com/oauth2/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Foursquare tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = new Uri($this->baseApiUri . $path); - $uri->addToQuery('v', $this->apiVersionDate); - - return parent::request($uri, $method, $body, $extraHeaders); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/GitHub.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/GitHub.php deleted file mode 100644 index 9fee2ba0..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/GitHub.php +++ /dev/null @@ -1,208 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class GitHub extends AbstractService -{ - /** - * Defined scopes, see http://developer.github.com/v3/oauth/ for definitions. - */ - - /** - * Public read-only access (includes public user profile info, public repo info, and gists) - */ - const SCOPE_READONLY = ''; - - /** - * Read/write access to profile info only. - * - * Includes SCOPE_USER_EMAIL and SCOPE_USER_FOLLOW. - */ - const SCOPE_USER = 'user'; - - /** - * Read access to a user’s email addresses. - */ - const SCOPE_USER_EMAIL = 'user:email'; - - /** - * Access to follow or unfollow other users. - */ - const SCOPE_USER_FOLLOW = 'user:follow'; - - /** - * Read/write access to public repos and organizations. - */ - const SCOPE_PUBLIC_REPO = 'public_repo'; - - /** - * Read/write access to public and private repos and organizations. - * - * Includes SCOPE_REPO_STATUS. - */ - const SCOPE_REPO = 'repo'; - - /** - * Grants access to deployment statuses for public and private repositories. - * This scope is only necessary to grant other users or services access to deployment statuses, - * without granting access to the code. - */ - const SCOPE_REPO_DEPLOYMENT = 'repo_deployment'; - - /** - * Read/write access to public and private repository commit statuses. This scope is only necessary to grant other - * users or services access to private repository commit statuses without granting access to the code. The repo and - * public_repo scopes already include access to commit status for private and public repositories, respectively. - */ - const SCOPE_REPO_STATUS = 'repo:status'; - - /** - * Delete access to adminable repositories. - */ - const SCOPE_DELETE_REPO = 'delete_repo'; - - /** - * Read access to a user’s notifications. repo is accepted too. - */ - const SCOPE_NOTIFICATIONS = 'notifications'; - - /** - * Write access to gists. - */ - const SCOPE_GIST = 'gist'; - - /** - * Grants read and ping access to hooks in public or private repositories. - */ - const SCOPE_HOOKS_READ = 'read:repo_hook'; - - /** - * Grants read, write, and ping access to hooks in public or private repositories. - */ - const SCOPE_HOOKS_WRITE = 'write:repo_hook'; - - /** - * Grants read, write, ping, and delete access to hooks in public or private repositories. - */ - const SCOPE_HOOKS_ADMIN = 'admin:repo_hook'; - - /** - * Read-only access to organization, teams, and membership. - */ - const SCOPE_ORG_READ = 'read:org'; - - /** - * Publicize and unpublicize organization membership. - */ - const SCOPE_ORG_WRITE = 'write:org'; - - /** - * Fully manage organization, teams, and memberships. - */ - const SCOPE_ORG_ADMIN = 'admin:org'; - - /** - * List and view details for public keys. - */ - const SCOPE_PUBLIC_KEY_READ = 'read:public_key'; - - /** - * Create, list, and view details for public keys. - */ - const SCOPE_PUBLIC_KEY_WRITE = 'write:public_key'; - - /** - * Fully manage public keys. - */ - const SCOPE_PUBLIC_KEY_ADMIN = 'admin:public_key'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.github.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://github.com/login/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://github.com/login/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Github tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * Used to configure response type -- we want JSON from github, default is query string format - * - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } - - /** - * Required for GitHub API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/vnd.github.beta+json'); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php deleted file mode 100644 index 096876b6..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\OAuth2\Service\Exception\InvalidAccessTypeException; -use OAuth\Common\Http\Uri\Uri; - -class Google extends AbstractService -{ - /** - * Defined scopes - More scopes are listed here: - * https://developers.google.com/oauthplayground/ - * - * Make a pull request if you need more scopes. - */ - - // Basic - const SCOPE_EMAIL = 'email'; - const SCOPE_PROFILE = 'profile'; - - const SCOPE_USERINFO_EMAIL = 'https://www.googleapis.com/auth/userinfo.email'; - const SCOPE_USERINFO_PROFILE = 'https://www.googleapis.com/auth/userinfo.profile'; - - // Google+ - const SCOPE_GPLUS_ME = 'https://www.googleapis.com/auth/plus.me'; - const SCOPE_GPLUS_LOGIN = 'https://www.googleapis.com/auth/plus.login'; - const SCOPE_GPLUS_CIRCLES_READ = 'https://www.googleapis.com/auth/plus.circles.read'; - const SCOPE_GPLUS_CIRCLES_WRITE = 'https://www.googleapis.com/auth/plus.circles.write'; - const SCOPE_GPLUS_STREAM_READ = 'https://www.googleapis.com/auth/plus.stream.read'; - const SCOPE_GPLUS_STREAM_WRITE = 'https://www.googleapis.com/auth/plus.stream.write'; - const SCOPE_GPLUS_MEDIA = 'https://www.googleapis.com/auth/plus.media.upload'; - - // Google Drive - const SCOPE_DOCUMENTSLIST = 'https://docs.google.com/feeds/'; - const SCOPE_SPREADSHEETS = 'https://spreadsheets.google.com/feeds/'; - const SCOPE_GOOGLEDRIVE = 'https://www.googleapis.com/auth/drive'; - const SCOPE_DRIVE_APPS = 'https://www.googleapis.com/auth/drive.appdata'; - const SCOPE_DRIVE_APPS_READ_ONLY = 'https://www.googleapis.com/auth/drive.apps.readonly'; - const SCOPE_GOOGLEDRIVE_FILES = 'https://www.googleapis.com/auth/drive.file'; - const SCOPE_DRIVE_METADATA_READ_ONLY = 'https://www.googleapis.com/auth/drive.metadata.readonly'; - const SCOPE_DRIVE_READ_ONLY = 'https://www.googleapis.com/auth/drive.readonly'; - const SCOPE_DRIVE_SCRIPTS = 'https://www.googleapis.com/auth/drive.scripts'; - - // Adwords - const SCOPE_ADSENSE = 'https://www.googleapis.com/auth/adsense'; - const SCOPE_ADWORDS = 'https://adwords.google.com/api/adwords/'; - const SCOPE_GAN = 'https://www.googleapis.com/auth/gan'; // google affiliate network...? - - // Google Analytics - const SCOPE_ANALYTICS = 'https://www.googleapis.com/auth/analytics'; - const SCOPE_ANALYTICS_EDIT = 'https://www.googleapis.com/auth/analytics.edit'; - const SCOPE_ANALYTICS_MANAGE_USERS = 'https://www.googleapis.com/auth/analytics.manage.users'; - const SCOPE_ANALYTICS_READ_ONLY = 'https://www.googleapis.com/auth/analytics.readonly'; - - // Other services - const SCOPE_BOOKS = 'https://www.googleapis.com/auth/books'; - const SCOPE_BLOGGER = 'https://www.googleapis.com/auth/blogger'; - const SCOPE_CALENDAR = 'https://www.googleapis.com/auth/calendar'; - const SCOPE_CALENDAR_READ_ONLY = 'https://www.googleapis.com/auth/calendar.readonly'; - const SCOPE_CONTACT = 'https://www.google.com/m8/feeds/'; - const SCOPE_CHROMEWEBSTORE = 'https://www.googleapis.com/auth/chromewebstore.readonly'; - const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom'; - const SCOPE_GMAIL_IMAP_SMTP = 'https://mail.google.com'; - const SCOPE_PICASAWEB = 'https://picasaweb.google.com/data/'; - const SCOPE_SITES = 'https://sites.google.com/feeds/'; - const SCOPE_URLSHORTENER = 'https://www.googleapis.com/auth/urlshortener'; - const SCOPE_WEBMASTERTOOLS = 'https://www.google.com/webmasters/tools/feeds/'; - const SCOPE_TASKS = 'https://www.googleapis.com/auth/tasks'; - - // Cloud services - const SCOPE_CLOUDSTORAGE = 'https://www.googleapis.com/auth/devstorage.read_write'; - const SCOPE_CONTENTFORSHOPPING = 'https://www.googleapis.com/auth/structuredcontent'; // what even is this - const SCOPE_USER_PROVISIONING = 'https://apps-apis.google.com/a/feeds/user/'; - const SCOPE_GROUPS_PROVISIONING = 'https://apps-apis.google.com/a/feeds/groups/'; - const SCOPE_NICKNAME_PROVISIONING = 'https://apps-apis.google.com/a/feeds/alias/'; - - // Old - const SCOPE_ORKUT = 'https://www.googleapis.com/auth/orkut'; - const SCOPE_GOOGLELATITUDE = - 'https://www.googleapis.com/auth/latitude.all.best https://www.googleapis.com/auth/latitude.all.city'; - const SCOPE_OPENID = 'openid'; - - // YouTube - const SCOPE_YOUTUBE_GDATA = 'https://gdata.youtube.com'; - const SCOPE_YOUTUBE_ANALYTICS_MONETARY = 'https://www.googleapis.com/auth/yt-analytics-monetary.readonly'; - const SCOPE_YOUTUBE_ANALYTICS = 'https://www.googleapis.com/auth/yt-analytics.readonly'; - const SCOPE_YOUTUBE = 'https://www.googleapis.com/auth/youtube'; - const SCOPE_YOUTUBE_READ_ONLY = 'https://www.googleapis.com/auth/youtube.readonly'; - const SCOPE_YOUTUBE_UPLOAD = 'https://www.googleapis.com/auth/youtube.upload'; - const SCOPE_YOUTUBE_PARTNER = 'https://www.googleapis.com/auth/youtubepartner'; - const SCOPE_YOUTUBE_PARTNER_AUDIT = 'https://www.googleapis.com/auth/youtubepartner-channel-audit'; - - // Google Glass - const SCOPE_GLASS_TIMELINE = 'https://www.googleapis.com/auth/glass.timeline'; - const SCOPE_GLASS_LOCATION = 'https://www.googleapis.com/auth/glass.location'; - - // Android Publisher - const SCOPE_ANDROID_PUBLISHER = 'https://www.googleapis.com/auth/androidpublisher'; - - protected $accessType = 'online'; - - - public function setAccessType($accessType) - { - if (!in_array($accessType, array('online', 'offline'), true)) { - throw new InvalidAccessTypeException('Invalid accessType, expected either online or offline'); - } - $this->accessType = $accessType; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://accounts.google.com/o/oauth2/auth?access_type=' . $this->accessType); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://accounts.google.com/o/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Harvest.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Harvest.php deleted file mode 100644 index 96fb0f2d..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Harvest.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Token\TokenInterface; -use OAuth\OAuth2\Token\StdOAuth2Token; - -class Harvest extends AbstractService -{ - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.harvestapp.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'state' => 'optional-csrf-token', - 'response_type' => 'code', - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.harvestapp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.harvestapp.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || ! is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - $token->setRefreshToken($data['refresh_token']); - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * Refreshes an OAuth2 access token. - * - * @param TokenInterface $token - * - * @return TokenInterface $token - * - * @throws MissingRefreshTokenException - */ - public function refreshAccessToken(TokenInterface $token) - { - $refreshToken = $token->getRefreshToken(); - - if (empty($refreshToken)) { - throw new MissingRefreshTokenException(); - } - - $parameters = array( - 'grant_type' => 'refresh_token', - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'refresh_token' => $refreshToken, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $parameters, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } - - /** - * Return any additional headers always needed for this service implementation's API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Heroku.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Heroku.php deleted file mode 100644 index 470cedc3..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Heroku.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Heroku service. - * - * @author Thomas Welton <thomaswelton@me.com> - * @link https://devcenter.heroku.com/articles/oauth - */ -class Heroku extends AbstractService -{ - /** - * Defined scopes - * @link https://devcenter.heroku.com/articles/oauth#scopes - */ - const SCOPE_GLOBAL = 'global'; - const SCOPE_IDENTITY = 'identity'; - const SCOPE_READ = 'read'; - const SCOPE_WRITE = 'write'; - const SCOPE_READ_PROTECTED = 'read-protected'; - const SCOPE_WRITE_PROTECTED = 'write-protected'; - - /** - * {@inheritdoc} - */ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.heroku.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://id.heroku.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://id.heroku.com/oauth/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description']) || isset($data['error'])) { - throw new TokenResponseException( - sprintf( - 'Error in retrieving token: "%s"', - isset($data['error_description']) ? $data['error_description'] : $data['error'] - ) - ); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/vnd.heroku+json; version=3'); - } - - /** - * {@inheritdoc} - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/vnd.heroku+json; version=3', 'Content-Type' => 'application/json'); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Instagram.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Instagram.php deleted file mode 100644 index 49e9c8c9..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Instagram.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Instagram extends AbstractService -{ - /** - * Defined scopes - * @link http://instagram.com/developer/authentication/#scope - */ - const SCOPE_BASIC = 'basic'; - const SCOPE_COMMENTS = 'comments'; - const SCOPE_RELATIONSHIPS = 'relationships'; - const SCOPE_LIKES = 'likes'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.instagram.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.instagram.com/oauth/authorize/'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.instagram.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Instagram tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Linkedin.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Linkedin.php deleted file mode 100644 index bb801e6a..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Linkedin.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Linkedin service. - * - * @author Antoine Corcy <contact@sbin.dk> - * @link http://developer.linkedin.com/documents/authentication - */ -class Linkedin extends AbstractService -{ - /** - * Defined scopes - * @link http://developer.linkedin.com/documents/authentication#granting - */ - const SCOPE_R_BASICPROFILE = 'r_basicprofile'; - const SCOPE_R_FULLPROFILE = 'r_fullprofile'; - const SCOPE_R_EMAILADDRESS = 'r_emailaddress'; - const SCOPE_R_NETWORK = 'r_network'; - const SCOPE_R_CONTACTINFO = 'r_contactinfo'; - const SCOPE_RW_NUS = 'rw_nus'; - const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin'; - const SCOPE_RW_GROUPS = 'rw_groups'; - const SCOPE_W_MESSAGES = 'w_messages'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.linkedin.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.linkedin.com/uas/oauth2/authorization'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.linkedin.com/uas/oauth2/accessToken'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING_V2; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mailchimp.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mailchimp.php deleted file mode 100644 index 42abd3c1..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mailchimp.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Mailchimp extends AbstractService -{ - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (is_null($this->baseApiUri) && $storage->hasAccessToken($this->service())) { - $this->setBaseApiUri($storage->retrieveAccessToken($this->service())); - } - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING_V3; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://login.mailchimp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://login.mailchimp.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - // Parse JSON - $data = json_decode($responseBody, true); - - // Do validation. - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - // Create token object. - $token = new StdOAuth2Token($data['access_token']); - - // Set the right API endpoint. - $this->setBaseApiUri($token); - - // Mailchimp tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - if (is_null($this->baseApiUri)) { - $this->setBaseApiUri($this->storage->retrieveAccessToken($this->service())); - } - - return parent::request($path, $method, $body, $extraHeaders); - } - - /** - * Set the right base endpoint. - * - * @param StdOAuth2Token $token - */ - protected function setBaseApiUri(StdOAuth2Token $token) - { - // Make request uri. - $endpoint = 'https://login.mailchimp.com/oauth2/metadata?oauth_token='. $token->getAccessToken(); - - // Grab meta data about the token. - $response = $this->httpClient->retrieveResponse(new Uri($endpoint), array(), array(), 'GET'); - - // Parse JSON. - $meta = json_decode($response, true); - - // Set base api uri. - $this->baseApiUri = new Uri('https://'. $meta['dc'] .'.api.mailchimp.com/2.0/'); - - // Allow chaining. - return $this; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Microsoft.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Microsoft.php deleted file mode 100644 index 183ef452..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Microsoft.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Microsoft extends AbstractService -{ - const SCOPE_BASIC = 'wl.basic'; - const SCOPE_OFFLINE = 'wl.offline_access'; - const SCOPE_SIGNIN = 'wl.signin'; - const SCOPE_BIRTHDAY = 'wl.birthday'; - const SCOPE_CALENDARS = 'wl.calendars'; - const SCOPE_CALENDARS_UPDATE = 'wl.calendars_update'; - const SCOPE_CONTACTS_BIRTHDAY = 'wl.contacts_birthday'; - const SCOPE_CONTACTS_CREATE = 'wl.contacts_create'; - const SCOPE_CONTACTS_CALENDARS = 'wl.contacts_calendars'; - const SCOPE_CONTACTS_PHOTOS = 'wl.contacts_photos'; - const SCOPE_CONTACTS_SKYDRIVE = 'wl.contacts_skydrive'; - const SCOPE_EMAILS = 'wl.emails'; - const SCOPE_EVENTS_CREATE = 'wl.events_create'; - const SCOPE_MESSENGER = 'wl.messenger'; - const SCOPE_PHONE_NUMBERS = 'wl.phone_numbers'; - const SCOPE_PHOTOS = 'wl.photos'; - const SCOPE_POSTAL_ADDRESSES = 'wl.postal_addresses'; - const SCOPE_SHARE = 'wl.share'; - const SCOPE_SKYDRIVE = 'wl.skydrive'; - const SCOPE_SKYDRIVE_UPDATE = 'wl.skydrive_update'; - const SCOPE_WORK_PROFILE = 'wl.work_profile'; - const SCOPE_APPLICATIONS = 'wl.applications'; - const SCOPE_APPLICATIONS_CREATE = 'wl.applications_create'; - - /** - * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses. - * They agree that giving 3rd party apps access to 3rd party emailaddresses is a pretty lame thing to do so in all - * their wisdom they added this scope because fuck you that's why. - * - * https://github.com/Lusitanian/PHPoAuthLib/issues/214 - * http://social.msdn.microsoft.com/Forums/live/en-US/c6dcb9ab-aed4-400a-99fb-5650c393a95d/how-retrieve-users- - * contacts-email-address?forum=messengerconnect - * - * Considering this scope is not officially supported: use with care - */ - const SCOPE_CONTACTS_EMAILS = 'wl.contacts_emails'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://apis.live.net/v5.0/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://login.live.com/oauth20_authorize.srf'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://login.live.com/oauth20_token.srf'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Paypal.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Paypal.php deleted file mode 100644 index 761c09d6..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Paypal.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * PayPal service. - * - * @author Flávio Heleno <flaviohbatista@gmail.com> - * @link https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/detailed/ - */ -class Paypal extends AbstractService -{ - /** - * Defined scopes - * @link https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/detailed/ - * @see #attributes - */ - const SCOPE_OPENID = 'openid'; - const SCOPE_PROFILE = 'profile'; - const SCOPE_PAYPALATTRIBUTES = 'https://uri.paypal.com/services/paypalattributes'; - const SCOPE_EMAIL = 'email'; - const SCOPE_ADDRESS = 'address'; - const SCOPE_PHONE = 'phone'; - const SCOPE_EXPRESSCHECKOUT = 'https://uri.paypal.com/services/expresscheckout'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.paypal.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.paypal.com/v1/identity/openidconnect/tokenservice'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['message'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['message'] . '"'); - } elseif (isset($data['name'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['name'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Pocket.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Pocket.php deleted file mode 100644 index 8c955440..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Pocket.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Client\ClientInterface; - -class Pocket extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - if ($baseApiUri === null) { - $this->baseApiUri = new Uri('https://getpocket.com/v3/'); - } - } - - public function getRequestTokenEndpoint() - { - return new Uri('https://getpocket.com/v3/oauth/request'); - } - - public function getAuthorizationEndpoint() - { - return new Uri('https://getpocket.com/auth/authorize'); - } - - public function getAccessTokenEndpoint() - { - return new Uri('https://getpocket.com/v3/oauth/authorize'); - } - - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'redirect_uri' => $this->credentials->getCallbackUrl(), - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - public function requestRequestToken() - { - $responseBody = $this->httpClient->retrieveResponse( - $this->getRequestTokenEndpoint(), - array( - 'consumer_key' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - ) - ); - - $code = $this->parseRequestTokenResponse($responseBody); - - return $code; - } - - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['code'])) { - throw new TokenResponseException('Error in retrieving code.'); - } - return $data['code']; - } - - public function requestAccessToken($code) - { - $bodyParams = array( - 'consumer_key' => $this->credentials->getConsumerId(), - 'code' => $code, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if ($data === null || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - #$token->setRequestToken($data['access_token']); - $token->setAccessToken($data['access_token']); - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Reddit.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Reddit.php deleted file mode 100644 index 9e524d12..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Reddit.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Reddit extends AbstractService -{ - /** - * Defined scopes - * - * @link http://www.reddit.com/dev/api/oauth - */ - // User scopes - const SCOPE_EDIT = 'edit'; - const SCOPE_HISTORY = 'history'; - const SCOPE_IDENTITY = 'identity'; - const SCOPE_MYSUBREDDITS = 'mysubreddits'; - const SCOPE_PRIVATEMESSAGES = 'privatemessages'; - const SCOPE_READ = 'read'; - const SCOPE_SAVE = 'save'; - const SCOPE_SUBMIT = 'submit'; - const SCOPE_SUBSCRIBE = 'subscribe'; - const SCOPE_VOTE = 'vote'; - // Mod Scopes - const SCOPE_MODCONFIG = 'modconfig'; - const SCOPE_MODFLAIR = 'modflair'; - const SCOPE_MODLOG = 'modlog'; - const SCOPE_MODPOST = 'modpost'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://oauth.reddit.com'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://ssl.reddit.com/api/v1/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://ssl.reddit.com/api/v1/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - // Reddit uses a Basic OAuth header - return array('Authorization' => 'Basic ' . - base64_encode($this->credentials->getConsumerId() . ':' . $this->credentials->getConsumerSecret())); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/RunKeeper.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/RunKeeper.php deleted file mode 100644 index 71584076..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/RunKeeper.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * RunKeeper service. - * - * @link http://runkeeper.com/developer/healthgraph/registration-authorization - */ -class RunKeeper extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.runkeeper.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://runkeeper.com/apps/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://runkeeper.com/apps/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php deleted file mode 100644 index 583e4347..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Service\AbstractService; -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class SalesforceService extends AbstractService -{ - /** - * Scopes - * - * @var string - */ - const SCOPE_API = 'api', - SCOPE_REFRESH_TOKEN = 'refresh_token'; - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://login.salesforce.com/services/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://na1.salesforce.com/services/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Salesforce tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/ServiceInterface.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/ServiceInterface.php deleted file mode 100644 index f3d1bdad..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/ServiceInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Token\TokenInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Service\ServiceInterface as BaseServiceInterface; -use OAuth\Common\Http\Uri\UriInterface; - -/** - * Defines the common methods across OAuth 2 services. - */ -interface ServiceInterface extends BaseServiceInterface -{ - /** - * Authorization methods for various services - */ - const AUTHORIZATION_METHOD_HEADER_OAUTH = 0; - const AUTHORIZATION_METHOD_HEADER_BEARER = 1; - const AUTHORIZATION_METHOD_QUERY_STRING = 2; - const AUTHORIZATION_METHOD_QUERY_STRING_V2 = 3; - const AUTHORIZATION_METHOD_QUERY_STRING_V3 = 4; - - /** - * Retrieves and stores/returns the OAuth2 access token after a successful authorization. - * - * @param string $code The access code from the callback. - * - * @return TokenInterface $token - * - * @throws TokenResponseException - */ - public function requestAccessToken($code); -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/SoundCloud.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/SoundCloud.php deleted file mode 100644 index 32a3b46c..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/SoundCloud.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class SoundCloud extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.soundcloud.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://soundcloud.com/connect'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.soundcloud.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['expires_in'])) { - $token->setLifetime($data['expires_in']); - unset($data['expires_in']); - } - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Ustream.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Ustream.php deleted file mode 100644 index 7e558153..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Ustream.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Ustream extends AbstractService -{ - /** - * Scopes - * - * @var string - */ - const SCOPE_OFFLINE = 'offline'; - const SCOPE_BROADCASTER = 'broadcaster'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.ustream.tv/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.ustream.tv/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.ustream.tv/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Authorization' => 'Basic ' . $this->credentials->getConsumerSecret()); - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Vkontakte.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Vkontakte.php deleted file mode 100644 index 4a7744ec..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Vkontakte.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Vkontakte extends AbstractService -{ - /** - * Defined scopes - * - * @link http://vk.com/dev/permissions - */ - const SCOPE_EMAIL = 'email'; - const SCOPE_NOTIFY = 'notify'; - const SCOPE_FRIENDS = 'friends'; - const SCOPE_PHOTOS = 'photos'; - const SCOPE_AUDIO = 'audio'; - const SCOPE_VIDEO = 'video'; - const SCOPE_DOCS = 'docs'; - const SCOPE_NOTES = 'notes'; - const SCOPE_PAGES = 'pages'; - const SCOPE_APP_LINK = ''; - const SCOPE_STATUS = 'status'; - const SCOPE_OFFERS = 'offers'; - const SCOPE_QUESTIONS = 'questions'; - const SCOPE_WALL = 'wall'; - const SCOPE_GROUPS = 'groups'; - const SCOPE_MESSAGES = 'messages'; - const SCOPE_NOTIFICATIONS = 'notifications'; - const SCOPE_STATS = 'stats'; - const SCOPE_ADS = 'ads'; - const SCOPE_OFFLINE = 'offline'; - const SCOPE_NOHTTPS = 'nohttps'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.vk.com/method/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://oauth.vk.com/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://oauth.vk.com/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Yammer.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Yammer.php deleted file mode 100644 index 994a2935..00000000 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Yammer.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -namespace OAuth\OAuth2\Service; - -use OAuth\OAuth2\Token\StdOAuth2Token; -use OAuth\Common\Http\Exception\TokenResponseException; -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Uri\UriInterface; - -class Yammer extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://www.yammer.com/api/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.yammer.com/dialog/oauth'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.yammer.com/oauth2/access_token.json'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']['token']); - $token->setLifetime($data['access_token']['expires_at']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} |