Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

Google.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 4.15 KiB


01  <?php
02  namespace OAuth\OAuth2\Service;
03   
04  use OAuth\OAuth2\Token\StdOAuth2Token;
05  use OAuth\Common\Http\Exception\TokenResponseException;
06  use OAuth\Common\Http\Uri\Uri;
07   
08  class Google extends AbstractService
09  {
10      /**
11       * Defined scopes -- Google has way too many Application Programming Interfaces
12       */
13      const SCOPE_ADSENSE = 'https://www.googleapis.com/auth/adsense';
14      const SCOPE_GAN = 'https://www.googleapis.com/auth/gan'; // google affiliate network...?
15      const SCOPE_ANALYTICS = 'https://www.googleapis.com/auth/analytics.readonly';
16      const SCOPE_BOOKS = 'https://www.googleapis.com/auth/books';
17      const SCOPE_BLOGGER = 'https://www.googleapis.com/auth/blogger';
18      const SCOPE_CALENDAR = 'https://www.googleapis.com/auth/calendar';
19      const SCOPE_CLOUDSTORAGE = 'https://www.googleapis.com/auth/devstorage.read_write';
20      const SCOPE_CONTACT = 'https://www.google.com/m8/feeds/';
21      const SCOPE_CONTENTFORSHOPPING = 'https://www.googleapis.com/auth/structuredcontent'; // what even is this
22      const SCOPE_CHROMEWEBSTORE = 'https://www.googleapis.com/auth/chromewebstore.readonly';
23      const SCOPE_DOCUMENTSLIST = 'https://docs.google.com/feeds/';
24      const SCOPE_GOOGLEDRIVE = 'https://www.googleapis.com/auth/drive';
25      const SCOPE_GOOGLEDRIVE_FILES = 'https://www.googleapis.com/auth/drive.file';
26      const SCOPE_GMAIL = 'https://mail.google.com/mail/feed/atom';
27      const SCOPE_GPLUS_ME = 'https://www.googleapis.com/auth/plus.me';
28      const SCOPE_GPLUS_LOGIN = 'https://www.googleapis.com/auth/plus.login';
29      const SCOPE_GROUPS_PROVISIONING = 'https://apps-apis.google.com/a/feeds/groups/';
30      const SCOPE_GOOGLELATITUDE = 'https://www.googleapis.com/auth/latitude.all.best https://www.googleapis.com/auth/latitude.all.city'; // creepy stalker api...
31      const SCOPE_MODERATOR = 'https://www.googleapis.com/auth/moderator';
32      const SCOPE_NICKNAME_PROVISIONING = 'https://apps-apis.google.com/a/feeds/alias/';
33      const SCOPE_ORKUT = 'https://www.googleapis.com/auth/orkut'; // evidently orkut still exists. who knew?
34      const SCOPE_PICASAWEB = 'https://picasaweb.google.com/data/';
35      const SCOPE_SITES = 'https://sites.google.com/feeds/';
36      const SCOPE_SPREADSHEETS = 'https://spreadsheets.google.com/feeds/';
37      const SCOPE_TASKS = 'https://www.googleapis.com/auth/tasks';
38      const SCOPE_URLSHORTENER = 'https://www.googleapis.com/auth/urlshortener';
39      const SCOPE_USERINFO_EMAIL = 'https://www.googleapis.com/auth/userinfo.email';
40      const SCOPE_USERINFO_PROFILE = 'https://www.googleapis.com/auth/userinfo.profile';
41      const SCOPE_USER_PROVISIONING = 'https://apps-apis.google.com/a/feeds/user/';
42      const SCOPE_WEBMASTERTOOLS = 'https://www.google.com/webmasters/tools/feeds/';
43      const SCOPE_YOUTUBE = 'https://gdata.youtube.com';
44   
45      /**
46       * @return \OAuth\Common\Http\Uri\UriInterface
47       */
48      public function getAuthorizationEndpoint()
49      {
50          return new Uri('https://accounts.google.com/o/oauth2/auth');
51      }
52   
53      /**
54       * @return \OAuth\Common\Http\Uri\UriInterface
55       */
56      public function getAccessTokenEndpoint()
57      {
58          return new Uri('https://accounts.google.com/o/oauth2/token');
59      }
60   
61      /**
62       * @param string $responseBody
63       * @return \OAuth\Common\Token\TokenInterface|\OAuth\OAuth2\Token\StdOAuth2Token
64       * @throws \OAuth\Common\Http\Exception\TokenResponseException
65       */
66      protected function parseAccessTokenResponse($responseBody)
67      {
68          $data = json_decode( $responseBody, true );
69   
70          if( null === $data || !is_array($data) ) {
71              throw new TokenResponseException('Unable to parse response.');
72          } elseif( isset($data['error'] ) ) {
73              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
74          }
75   
76          $token = new StdOAuth2Token();
77          $token->setAccessToken( $data['access_token'] );
78          $token->setLifetime( $data['expires_in'] );
79   
80          if( isset($data['refresh_token'] ) ) {
81              $token->setRefreshToken( $data['refresh_token'] );
82              unset($data['refresh_token']);
83          }
84   
85          unset( $data['access_token'] );
86          unset( $data['expires_in'] );
87   
88          $token->setExtraParams( $data );
89   
90          return $token;
91      }
92  }
93