One Hat Cyber Team
Your IP :
216.73.216.135
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
ojs-nosc
/
lib
/
pkp
/
jobs
/
orcid
/
View File Name :
RevokeOrcidToken.php
<?php /** * @file jobs/orcid/RevokeOrcidToken.php * * Copyright (c) 2014-2024 Simon Fraser University * Copyright (c) 2000-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class DepositOrcidSubmission * * @ingroup jobs * * @brief Job to revoke a user's ORCID access token for the application. */ namespace PKP\jobs\orcid; use APP\core\Application; use GuzzleHttp\Exception\ClientException; use PKP\context\Context; use PKP\identity\Identity; use PKP\jobs\BaseJob; use PKP\orcid\OrcidManager; use PKP\user\User; class RevokeOrcidToken extends BaseJob { public function __construct( private readonly Context $context, private readonly Identity $identity ) { parent::__construct(); } /** * @inheritDoc */ public function handle(): void { if (!OrcidManager::isEnabled($this->context)) { return; } $token = $this->identity->getData('orcidAccessToken'); $httpClient = Application::get()->getHttpClient(); $headers = ['Accept' => 'application/json']; $postData = [ 'token' => $token, 'client_id' => OrcidManager::getClientId($this->context), 'client_secret' => OrcidManager::getClientSecret($this->context) ]; try { $httpClient->request( 'POST', OrcidManager::getTokenRevocationUrl($this->context), [ 'headers' => $headers, 'form_params' => $postData, ], ); $identityTypeName = $this->identity instanceof User ? 'User' : 'Author'; OrcidManager::logInfo("Token revoked for {$identityTypeName}, with ID: " . $this->identity->getId()); } catch (ClientException $exception) { $httpStatus = $exception->getCode(); $error = json_decode($exception->getResponse()->getBody(), true); OrcidManager::logError("ORCID token revocation failed with status {$httpStatus}. Error: " . $error['error_description']); $this->fail($exception); } } }