Server IP : 1.179.227.78 / Your IP : 10.104.4.41 Web Server : Apache System : Linux afdc-mdu34 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 User : www ( 1001) PHP Version : 7.4.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/afdc-mdu34.rtarf.mi.th/joomla/libraries/joomla/google/auth/ |
Upload File : |
<?php /** * @package Joomla.Platform * @subpackage Google * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; use Joomla\Registry\Registry; /** * Google OAuth authentication class * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/google` package via Composer instead */ class JGoogleAuthOauth2 extends JGoogleAuth { /** * @var JOAuth2Client OAuth client for the Google authentication object. * @since 3.1.4 */ protected $client; /** * Constructor. * * @param Registry $options JGoogleAuth options object. * @param JOAuth2Client $client OAuth client for Google authentication. * * @since 3.1.4 */ public function __construct(Registry $options = null, JOAuth2Client $client = null) { $this->options = isset($options) ? $options : new Registry; $this->client = isset($client) ? $client : new JOAuth2Client($this->options); } /** * Method to authenticate to Google * * @return boolean True on success. * * @since 3.1.4 */ public function authenticate() { $this->googlize(); return $this->client->authenticate(); } /** * Verify if the client has been authenticated * * @return boolean Is authenticated * * @since 3.1.4 */ public function isAuthenticated() { return $this->client->isAuthenticated(); } /** * Method to retrieve data from Google * * @param string $url The URL for the request. * @param mixed $data The data to include in the request. * @param array $headers The headers to send with the request. * @param string $method The type of http request to send. * * @return mixed Data from Google. * * @since 3.1.4 */ public function query($url, $data = null, $headers = null, $method = 'get') { $this->googlize(); return $this->client->query($url, $data, $headers, $method); } /** * Method to fill in Google-specific OAuth settings * * @return JOAuth2Client Google-configured Oauth2 client. * * @since 3.1.4 */ protected function googlize() { if (!$this->client->getOption('authurl')) { $this->client->setOption('authurl', 'https://accounts.google.com/o/oauth2/auth'); } if (!$this->client->getOption('tokenurl')) { $this->client->setOption('tokenurl', 'https://accounts.google.com/o/oauth2/token'); } if (!$this->client->getOption('requestparams')) { $this->client->setOption('requestparams', array()); } $params = $this->client->getOption('requestparams'); if (!array_key_exists('access_type', $params)) { $params['access_type'] = 'offline'; } if ($params['access_type'] == 'offline' && $this->client->getOption('userefresh') === null) { $this->client->setOption('userefresh', true); } if (!array_key_exists('approval_prompt', $params)) { $params['approval_prompt'] = 'auto'; } $this->client->setOption('requestparams', $params); return $this->client; } }