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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Microsoft.php
001 <?php
002 namespace OAuth\OAuth2\Service;
003
004 use OAuth\OAuth2\Token\StdOAuth2Token;
005 use OAuth\Common\Http\Exception\TokenResponseException;
006 use OAuth\Common\Http\Uri\Uri;
007 use OAuth\Common\Consumer\Credentials;
008 use OAuth\Common\Http\Client\ClientInterface;
009 use OAuth\Common\Storage\TokenStorageInterface;
010 use OAuth\Common\Http\Uri\UriInterface;
011
012 class Microsoft extends AbstractService
013 {
014 const SCOPE_BASIC = 'wl.basic';
015 const SCOPE_OFFLINE = 'wl.offline_access';
016 const SCOPE_SIGNIN = 'wl.signin';
017 const SCOPE_BIRTHDAY = 'wl.birthday';
018 const SCOPE_CALENDARS = 'wl.calendars';
019 const SCOPE_CALENDARS_UPDATE = 'wl.calendars_update';
020 const SCOPE_CONTACTS_BIRTHDAY = 'wl.contacts_birthday';
021 const SCOPE_CONTACTS_CREATE = 'wl.contacts_create';
022 const SCOPE_CONTACTS_CALENDARS = 'wl.contacts_calendars';
023 const SCOPE_CONTACTS_PHOTOS = 'wl.contacts_photos';
024 const SCOPE_CONTACTS_SKYDRIVE = 'wl.contacts_skydrive';
025 const SCOPE_EMAILS = 'wl.emails';
026 const sCOPE_EVENTS_CREATE = 'wl.events_create';
027 const SCOPE_MESSENGER = 'wl.messenger';
028 const SCOPE_PHONE_NUMBERS = 'wl.phone_numbers';
029 const SCOPE_PHOTOS = 'wl.photos';
030 const SCOPE_POSTAL_ADDRESSES = 'wl.postal_addresses';
031 const SCOPE_SHARE = 'wl.share';
032 const SCOPE_SKYDRIVE = 'wl.skydrive';
033 const SCOPE_SKYDRIVE_UPDATE = 'wl.skydrive_update';
034 const SCOPE_WORK_PROFILE = 'wl.work_profile';
035 const SCOPE_APPLICATIONS = 'wl.applications';
036 const SCOPE_APPLICATIONS_CREATE = 'wl.applications_create';
037
038 public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
039 {
040 parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
041 if( null === $baseApiUri ) {
042 $this->baseApiUri = new Uri('https://apis.live.net/v5.0/');
043 }
044 }
045
046 /**
047 * @return \OAuth\Common\Http\Uri\UriInterface
048 */
049 public function getAuthorizationEndpoint()
050 {
051 return new Uri('https://login.live.com/oauth20_authorize.srf');
052 }
053
054 /**
055 * @return \OAuth\Common\Http\Uri\UriInterface
056 */
057 public function getAccessTokenEndpoint()
058 {
059 return new Uri('https://login.live.com/oauth20_token.srf');
060 }
061
062 /**
063 * @param string $responseBody
064 * @return \OAuth\Common\Token\TokenInterface|\OAuth\OAuth2\Token\StdOAuth2Token
065 * @throws \OAuth\Common\Http\Exception\TokenResponseException
066 */
067 protected function parseAccessTokenResponse($responseBody)
068 {
069 $data = json_decode( $responseBody, true );
070
071 if( null === $data || !is_array($data) ) {
072 throw new TokenResponseException('Unable to parse response.');
073 } elseif( isset($data['error'] ) ) {
074 throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
075 }
076
077 $token = new StdOAuth2Token();
078 $token->setAccessToken( $data['access_token'] );
079 $token->setLifetime( $data['expires_in'] );
080
081 if( isset($data['refresh_token'] ) ) {
082 $token->setRefreshToken( $data['refresh_token'] );
083 unset($data['refresh_token']);
084 }
085
086 unset( $data['access_token'] );
087 unset( $data['expires_in'] );
088
089 $token->setExtraParams( $data );
090
091 return $token;
092 }
093
094 /**
095 * @return int
096 */
097 public function getAuthorizationMethod()
098 {
099 return static::AUTHORIZATION_METHOD_QUERY_STRING;
100 }
101 }
102