Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

Microsoft.php

Zuletzt modifiziert: 09.10.2024, 12:59 - Dateigröße: 4.00 KiB


001  <?php
002   
003  namespace OAuth\OAuth2\Service;
004   
005  use OAuth\OAuth2\Token\StdOAuth2Token;
006  use OAuth\Common\Http\Exception\TokenResponseException;
007  use OAuth\Common\Http\Uri\Uri;
008  use OAuth\Common\Consumer\CredentialsInterface;
009  use OAuth\Common\Http\Client\ClientInterface;
010  use OAuth\Common\Storage\TokenStorageInterface;
011  use OAuth\Common\Http\Uri\UriInterface;
012   
013  class Microsoft extends AbstractService
014  {
015      const SCOPE_BASIC = 'wl.basic';
016      const SCOPE_OFFLINE = 'wl.offline_access';
017      const SCOPE_SIGNIN = 'wl.signin';
018      const SCOPE_BIRTHDAY = 'wl.birthday';
019      const SCOPE_CALENDARS = 'wl.calendars';
020      const SCOPE_CALENDARS_UPDATE = 'wl.calendars_update';
021      const SCOPE_CONTACTS_BIRTHDAY = 'wl.contacts_birthday';
022      const SCOPE_CONTACTS_CREATE = 'wl.contacts_create';
023      const SCOPE_CONTACTS_CALENDARS = 'wl.contacts_calendars';
024      const SCOPE_CONTACTS_PHOTOS = 'wl.contacts_photos';
025      const SCOPE_CONTACTS_SKYDRIVE = 'wl.contacts_skydrive';
026      const SCOPE_EMAILS = 'wl.emails';
027      const SCOPE_EVENTS_CREATE = 'wl.events_create';
028      const SCOPE_MESSENGER = 'wl.messenger';
029      const SCOPE_PHONE_NUMBERS = 'wl.phone_numbers';
030      const SCOPE_PHOTOS = 'wl.photos';
031      const SCOPE_POSTAL_ADDRESSES = 'wl.postal_addresses';
032      const SCOPE_SHARE = 'wl.share';
033      const SCOPE_SKYDRIVE = 'wl.skydrive';
034      const SCOPE_SKYDRIVE_UPDATE = 'wl.skydrive_update';
035      const SCOPE_WORK_PROFILE = 'wl.work_profile';
036      const SCOPE_APPLICATIONS = 'wl.applications';
037      const SCOPE_APPLICATIONS_CREATE = 'wl.applications_create';
038      const SCOPE_IMAP = 'wl.imap';
039   
040      /**
041       * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses.
042       * They agree that giving 3rd party apps access to 3rd party emailaddresses is a pretty lame thing to do so in all
043       * their wisdom they added this scope because fuck you that's why.
044       *
045       * https://github.com/Lusitanian/PHPoAuthLib/issues/214
046       * http://social.msdn.microsoft.com/Forums/live/en-US/c6dcb9ab-aed4-400a-99fb-5650c393a95d/how-retrieve-users-
047       *                                  contacts-email-address?forum=messengerconnect
048       *
049       * Considering this scope is not officially supported: use with care
050       */
051      const SCOPE_CONTACTS_EMAILS = 'wl.contacts_emails';
052   
053      public function __construct(
054          CredentialsInterface $credentials,
055          ClientInterface $httpClient,
056          TokenStorageInterface $storage,
057          $scopes = array(),
058          UriInterface $baseApiUri = null
059      ) {
060          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
061   
062          if (null === $baseApiUri) {
063              $this->baseApiUri = new Uri('https://apis.live.net/v5.0/');
064          }
065      }
066   
067      /**
068       * {@inheritdoc}
069       */
070      public function getAuthorizationEndpoint()
071      {
072          return new Uri('https://login.live.com/oauth20_authorize.srf');
073      }
074   
075      /**
076       * {@inheritdoc}
077       */
078      public function getAccessTokenEndpoint()
079      {
080          return new Uri('https://login.live.com/oauth20_token.srf');
081      }
082   
083      /**
084       * {@inheritdoc}
085       */
086      public function getAuthorizationMethod()
087      {
088          return static::AUTHORIZATION_METHOD_QUERY_STRING;
089      }
090   
091      /**
092       * {@inheritdoc}
093       */
094      protected function parseAccessTokenResponse($responseBody)
095      {
096          $data = json_decode($responseBody, true);
097   
098          if (null === $data || !is_array($data)) {
099              throw new TokenResponseException('Unable to parse response.');
100          } elseif (isset($data['error'])) {
101              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
102          }
103   
104          $token = new StdOAuth2Token();
105          $token->setAccessToken($data['access_token']);
106          $token->setLifetime($data['expires_in']);
107   
108          if (isset($data['refresh_token'])) {
109              $token->setRefreshToken($data['refresh_token']);
110              unset($data['refresh_token']);
111          }
112   
113          unset($data['access_token']);
114          unset($data['expires_in']);
115   
116          $token->setExtraParams($data);
117   
118          return $token;
119      }
120  }
121