summaryrefslogtreecommitdiffstats
path: root/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php')
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php106
1 files changed, 88 insertions, 18 deletions
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
index 972c97fedd0..84083058fe5 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
@@ -20,12 +20,17 @@
*/
class Google_Config
{
- private $configuration;
+ const GZIP_DISABLED = true;
+ const GZIP_ENABLED = false;
+ const GZIP_UPLOADS_ENABLED = true;
+ const GZIP_UPLOADS_DISABLED = false;
+ const USE_AUTO_IO_SELECTION = "auto";
+ protected $configuration;
/**
* Create a new Google_Config. Can accept an ini file location with the
* local configuration. For example:
- * application_name: "My App";
+ * application_name="My App"
*
* @param [$ini_file_location] - optional - The location of the ini file to load
*/
@@ -37,7 +42,7 @@ class Google_Config
// Which Authentication, Storage and HTTP IO classes to use.
'auth_class' => 'Google_Auth_OAuth2',
- 'io_class' => 'Google_IO_Stream',
+ 'io_class' => self::USE_AUTO_IO_SELECTION,
'cache_class' => 'Google_Cache_File',
// Don't change these unless you're working against a special development
@@ -46,12 +51,21 @@ class Google_Config
// Definition of class specific values, like file paths and so on.
'classes' => array(
- // If you want to pass in OAuth 2.0 settings, they will need to be
- // structured like this.
+ 'Google_IO_Abstract' => array(
+ 'request_timeout_seconds' => 100,
+ ),
'Google_Http_Request' => array(
- // Disable the use of gzip on calls if set to true.
- 'disable_gzip' => false
+ // Disable the use of gzip on calls if set to true. Defaults to false.
+ 'disable_gzip' => self::GZIP_ENABLED,
+
+ // We default gzip to disabled on uploads even if gzip is otherwise
+ // enabled, due to some issues seen with small packet sizes for uploads.
+ // Please test with this option before enabling gzip for uploads in
+ // a production environment.
+ 'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
),
+ // If you want to pass in OAuth 2.0 settings, they will need to be
+ // structured like this.
'Google_Auth_OAuth2' => array(
// Keys for OAuth 2.0 access, see the API console at
// https://developers.google.com/console
@@ -64,9 +78,14 @@ class Google_Config
'developer_key' => '',
// Other parameters.
+ 'hd' => '',
+ 'prompt' => '',
+ 'openid.realm' => '',
+ 'include_granted_scopes' => '',
+ 'login_hint' => '',
+ 'request_visible_actions' => '',
'access_type' => 'online',
'approval_prompt' => 'auto',
- 'request_visible_actions' => '',
'federated_signon_certs_url' =>
'https://www.googleapis.com/oauth2/v1/certs',
),
@@ -75,11 +94,6 @@ class Google_Config
'directory' => sys_get_temp_dir() . '/Google_Client'
)
),
-
- // Definition of service specific values like scopes, oauth token URLs,
- // etc. Example:
- 'services' => array(
- ),
);
if ($ini_file_location) {
$ini = parse_ini_file($ini_file_location, true);
@@ -108,7 +122,7 @@ class Google_Config
$this->configuration['classes'][$class] = $config;
}
}
-
+
public function getClassConfig($class, $key = null)
{
if (!isset($this->configuration['classes'][$class])) {
@@ -138,7 +152,7 @@ class Google_Config
{
return $this->configuration['auth_class'];
}
-
+
/**
* Set the auth class.
*
@@ -154,7 +168,7 @@ class Google_Config
}
$this->configuration['auth_class'] = $class;
}
-
+
/**
* Set the IO class.
*
@@ -267,7 +281,16 @@ class Google_Config
{
$this->setAuthConfig('approval_prompt', $approval);
}
-
+
+ /**
+ * Set the login hint (email address or sub identifier)
+ * @param $hint string
+ */
+ public function setLoginHint($hint)
+ {
+ $this->setAuthConfig('login_hint', $hint);
+ }
+
/**
* Set the developer key for the auth class. Note that this is separate value
* from the client ID - if it looks like a URL, its a client ID!
@@ -279,13 +302,60 @@ class Google_Config
}
/**
+ * Set the hd (hosted domain) parameter streamlines the login process for
+ * Google Apps hosted accounts. By including the domain of the user, you
+ * restrict sign-in to accounts at that domain.
+ * @param $hd string - the domain to use.
+ */
+ public function setHostedDomain($hd)
+ {
+ $this->setAuthConfig('hd', $hd);
+ }
+
+ /**
+ * Set the prompt hint. Valid values are none, consent and select_account.
+ * If no value is specified and the user has not previously authorized
+ * access, then the user is shown a consent screen.
+ * @param $prompt string
+ */
+ public function setPrompt($prompt)
+ {
+ $this->setAuthConfig('prompt', $prompt);
+ }
+
+ /**
+ * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
+ * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
+ * an authentication request is valid.
+ * @param $realm string - the URL-space to use.
+ */
+ public function setOpenidRealm($realm)
+ {
+ $this->setAuthConfig('openid.realm', $realm);
+ }
+
+ /**
+ * If this is provided with the value true, and the authorization request is
+ * granted, the authorization will include any previous authorizations
+ * granted to this user/application combination for other scopes.
+ * @param $include boolean - the URL-space to use.
+ */
+ public function setIncludeGrantedScopes($include)
+ {
+ $this->setAuthConfig(
+ 'include_granted_scopes',
+ $include ? "true" : "false"
+ );
+ }
+
+ /**
* @return string the base URL to use for API calls
*/
public function getBasePath()
{
return $this->configuration['base_path'];
}
-
+
/**
* Set the auth configuration for the current auth class.
* @param $key - the key to set