Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

EveOnline.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 2.71 KiB


001  <?php
002  /**
003   * Contains EveOnline class.
004   * PHP version 5.4.
005   *
006   * @author    Michael Cummings <mgcummings@yahoo.com>
007   */
008   
009  namespace OAuth\OAuth2\Service;
010   
011  use OAuth\Common\Consumer\CredentialsInterface;
012  use OAuth\Common\Http\Client\ClientInterface;
013  use OAuth\Common\Http\Exception\TokenResponseException;
014  use OAuth\Common\Http\Uri\Uri;
015  use OAuth\Common\Http\Uri\UriInterface;
016  use OAuth\Common\Storage\TokenStorageInterface;
017  use OAuth\Common\Token\TokenInterface;
018  use OAuth\OAuth2\Token\StdOAuth2Token;
019   
020  /**
021   * Class EveOnline.
022   */
023  class EveOnline extends AbstractService
024  {
025      public function __construct(
026          CredentialsInterface $credentials,
027          ClientInterface $httpClient,
028          TokenStorageInterface $storage,
029          $scopes = [],
030          ?UriInterface $baseApiUri = null
031      ) {
032          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
033   
034          if (null === $baseApiUri) {
035              $this->baseApiUri = new Uri('https://login.eveonline.com');
036          }
037      }
038   
039      /**
040       * Returns the authorization API endpoint.
041       *
042       * @return UriInterface
043       */
044      public function getAuthorizationEndpoint()
045      {
046          return new Uri($this->baseApiUri . '/oauth/authorize');
047      }
048   
049      /**
050       * Returns the access token API endpoint.
051       *
052       * @return UriInterface
053       */
054      public function getAccessTokenEndpoint()
055      {
056          return new Uri($this->baseApiUri . '/oauth/token');
057      }
058   
059      /**
060       * Parses the access token response and returns a TokenInterface.
061       *
062       * @param string $responseBody
063       *
064       * @return TokenInterface
065       */
066      protected function parseAccessTokenResponse($responseBody)
067      {
068          $data = json_decode($responseBody, true);
069   
070          if (null === $data || !is_array($data)) {
071              throw new TokenResponseException('Unable to parse response.');
072          } elseif (isset($data['error_description'])) {
073              throw new TokenResponseException('Error in retrieving token: "' . $data['error_description'] . '"');
074          } elseif (isset($data['error'])) {
075              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
076          }
077   
078          $token = new StdOAuth2Token();
079          $token->setAccessToken($data['access_token']);
080          $token->setLifeTime($data['expires_in']);
081   
082          if (isset($data['refresh_token'])) {
083              $token->setRefreshToken($data['refresh_token']);
084              unset($data['refresh_token']);
085          }
086   
087          unset($data['access_token'], $data['expires_in']);
088   
089          $token->setExtraParams($data);
090   
091          return $token;
092      }
093   
094      /**
095       * {@inheritdoc}
096       */
097      protected function getAuthorizationMethod()
098      {
099          return static::AUTHORIZATION_METHOD_HEADER_BEARER;
100      }
101  }
102