Exception
6 years ago
WebAuthException
6 years ago
certs
6 years ago
AppInfo.php
6 years ago
AppInfoLoadException.php
6 years ago
ArrayEntryStore.php
6 years ago
AuthBase.php
6 years ago
AuthInfo.php
6 years ago
AuthInfoLoadException.php
6 years ago
Checker.php
6 years ago
Client.php
6 years ago
Curl.php
6 years ago
CurlStreamRelay.php
6 years ago
DeserializeException.php
6 years ago
DropboxMetadataHeaderCatcher.php
6 years ago
Exception.php
6 years ago
Host.php
6 years ago
HttpResponse.php
6 years ago
OAuth1AccessToken.php
6 years ago
OAuth1Upgrader.php
6 years ago
Path.php
6 years ago
RequestUtil.php
6 years ago
RootCertificates.php
6 years ago
SSLTester.php
6 years ago
Security.php
6 years ago
StreamReadException.php
6 years ago
Util.php
6 years ago
ValueStore.php
6 years ago
WebAuth.php
6 years ago
WebAuthBase.php
6 years ago
WebAuthNoRedirect.php
6 years ago
WriteMode.php
6 years ago
autoload.php
6 years ago
strict.php
6 years ago
AuthBase.php
76 lines
| 1 | <?php |
| 2 | namespace Dropbox; |
| 3 | |
| 4 | /** |
| 5 | * Base class for API authorization-related classes. |
| 6 | */ |
| 7 | class AuthBase |
| 8 | { |
| 9 | /** |
| 10 | * Whatever AppInfo was passed into the constructor. |
| 11 | * |
| 12 | * @return AppInfo |
| 13 | */ |
| 14 | function getAppInfo() { return $this->appInfo; } |
| 15 | |
| 16 | /** @var AppInfo */ |
| 17 | protected $appInfo; |
| 18 | |
| 19 | /** |
| 20 | * An identifier for the API client, typically of the form "Name/Version". |
| 21 | * This is used to set the HTTP <code>User-Agent</code> header when making API requests. |
| 22 | * Example: <code>"PhotoEditServer/1.3"</code> |
| 23 | * |
| 24 | * If you're the author a higher-level library on top of the basic SDK, and the |
| 25 | * "Photo Edit" app's server code is using your library to access Dropbox, you should append |
| 26 | * your library's name and version to form the full identifier. For example, |
| 27 | * if your library is called "File Picker", you might set this field to: |
| 28 | * <code>"PhotoEditServer/1.3 FilePicker/0.1-beta"</code> |
| 29 | * |
| 30 | * The exact format of the <code>User-Agent</code> header is described in |
| 31 | * <a href="http://tools.ietf.org/html/rfc2616#section-3.8">section 3.8 of the HTTP specification</a>. |
| 32 | * |
| 33 | * Note that underlying HTTP client may append other things to the <code>User-Agent</code>, such as |
| 34 | * the name of the library being used to actually make the HTTP request (such as cURL). |
| 35 | * |
| 36 | * @return string |
| 37 | */ |
| 38 | function getClientIdentifier() { return $this->clientIdentifier; } |
| 39 | |
| 40 | /** @var string */ |
| 41 | protected $clientIdentifier; |
| 42 | |
| 43 | /** |
| 44 | * The locale of the user of your application. Some API calls return localized |
| 45 | * data and error messages; this "user locale" setting determines which locale |
| 46 | * the server should use to localize those strings. |
| 47 | * |
| 48 | * @return null|string |
| 49 | */ |
| 50 | function getUserLocale() { return $this->userLocale; } |
| 51 | |
| 52 | /** @var string */ |
| 53 | protected $userLocale; |
| 54 | |
| 55 | /** |
| 56 | * Constructor. |
| 57 | * |
| 58 | * @param AppInfo $appInfo |
| 59 | * See {@link getAppInfo()} |
| 60 | * @param string $clientIdentifier |
| 61 | * See {@link getClientIdentifier()} |
| 62 | * @param null|string $userLocale |
| 63 | * See {@link getUserLocale()} |
| 64 | */ |
| 65 | function __construct($appInfo, $clientIdentifier, $userLocale = null) |
| 66 | { |
| 67 | AppInfo::checkArg("appInfo", $appInfo); |
| 68 | Client::checkClientIdentifierArg("clientIdentifier", $clientIdentifier); |
| 69 | Checker::argStringNonEmptyOrNull("userLocale", $userLocale); |
| 70 | |
| 71 | $this->appInfo = $appInfo; |
| 72 | $this->clientIdentifier = $clientIdentifier; |
| 73 | $this->userLocale = $userLocale; |
| 74 | } |
| 75 | } |
| 76 |