Lines Matching refs:this

110     $this->config = array_merge(
183 if (!is_null($this->config['credentials'])) {
184 if ($this->config['credentials'] instanceof CredentialsLoader) {
185 $this->credentials = $this->config['credentials'];
187 $this->setAuthConfig($this->config['credentials']);
189 unset($this->config['credentials']);
192 if (!is_null($this->config['scopes'])) {
193 $this->setScopes($this->config['scopes']);
194 unset($this->config['scopes']);
198 if (is_null($this->config['token_callback'])) {
199 $this->config['token_callback'] = function ($cacheKey, $newAccessToken) {
200 $this->setAccessToken(
210 if (!is_null($this->config['cache'])) {
211 $this->setCache($this->config['cache']);
212 unset($this->config['cache']);
236 return $this->fetchAccessTokenWithAuthCode($code);
252 $auth = $this->getOAuth2Service();
254 $auth->setRedirectUri($this->getRedirectUri());
256 $httpHandler = HttpHandlerFactory::build($this->getHttpClient());
260 $this->setAccessToken($creds);
275 return $this->fetchAccessTokenWithAssertion();
285 if (!$this->isUsingApplicationDefaultCredentials()) {
295 $this->getLogger()->log(
300 $credentials = $this->createApplicationDefaultCredentials();
306 $this->setAccessToken($creds);
321 return $this->fetchAccessTokenWithRefreshToken($refreshToken);
332 if (!isset($this->token['refresh_token'])) {
337 $refreshToken = $this->token['refresh_token'];
339 $this->getLogger()->info('OAuth2 access token refresh');
340 $auth = $this->getOAuth2Service();
343 $httpHandler = HttpHandlerFactory::build($this->getHttpClient());
350 $this->setAccessToken($creds);
366 $scope = $this->prepareScopes();
373 $approvalPrompt = $this->config['prompt']
375 : $this->config['approval_prompt'];
378 $includeGrantedScopes = $this->config['include_granted_scopes'] === null
380 : var_export($this->config['include_granted_scopes'], true);
384 'access_type' => $this->config['access_type'],
386 'hd' => $this->config['hd'],
388 'login_hint' => $this->config['login_hint'],
389 'openid.realm' => $this->config['openid.realm'],
390 'prompt' => $this->config['prompt'],
393 'state' => $this->config['state'],
399 $rva = $this->config['request_visible_actions'];
404 $auth = $this->getOAuth2Service();
418 $http = $http ?: $this->getHttpClient();
419 $authHandler = $this->getAuthHandler();
427 if ($this->credentials) {
430 $this->credentials,
431 $this->config['token_callback']
435 if ($this->isUsingApplicationDefaultCredentials()) {
436 $credentials = $this->createApplicationDefaultCredentials();
440 $this->config['token_callback']
444 if ($token = $this->getAccessToken()) {
445 $scopes = $this->prepareScopes();
447 if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) {
448 $credentials = $this->createUserRefreshCredentials(
455 $this->config['token_callback']
462 if ($key = $this->config['developer_key']) {
478 $this->config['use_application_default_credentials'] = $useAppCreds;
489 return $this->config['use_application_default_credentials'];
525 $this->token = $token;
530 return $this->token;
538 if (isset($this->token['refresh_token'])) {
539 return $this->token['refresh_token'];
551 if (!$this->token) {
556 if (isset($this->token['created'])) {
557 $created = $this->token['created'];
558 } elseif (isset($this->token['id_token'])) {
563 $idToken = $this->token['id_token'];
572 if (!isset($this->token['expires_in'])) {
578 return ($created + ($this->token['expires_in'] - 30)) < time();
607 $this->config['client_id'] = $clientId;
612 return $this->config['client_id'];
621 $this->config['client_secret'] = $clientSecret;
626 return $this->config['client_secret'];
635 $this->config['redirect_uri'] = $redirectUri;
640 return $this->config['redirect_uri'];
650 $this->config['state'] = $state;
660 $this->config['access_type'] = $accessType;
670 $this->config['approval_prompt'] = $approvalPrompt;
679 $this->config['login_hint'] = $loginHint;
688 $this->config['application_name'] = $applicationName;
704 $this->config['request_visible_actions'] = $requestVisibleActions;
714 $this->config['developer_key'] = $developerKey;
725 $this->config['hd'] = $hd;
739 $this->config['prompt'] = $prompt;
750 $this->config['openid.realm'] = $realm;
761 $this->config['include_granted_scopes'] = $include;
770 $this->config['token_callback'] = $tokenCallback;
782 $tokenRevoker = new Revoke($this->getHttpClient());
784 return $tokenRevoker->revokeToken($token ?: $this->getAccessToken());
800 $this->getHttpClient(),
801 $this->getCache(),
802 $this->config['jwt']
806 $token = $this->getAccessToken();
817 $this->getClientId()
832 $this->requestedScopes = array();
833 $this->addScope($scope_or_scopes);
845 if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
846 $this->requestedScopes[] = $scope_or_scopes;
849 $this->addScope($scope);
861 return $this->requestedScopes;
870 if (empty($this->requestedScopes)) {
874 return implode(' ', $this->requestedScopes);
892 $this->config['application_name'],
894 $this->getLibraryVersion()
902 $this->getLibraryVersion()
906 if ($this->config['api_format_v2']) {
915 $http = $this->authorize();
921 $this->config['retry'],
922 $this->config['retry_map']
936 $this->setDefer($useBatch);
951 $this->config[$name] = $value;
956 return isset($this->config[$name]) ? $this->config[$name] : $default;
969 $this->setAuthConfig($file);
997 $this->useApplicationDefaultCredentials();
1000 $this->setClientId($config['client_id']);
1001 $this->config['client_email'] = $config['client_email'];
1002 $this->config['signing_key'] = $config['private_key'];
1003 $this->config['signing_algorithm'] = 'HS256';
1006 $this->setClientId($config[$key]['client_id']);
1007 $this->setClientSecret($config[$key]['client_secret']);
1009 $this->setRedirectUri($config[$key]['redirect_uris'][0]);
1013 $this->setClientId($config['client_id']);
1014 $this->setClientSecret($config['client_secret']);
1016 $this->setRedirectUri($config['redirect_uris'][0]);
1028 $this->config['subject'] = $subject;
1039 $this->deferExecution = $defer;
1048 return $this->deferExecution;
1056 if (!isset($this->auth)) {
1057 $this->auth = $this->createOAuth2Service();
1060 return $this->auth;
1070 'clientId' => $this->getClientId(),
1071 'clientSecret' => $this->getClientSecret(),
1074 'redirectUri' => $this->getRedirectUri(),
1075 'issuer' => $this->config['client_id'],
1076 'signingKey' => $this->config['signing_key'],
1077 'signingAlgorithm' => $this->config['signing_algorithm'],
1090 $this->cache = $cache;
1098 if (!$this->cache) {
1099 $this->cache = $this->createDefaultCache();
1102 return $this->cache;
1110 $this->config['cache_config'] = $cacheConfig;
1119 $this->logger = $logger;
1127 if (!isset($this->logger)) {
1128 $this->logger = $this->createDefaultLogger();
1131 return $this->logger;
1137 if ($this->isAppEngine()) {
1158 $this->http = $http;
1166 if (null === $this->http) {
1167 $this->http = $this->createDefaultHttpClient();
1170 return $this->http;
1182 $this->config['api_format_v2'] = (bool) $value;
1196 'base_url' => $this->config['base_path'],
1199 if ($this->isAppEngine()) {
1207 'base_uri' => $this->config['base_path'],
1222 $scopes = $this->prepareScopes();
1223 $sub = $this->config['subject'];
1224 $signingKey = $this->config['signing_key'];
1229 'client_id' => $this->config['client_id'],
1230 'client_email' => $this->config['client_email'],
1233 'quota_project_id' => $this->config['quota_project'],
1246 $sub ? null : $this->config['cache_config'],
1247 $sub ? null : $this->getCache(),
1248 $this->config['quota_project']
1266 $this->config['cache_config'],
1267 $this->getCache()
1281 $this->getCache(),
1282 $this->config['cache_config']
1290 'client_id' => $this->getClientId(),
1291 'client_secret' => $this->getClientSecret(),