Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/Google
File: Client.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright 2010 Google Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* Licensed under the Apache License, Version 2.0 (the "License");
[4] Fix | Delete
* you may not use this file except in compliance with the License.
[5] Fix | Delete
* You may obtain a copy of the License at
[6] Fix | Delete
*
[7] Fix | Delete
* http://www.apache.org/licenses/LICENSE-2.0
[8] Fix | Delete
*
[9] Fix | Delete
* Unless required by applicable law or agreed to in writing, software
[10] Fix | Delete
* distributed under the License is distributed on an "AS IS" BASIS,
[11] Fix | Delete
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
[12] Fix | Delete
* See the License for the specific language governing permissions and
[13] Fix | Delete
* limitations under the License.
[14] Fix | Delete
*/
[15] Fix | Delete
[16] Fix | Delete
if (!class_exists('UDP_Google_Client')) {
[17] Fix | Delete
require_once dirname(__FILE__) . '/../autoload.php';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* The Google API Client
[22] Fix | Delete
* http://code.google.com/p/google-api-php-client/
[23] Fix | Delete
*/
[24] Fix | Delete
class UDP_Google_Client
[25] Fix | Delete
{
[26] Fix | Delete
const LIBVER = "1.1.4";
[27] Fix | Delete
const USER_AGENT_SUFFIX = "google-api-php-client-ud/";
[28] Fix | Delete
/**
[29] Fix | Delete
* @var Google_Auth_Abstract $auth
[30] Fix | Delete
*/
[31] Fix | Delete
private $auth;
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* @var UDP_Google_IO_Abstract $io
[35] Fix | Delete
*/
[36] Fix | Delete
private $io;
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* @var Google_Cache_Abstract $cache
[40] Fix | Delete
*/
[41] Fix | Delete
private $cache;
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* @var UDP_Google_Config $config
[45] Fix | Delete
*/
[46] Fix | Delete
private $config;
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* @var Google_Logger_Abstract $logger
[50] Fix | Delete
*/
[51] Fix | Delete
private $logger;
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* @var boolean $deferExecution
[55] Fix | Delete
*/
[56] Fix | Delete
private $deferExecution = false;
[57] Fix | Delete
[58] Fix | Delete
/** @var array $scopes */
[59] Fix | Delete
// Scopes requested by the client
[60] Fix | Delete
protected $requestedScopes = array();
[61] Fix | Delete
[62] Fix | Delete
// definitions of services that are discovered.
[63] Fix | Delete
protected $services = array();
[64] Fix | Delete
[65] Fix | Delete
// Used to track authenticated state, can't discover services after doing authenticate()
[66] Fix | Delete
private $authenticated = false;
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Construct the Google Client.
[70] Fix | Delete
*
[71] Fix | Delete
* @param $config UDP_Google_Config or string for the ini file to load
[72] Fix | Delete
*/
[73] Fix | Delete
public function __construct($config = null)
[74] Fix | Delete
{
[75] Fix | Delete
if (is_string($config) && strlen($config)) {
[76] Fix | Delete
$config = new UDP_Google_Config($config);
[77] Fix | Delete
} else if ( !($config instanceof UDP_Google_Config)) {
[78] Fix | Delete
$config = new UDP_Google_Config();
[79] Fix | Delete
[80] Fix | Delete
if ($this->isAppEngine()) {
[81] Fix | Delete
// Automatically use Memcache if we're in AppEngine.
[82] Fix | Delete
$config->setCacheClass('Google_Cache_Memcache');
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
[86] Fix | Delete
// Automatically disable compress.zlib, as currently unsupported.
[87] Fix | Delete
$config->setClassConfig('UDP_Google_Http_Request', 'disable_gzip', true);
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
if ($config->getIoClass() == UDP_Google_Config::USE_AUTO_IO_SELECTION) {
[92] Fix | Delete
if (function_exists('curl_version') && function_exists('curl_exec')
[93] Fix | Delete
&& !$this->isAppEngine()) {
[94] Fix | Delete
$config->setIoClass("UDP_Google_IO_Curl");
[95] Fix | Delete
} else {
[96] Fix | Delete
$config->setIoClass("UDP_Google_IO_Stream");
[97] Fix | Delete
}
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
$this->config = $config;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Get a string containing the version of the library.
[105] Fix | Delete
*
[106] Fix | Delete
* @return string
[107] Fix | Delete
*/
[108] Fix | Delete
public function getLibraryVersion()
[109] Fix | Delete
{
[110] Fix | Delete
return self::LIBVER;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Attempt to exchange a code for an valid authentication token.
[115] Fix | Delete
* Helper wrapped around the OAuth 2.0 implementation.
[116] Fix | Delete
*
[117] Fix | Delete
* @param $code string code from accounts.google.com
[118] Fix | Delete
* @return string token
[119] Fix | Delete
*/
[120] Fix | Delete
public function authenticate($code)
[121] Fix | Delete
{
[122] Fix | Delete
$this->authenticated = true;
[123] Fix | Delete
return $this->getAuth()->authenticate($code);
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
/**
[127] Fix | Delete
* Loads a service account key and parameters from a JSON
[128] Fix | Delete
* file from the Google Developer Console. Uses that and the
[129] Fix | Delete
* given array of scopes to return an assertion credential for
[130] Fix | Delete
* use with refreshTokenWithAssertionCredential.
[131] Fix | Delete
*
[132] Fix | Delete
* @param string $jsonLocation File location of the project-key.json.
[133] Fix | Delete
* @param array $scopes The scopes to assert.
[134] Fix | Delete
* @return Google_Auth_AssertionCredentials.
[135] Fix | Delete
* @
[136] Fix | Delete
*/
[137] Fix | Delete
public function loadServiceAccountJson($jsonLocation, $scopes)
[138] Fix | Delete
{
[139] Fix | Delete
$data = json_decode(file_get_contents($jsonLocation));
[140] Fix | Delete
if (isset($data->type) && $data->type == 'service_account') {
[141] Fix | Delete
// Service Account format.
[142] Fix | Delete
$cred = new Google_Auth_AssertionCredentials(
[143] Fix | Delete
$data->client_email,
[144] Fix | Delete
$scopes,
[145] Fix | Delete
$data->private_key
[146] Fix | Delete
);
[147] Fix | Delete
return $cred;
[148] Fix | Delete
} else {
[149] Fix | Delete
throw new Google_Exception("Invalid service account JSON file.");
[150] Fix | Delete
}
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
/**
[154] Fix | Delete
* Set the auth config from the JSON string provided.
[155] Fix | Delete
* This structure should match the file downloaded from
[156] Fix | Delete
* the "Download JSON" button on in the Google Developer
[157] Fix | Delete
* Console.
[158] Fix | Delete
* @param string $json the configuration json
[159] Fix | Delete
* @throws Google_Exception
[160] Fix | Delete
*/
[161] Fix | Delete
public function setAuthConfig($json)
[162] Fix | Delete
{
[163] Fix | Delete
$data = json_decode($json);
[164] Fix | Delete
$key = isset($data->installed) ? 'installed' : 'web';
[165] Fix | Delete
if (!isset($data->$key)) {
[166] Fix | Delete
throw new Google_Exception("Invalid client secret JSON file.");
[167] Fix | Delete
}
[168] Fix | Delete
$this->setClientId($data->$key->client_id);
[169] Fix | Delete
$this->setClientSecret($data->$key->client_secret);
[170] Fix | Delete
if (isset($data->$key->redirect_uris)) {
[171] Fix | Delete
$this->setRedirectUri($data->$key->redirect_uris[0]);
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Set the auth config from the JSON file in the path
[177] Fix | Delete
* provided. This should match the file downloaded from
[178] Fix | Delete
* the "Download JSON" button on in the Google Developer
[179] Fix | Delete
* Console.
[180] Fix | Delete
* @param string $file the file location of the client json
[181] Fix | Delete
*/
[182] Fix | Delete
public function setAuthConfigFile($file)
[183] Fix | Delete
{
[184] Fix | Delete
$this->setAuthConfig(file_get_contents($file));
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
/**
[188] Fix | Delete
* @throws Google_Auth_Exception
[189] Fix | Delete
* @return array
[190] Fix | Delete
* @visible For Testing
[191] Fix | Delete
*/
[192] Fix | Delete
public function prepareScopes()
[193] Fix | Delete
{
[194] Fix | Delete
if (empty($this->requestedScopes)) {
[195] Fix | Delete
throw new Google_Auth_Exception("No scopes specified");
[196] Fix | Delete
}
[197] Fix | Delete
$scopes = implode(' ', $this->requestedScopes);
[198] Fix | Delete
return $scopes;
[199] Fix | Delete
}
[200] Fix | Delete
[201] Fix | Delete
/**
[202] Fix | Delete
* Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
[203] Fix | Delete
* or UDP_Google_Client#getAccessToken().
[204] Fix | Delete
* @param string $accessToken JSON encoded string containing in the following format:
[205] Fix | Delete
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
[206] Fix | Delete
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
[207] Fix | Delete
*/
[208] Fix | Delete
public function setAccessToken($accessToken)
[209] Fix | Delete
{
[210] Fix | Delete
if ($accessToken == 'null') {
[211] Fix | Delete
$accessToken = null;
[212] Fix | Delete
}
[213] Fix | Delete
$this->getAuth()->setAccessToken($accessToken);
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Set the authenticator object
[220] Fix | Delete
* @param Google_Auth_Abstract $auth
[221] Fix | Delete
*/
[222] Fix | Delete
public function setAuth(Google_Auth_Abstract $auth)
[223] Fix | Delete
{
[224] Fix | Delete
$this->config->setAuthClass(get_class($auth));
[225] Fix | Delete
$this->auth = $auth;
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
/**
[229] Fix | Delete
* Set the IO object
[230] Fix | Delete
* @param UDP_Google_IO_Abstract $io
[231] Fix | Delete
*/
[232] Fix | Delete
public function setIo(UDP_Google_IO_Abstract $io)
[233] Fix | Delete
{
[234] Fix | Delete
$this->config->setIoClass(get_class($io));
[235] Fix | Delete
$this->io = $io;
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
/**
[239] Fix | Delete
* Set the Cache object
[240] Fix | Delete
* @param Google_Cache_Abstract $cache
[241] Fix | Delete
*/
[242] Fix | Delete
public function setCache(Google_Cache_Abstract $cache)
[243] Fix | Delete
{
[244] Fix | Delete
$this->config->setCacheClass(get_class($cache));
[245] Fix | Delete
$this->cache = $cache;
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Set the Logger object
[250] Fix | Delete
* @param Google_Logger_Abstract $logger
[251] Fix | Delete
*/
[252] Fix | Delete
public function setLogger(Google_Logger_Abstract $logger)
[253] Fix | Delete
{
[254] Fix | Delete
$this->config->setLoggerClass(get_class($logger));
[255] Fix | Delete
$this->logger = $logger;
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Construct the OAuth 2.0 authorization request URI.
[260] Fix | Delete
* @return string
[261] Fix | Delete
*/
[262] Fix | Delete
public function createAuthUrl()
[263] Fix | Delete
{
[264] Fix | Delete
$scopes = $this->prepareScopes();
[265] Fix | Delete
return $this->getAuth()->createAuthUrl($scopes);
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
/**
[269] Fix | Delete
* Get the OAuth 2.0 access token.
[270] Fix | Delete
* @return string $accessToken JSON encoded string in the following format:
[271] Fix | Delete
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
[272] Fix | Delete
* "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
[273] Fix | Delete
*/
[274] Fix | Delete
public function getAccessToken()
[275] Fix | Delete
{
[276] Fix | Delete
$token = $this->getAuth()->getAccessToken();
[277] Fix | Delete
// The response is json encoded, so could be the string null.
[278] Fix | Delete
// It is arguable whether this check should be here or lower
[279] Fix | Delete
// in the library.
[280] Fix | Delete
return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
/**
[284] Fix | Delete
* Get the OAuth 2.0 refresh token.
[285] Fix | Delete
* @return string $refreshToken refresh token or null if not available
[286] Fix | Delete
*/
[287] Fix | Delete
public function getRefreshToken()
[288] Fix | Delete
{
[289] Fix | Delete
return $this->getAuth()->getRefreshToken();
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* Returns if the access_token is expired.
[294] Fix | Delete
* @return bool Returns True if the access_token is expired.
[295] Fix | Delete
*/
[296] Fix | Delete
public function isAccessTokenExpired()
[297] Fix | Delete
{
[298] Fix | Delete
return $this->getAuth()->isAccessTokenExpired();
[299] Fix | Delete
}
[300] Fix | Delete
[301] Fix | Delete
/**
[302] Fix | Delete
* Set OAuth 2.0 "state" parameter to achieve per-request customization.
[303] Fix | Delete
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
[304] Fix | Delete
* @param string $state
[305] Fix | Delete
*/
[306] Fix | Delete
public function setState($state)
[307] Fix | Delete
{
[308] Fix | Delete
$this->getAuth()->setState($state);
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
/**
[312] Fix | Delete
* @param string $accessType Possible values for access_type include:
[313] Fix | Delete
* {@code "offline"} to request offline access from the user.
[314] Fix | Delete
* {@code "online"} to request online access from the user.
[315] Fix | Delete
*/
[316] Fix | Delete
public function setAccessType($accessType)
[317] Fix | Delete
{
[318] Fix | Delete
$this->config->setAccessType($accessType);
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
/**
[322] Fix | Delete
* @param string $approvalPrompt Possible values for approval_prompt include:
[323] Fix | Delete
* {@code "force"} to force the approval UI to appear. (This is the default value)
[324] Fix | Delete
* {@code "auto"} to request auto-approval when possible.
[325] Fix | Delete
*/
[326] Fix | Delete
public function setApprovalPrompt($approvalPrompt)
[327] Fix | Delete
{
[328] Fix | Delete
$this->config->setApprovalPrompt($approvalPrompt);
[329] Fix | Delete
}
[330] Fix | Delete
[331] Fix | Delete
/**
[332] Fix | Delete
* Set the login hint, email address or sub id.
[333] Fix | Delete
* @param string $loginHint
[334] Fix | Delete
*/
[335] Fix | Delete
public function setLoginHint($loginHint)
[336] Fix | Delete
{
[337] Fix | Delete
$this->config->setLoginHint($loginHint);
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
/**
[341] Fix | Delete
* Set the application name, this is included in the User-Agent HTTP header.
[342] Fix | Delete
* @param string $applicationName
[343] Fix | Delete
*/
[344] Fix | Delete
public function setApplicationName($applicationName)
[345] Fix | Delete
{
[346] Fix | Delete
$this->config->setApplicationName($applicationName);
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
/**
[350] Fix | Delete
* Set the OAuth 2.0 Client ID.
[351] Fix | Delete
* @param string $clientId
[352] Fix | Delete
*/
[353] Fix | Delete
public function setClientId($clientId)
[354] Fix | Delete
{
[355] Fix | Delete
$this->config->setClientId($clientId);
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
/**
[359] Fix | Delete
* Set the OAuth 2.0 Client Secret.
[360] Fix | Delete
* @param string $clientSecret
[361] Fix | Delete
*/
[362] Fix | Delete
public function setClientSecret($clientSecret)
[363] Fix | Delete
{
[364] Fix | Delete
$this->config->setClientSecret($clientSecret);
[365] Fix | Delete
}
[366] Fix | Delete
[367] Fix | Delete
/**
[368] Fix | Delete
* Set the OAuth 2.0 Redirect URI.
[369] Fix | Delete
* @param string $redirectUri
[370] Fix | Delete
*/
[371] Fix | Delete
public function setRedirectUri($redirectUri)
[372] Fix | Delete
{
[373] Fix | Delete
$this->config->setRedirectUri($redirectUri);
[374] Fix | Delete
}
[375] Fix | Delete
[376] Fix | Delete
/**
[377] Fix | Delete
* If 'plus.login' is included in the list of requested scopes, you can use
[378] Fix | Delete
* this method to define types of app activities that your app will write.
[379] Fix | Delete
* You can find a list of available types here:
[380] Fix | Delete
* @link https://developers.google.com/+/api/moment-types
[381] Fix | Delete
*
[382] Fix | Delete
* @param array $requestVisibleActions Array of app activity types
[383] Fix | Delete
*/
[384] Fix | Delete
public function setRequestVisibleActions($requestVisibleActions)
[385] Fix | Delete
{
[386] Fix | Delete
if (is_array($requestVisibleActions)) {
[387] Fix | Delete
$requestVisibleActions = join(" ", $requestVisibleActions);
[388] Fix | Delete
}
[389] Fix | Delete
$this->config->setRequestVisibleActions($requestVisibleActions);
[390] Fix | Delete
}
[391] Fix | Delete
[392] Fix | Delete
/**
[393] Fix | Delete
* Set the developer key to use, these are obtained through the API Console.
[394] Fix | Delete
* @see http://code.google.com/apis/console-help/#generatingdevkeys
[395] Fix | Delete
* @param string $developerKey
[396] Fix | Delete
*/
[397] Fix | Delete
public function setDeveloperKey($developerKey)
[398] Fix | Delete
{
[399] Fix | Delete
$this->config->setDeveloperKey($developerKey);
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* Set the hd (hosted domain) parameter streamlines the login process for
[404] Fix | Delete
* Google Apps hosted accounts. By including the domain of the user, you
[405] Fix | Delete
* restrict sign-in to accounts at that domain.
[406] Fix | Delete
* @param $hd string - the domain to use.
[407] Fix | Delete
*/
[408] Fix | Delete
public function setHostedDomain($hd)
[409] Fix | Delete
{
[410] Fix | Delete
$this->config->setHostedDomain($hd);
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
/**
[414] Fix | Delete
* Set the prompt hint. Valid values are none, consent and select_account.
[415] Fix | Delete
* If no value is specified and the user has not previously authorized
[416] Fix | Delete
* access, then the user is shown a consent screen.
[417] Fix | Delete
* @param $prompt string
[418] Fix | Delete
*/
[419] Fix | Delete
public function setPrompt($prompt)
[420] Fix | Delete
{
[421] Fix | Delete
$this->config->setPrompt($prompt);
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
/**
[425] Fix | Delete
* openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
[426] Fix | Delete
* 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
[427] Fix | Delete
* an authentication request is valid.
[428] Fix | Delete
* @param $realm string - the URL-space to use.
[429] Fix | Delete
*/
[430] Fix | Delete
public function setOpenidRealm($realm)
[431] Fix | Delete
{
[432] Fix | Delete
$this->config->setOpenidRealm($realm);
[433] Fix | Delete
}
[434] Fix | Delete
[435] Fix | Delete
/**
[436] Fix | Delete
* If this is provided with the value true, and the authorization request is
[437] Fix | Delete
* granted, the authorization will include any previous authorizations
[438] Fix | Delete
* granted to this user/application combination for other scopes.
[439] Fix | Delete
* @param $include boolean - the URL-space to use.
[440] Fix | Delete
*/
[441] Fix | Delete
public function setIncludeGrantedScopes($include)
[442] Fix | Delete
{
[443] Fix | Delete
$this->config->setIncludeGrantedScopes($include);
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Fetches a fresh OAuth 2.0 access token with the given refresh token.
[448] Fix | Delete
* @param string $refreshToken
[449] Fix | Delete
*/
[450] Fix | Delete
public function refreshToken($refreshToken)
[451] Fix | Delete
{
[452] Fix | Delete
$this->getAuth()->refreshToken($refreshToken);
[453] Fix | Delete
}
[454] Fix | Delete
[455] Fix | Delete
/**
[456] Fix | Delete
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
[457] Fix | Delete
* token, if a token isn't provided.
[458] Fix | Delete
* @throws Google_Auth_Exception
[459] Fix | Delete
* @param string|null $token The token (access token or a refresh token) that should be revoked.
[460] Fix | Delete
* @return boolean Returns True if the revocation was successful, otherwise False.
[461] Fix | Delete
*/
[462] Fix | Delete
public function revokeToken($token = null)
[463] Fix | Delete
{
[464] Fix | Delete
return $this->getAuth()->revokeToken($token);
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
/**
[468] Fix | Delete
* Verify an id_token. This method will verify the current id_token, if one
[469] Fix | Delete
* isn't provided.
[470] Fix | Delete
* @throws Google_Auth_Exception
[471] Fix | Delete
* @param string|null $token The token (id_token) that should be verified.
[472] Fix | Delete
* @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
[473] Fix | Delete
* successful.
[474] Fix | Delete
*/
[475] Fix | Delete
public function verifyIdToken($token = null)
[476] Fix | Delete
{
[477] Fix | Delete
return $this->getAuth()->verifyIdToken($token);
[478] Fix | Delete
}
[479] Fix | Delete
[480] Fix | Delete
/**
[481] Fix | Delete
* Verify a JWT that was signed with your own certificates.
[482] Fix | Delete
*
[483] Fix | Delete
* @param $id_token string The JWT token
[484] Fix | Delete
* @param $cert_location array of certificates
[485] Fix | Delete
* @param $audience string the expected consumer of the token
[486] Fix | Delete
* @param $issuer string the expected issuer, defaults to Google
[487] Fix | Delete
* @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
[488] Fix | Delete
* @return mixed token information if valid, false if not
[489] Fix | Delete
*/
[490] Fix | Delete
public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
[491] Fix | Delete
{
[492] Fix | Delete
$auth = new Google_Auth_OAuth2($this);
[493] Fix | Delete
$certs = $auth->retrieveCertsFromLocation($cert_location);
[494] Fix | Delete
return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
/**
[498] Fix | Delete
* @param $creds Google_Auth_AssertionCredentials
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function