aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider/oauth
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php2
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/bitly.php18
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/facebook.php18
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/google.php2
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/interface.php9
5 files changed, 47 insertions, 2 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 6526667794..4266a8de0d 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -398,7 +398,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$this->service_providers[$service_name]->set_external_service_provider($service);
// The user has already authenticated successfully, request to authenticate again
- $unique_id = $this->service_providers[$service_name]->perform_auth_link();
+ $unique_id = $this->service_providers[$service_name]->perform_token_auth();
// Insert into table, they will be able to log in after this
$data = array(
diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php
index b6b99c0850..9b8e7ebb03 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php
@@ -79,4 +79,22 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_
// Return the unique identifier returned from bitly
return $result['data']['login'];
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_token_auth()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
+ {
+ // TODO: make exception class and use language constant
+ throw new Exception('Invalid service provider type');
+ }
+
+ // Send a request with it
+ $result = json_decode( $this->service_provider->request('user/info'), true );
+
+ // Return the unique identifier returned from bitly
+ return $result['data']['login'];
+ }
}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php
index 4758ae11f8..16919081cc 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/facebook.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php
@@ -79,4 +79,22 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
// Return the unique identifier returned from bitly
return $result['id'];
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_token_auth()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
+ {
+ // TODO: make exception class and use language constant
+ throw new Exception('Invalid service provider type');
+ }
+
+ // Send a request with it
+ $result = json_decode( $this->service_provider->request('/me'), true );
+
+ // Return the unique identifier returned from bitly
+ return $result['id'];
+ }
}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php
index c5de1e01d2..b49a833cce 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/google.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/google.php
@@ -94,7 +94,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
/**
* {@inheritdoc}
*/
- public function perform_auth_link()
+ public function perform_token_auth()
{
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
{
diff --git a/phpBB/phpbb/auth/provider/oauth/service/interface.php b/phpBB/phpbb/auth/provider/oauth/service/interface.php
index a69148695d..0d6ae7417f 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/interface.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/interface.php
@@ -58,6 +58,15 @@ interface phpbb_auth_provider_oauth_service_interface
public function perform_auth_login();
/**
+ * Returns the results of the authentication in json format
+ * Use this function when the user already has an access token
+ *
+ * @return string The unique identifier returned by the service provider
+ * that is used to authenticate the user with phpBB.
+ */
+ public function perform_token_auth();
+
+ /**
* Sets the external library service provider
*
* @param \OAuth\Common\Service\ServiceInterface $service