PATH:
home
/
centosnipponia
/
public_html
/
ticketing.nipponia.com
/
ticketing-old
/
include
<?php /** * class.oauth2.php * * osTicket OAuth2 Utils & Helpers * * @author Peter Rotich <peter@osticket.com> * @copyright Copyright (c) osTicket <gpl@osticket.com> * */ namespace osTicket\OAuth2 { // Define exceptions as RunTimeException class Exception extends \RuntimeException { } /** * osTicket OAuth2 Access Token * * Based on AcessToken class from league/oauth2-client library (MIT) * @link http://tools.ietf.org/html/rfc6749#section-1.4 Access Token (RFC 6749, §1.4) * */ class AccessToken { protected $accessToken; protected $expires; protected $refreshToken; protected $resourceOwnerId; protected $scope; // osTicket specific protected $resourceOwnerEmail; protected $configSignature; public function __construct(array $options = []) { if (empty($options['access_token'])) { throw new \InvalidArgumentException(sprintf( __('Required option not passed: "%s"'), 'access_token')); } $this->accessToken = $options['access_token']; if (!empty($options['refresh_token'])) $this->refreshToken = $options['refresh_token']; if (!empty($options['expires'])) $this->expires = $options['expires']; if (!empty($options['config_signature'])) $this->configSignature = $options['config_signature']; if (!empty($options['resource_owner_id'])) $this->resourceOwnerId = $options['resource_owner_id']; if (!empty($options['resource_owner_email'])) $this->resourceOwnerEmail = $options['resource_owner_email']; if (!empty($options['scope'])) $this->scope = $options['scope']; } public function getToken() { return $this->accessToken; } public function getAccessToken() { return $this->getToken(); } public function getRefreshToken() { return $this->refreshToken; } public function getExpires() { return $this->expires; } public function getResourceOwnerId() { return $this->resourceOwnerId; } public function getResourceOwnerEmail() { return $this->resourceOwnerEmail; } public function getResourceOwner() { return $this->getResourceOwnerEmail(); } public function getScope() { return $this->scope; } public function getConfigSignature() { return $this->configSignature; } public function hasExpired() { $expires = $this->getExpires(); if (empty($expires)) throw new \RuntimeException('"expires" is not set on the token'); return $expires < time(); } public function isExpired() { return $this->hasExpired(); } public function isMatch($email, $strict=false) { return (!$strict || strcasecmp($this->getResourceOwnerEmail(), $email) === 0); } public function getAuthRequest($user=null) { if ($this->hasExpired()) throw new Exception('Access Token is Expired'); return base64_encode(sprintf("user=%s\1auth=Bearer %s\1\1", $user ?? $this->getResourceOwner(), $this->getAccessToken())); } public function __toString() { return (string) $this->getToken(); } public function toArray() { return [ 'access_token' => $this->getToken(), 'refresh_token' => $this->getRefreshToken(), 'expires' => $this->getExpires(), 'config_signature' => $this->getConfigSignature(), 'resource_owner_id' => $this->getResourceOwnerId(), 'resource_owner_email' => $this->getResourceOwnerEmail(), ]; } } }
[+]
..
[-] .MANIFEST
[edit]
[-] ajax.admin.php
[edit]
[-] ajax.config.php
[edit]
[-] ajax.content.php
[edit]
[-] ajax.draft.php
[edit]
[-] ajax.email.php
[edit]
[-] ajax.export.php
[edit]
[-] ajax.filter.php
[edit]
[-] ajax.forms.php
[edit]
[-] ajax.i18n.php
[edit]
[-] ajax.kbase.php
[edit]
[-] ajax.note.php
[edit]
[-] ajax.orgs.php
[edit]
[-] ajax.plugins.php
[edit]
[-] ajax.schedule.php
[edit]
[-] ajax.search.php
[edit]
[-] ajax.sequence.php
[edit]
[-] ajax.staff.php
[edit]
[-] ajax.tasks.php
[edit]
[-] ajax.thread.php
[edit]
[-] ajax.tickets.php
[edit]
[-] ajax.tips.php
[edit]
[-] ajax.upgrader.php
[edit]
[-] ajax.users.php
[edit]
[-] api.cron.php
[edit]
[-] api.tickets.php
[edit]
[-] class.2fa.php
[edit]
[-] class.ajax.php
[edit]
[-] class.api.php
[edit]
[-] class.app.php
[edit]
[-] class.attachment.php
[edit]
[-] class.auth.php
[edit]
[-] class.avatar.php
[edit]
[-] class.banlist.php
[edit]
[-] class.base32.php
[edit]
[-] class.businesshours.php
[edit]
[-] class.canned.php
[edit]
[-] class.captcha.php
[edit]
[-] class.category.php
[edit]
[-] class.charset.php
[edit]
[-] class.cli.php
[edit]
[-] class.client.php
[edit]
[-] class.collaborator.php
[edit]
[-] class.company.php
[edit]
[-] class.config.php
[edit]
[-] class.controller.php
[edit]
[-] class.cron.php
[edit]
[-] class.crypto.php
[edit]
[-] class.csrf.php
[edit]
[-] class.dept.php
[edit]
[-] class.dispatcher.php
[edit]
[-] class.draft.php
[edit]
[-] class.dynamic_forms.php
[edit]
[-] class.email.php
[edit]
[-] class.error.php
[edit]
[-] class.export.php
[edit]
[-] class.faq.php
[edit]
[-] class.file.php
[edit]
[-] class.filter.php
[edit]
[-] class.filter_action.php
[edit]
[-] class.format.php
[edit]
[-] class.forms.php
[edit]
[-] class.http.php
[edit]
[-] class.i18n.php
[edit]
[-] class.import.php
[edit]
[-] class.json.php
[edit]
[-] class.knowledgebase.php
[edit]
[-] class.list.php
[edit]
[-] class.lock.php
[edit]
[-] class.log.php
[edit]
[-] class.mail.php
[edit]
[-] class.mailer.php
[edit]
[-] class.mailfetch.php
[edit]
[-] class.mailparse.php
[edit]
[-] class.message.php
[edit]
[-] class.migrater.php
[edit]
[-] class.mime.php
[edit]
[-] class.misc.php
[edit]
[-] class.model.php
[edit]
[-] class.nav.php
[edit]
[-] class.note.php
[edit]
[-] class.oauth2.php
[edit]
[-] class.organization.php
[edit]
[-] class.orm.php
[edit]
[-] class.osticket.php
[edit]
[-] class.ostsession.php
[edit]
[-] class.page.php
[edit]
[-] class.pagenate.php
[edit]
[-] class.passwd.php
[edit]
[-] class.pdf.php
[edit]
[-] class.plugin.php
[edit]
[-] class.priority.php
[edit]
[-] class.queue.php
[edit]
[-] class.report.php
[edit]
[-] class.role.php
[edit]
[-] class.schedule.php
[edit]
[-] class.search.php
[edit]
[-] class.sequence.php
[edit]
[-] class.session.php
[edit]
[-] class.setup.php
[edit]
[-] class.signal.php
[edit]
[-] class.sla.php
[edit]
[-] class.staff.php
[edit]
[-] class.task.php
[edit]
[-] class.team.php
[edit]
[-] class.template.php
[edit]
[-] class.thread.php
[edit]
[-] class.thread_actions.php
[edit]
[-] class.ticket.php
[edit]
[-] class.timezone.php
[edit]
[-] class.topic.php
[edit]
[-] class.translation.php
[edit]
[-] class.upgrader.php
[edit]
[-] class.user.php
[edit]
[-] class.usersession.php
[edit]
[-] class.util.php
[edit]
[-] class.validator.php
[edit]
[-] class.variable.php
[edit]
[-] class.xml.php
[edit]
[-] class.yaml.php
[edit]
[+]
cli
[+]
client
[+]
config
[+]
fpdf
[-] html2text.php
[edit]
[-] htmLawed.php
[edit]
[+]
i18n
[-] index.php
[edit]
[-] JSON.php
[edit]
[+]
laminas-mail
[+]
mpdf
[-] mysqli.php
[edit]
[-] ost-sampleconfig.php
[edit]
[-] PasswordHash.php
[edit]
[+]
pear
[+]
plugins
[-] Spyc.php
[edit]
[+]
staff
[-] tnef_decoder.php
[edit]
[-] UniversalClassLoader.php
[edit]
[+]
upgrader
[-] ost-config.php
[edit]
[-] .htaccess.disabled
[edit]