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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Yahoo.php
01 <?php
02
03 namespace OAuth\OAuth2\Service;
04
05 use OAuth\OAuth2\Token\StdOAuth2Token;
06 use OAuth\Common\Http\Exception\TokenResponseException;
07 use OAuth\Common\Http\Uri\Uri;
08
09 class Yahoo extends AbstractService
10 {
11
12 /**
13 * {@inheritdoc}
14 */
15 public function getAuthorizationEndpoint()
16 {
17 return new Uri('https://api.login.yahoo.com/oauth2/request_auth');
18 }
19
20 /**
21 * {@inheritdoc}
22 */
23 public function getAccessTokenEndpoint()
24 {
25 return new Uri('https://api.login.yahoo.com/oauth2/get_token');
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 protected function getAuthorizationMethod()
32 {
33 return static::AUTHORIZATION_METHOD_HEADER_BEARER;
34 }
35
36 /**
37 * {@inheritdoc}
38 */
39 protected function parseAccessTokenResponse($responseBody)
40 {
41 $data = json_decode($responseBody, true);
42
43 if (null === $data || !is_array($data)) {
44 throw new TokenResponseException('Unable to parse response.');
45 } elseif (isset($data['error'])) {
46 throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
47 }
48
49 $token = new StdOAuth2Token();
50 $token->setAccessToken($data['access_token']);
51 $token->setLifetime($data['expires_in']);
52
53 if (isset($data['refresh_token'])) {
54 $token->setRefreshToken($data['refresh_token']);
55 unset($data['refresh_token']);
56 }
57
58 unset($data['access_token']);
59 unset($data['expires_in']);
60
61 $token->setExtraParams($data);
62
63 return $token;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 protected function getExtraOAuthHeaders()
70 {
71 $encodedCredentials = base64_encode(
72 $this->credentials->getConsumerId() . ':' . $this->credentials->getConsumerSecret()
73 );
74 return array('Authorization' => 'Basic ' . $encodedCredentials);
75 }
76 }
77