diff options
author | Marc Alexander <admin@m-a-styles.de> | 2016-07-20 20:25:01 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-07-20 20:25:01 +0200 |
commit | 486ffa85a25ffb5415915c83c9cba81a4df2b528 (patch) | |
tree | 1e199082822c284c5aa3114cf0d549f5ee38b6aa /phpBB/phpbb/auth/provider/oauth/oauth.php | |
parent | d2ff12256c8505ea9aea0ead1db44016bb082864 (diff) | |
parent | 33d1d19f9775242a260adbb33b0bfa4b5324dedf (diff) | |
download | forums-486ffa85a25ffb5415915c83c9cba81a4df2b528.tar forums-486ffa85a25ffb5415915c83c9cba81a4df2b528.tar.gz forums-486ffa85a25ffb5415915c83c9cba81a4df2b528.tar.bz2 forums-486ffa85a25ffb5415915c83c9cba81a4df2b528.tar.xz forums-486ffa85a25ffb5415915c83c9cba81a4df2b528.zip |
Merge pull request #4344 from Senky/ticket2/14586
[ticket/14586] Add OAuth1 support
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth/oauth.php')
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/oauth.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index dd7736db4e..04729d8453 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -201,7 +201,8 @@ class oauth extends \phpbb\auth\provider\base $query = 'mode=login&login=external&oauth_service=' . $service_name_original; $service = $this->get_service($service_name_original, $storage, $service_credentials, $query, $this->service_providers[$service_name]->get_auth_scope()); - if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) + if (($service::OAUTH_VERSION === 2 && $this->request->is_set('code', \phpbb\request\request_interface::GET)) + || ($service::OAUTH_VERSION === 1 && $this->request->is_set('oauth_token', \phpbb\request\request_interface::GET))) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -256,7 +257,15 @@ class oauth extends \phpbb\auth\provider\base } else { - $url = $service->getAuthorizationUri(); + if ($service::OAUTH_VERSION === 1) + { + $token = $service->requestRequestToken(); + $url = $service->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); + } + else + { + $url = $service->getAuthorizationUri(); + } header('Location: ' . $url); } } @@ -520,7 +529,8 @@ class oauth extends \phpbb\auth\provider\base $scopes = $this->service_providers[$service_name]->get_auth_scope(); $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $query, $scopes); - if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) + if (($service::OAUTH_VERSION === 2 && $this->request->is_set('code', \phpbb\request\request_interface::GET)) + || ($service::OAUTH_VERSION === 1 && $this->request->is_set('oauth_token', \phpbb\request\request_interface::GET))) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -536,7 +546,15 @@ class oauth extends \phpbb\auth\provider\base } else { - $url = $service->getAuthorizationUri(); + if ($service::OAUTH_VERSION === 1) + { + $token = $service->requestRequestToken(); + $url = $service->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); + } + else + { + $url = $service->getAuthorizationUri(); + } header('Location: ' . $url); } } |