aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-15 15:21:20 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-15 15:24:48 -0400
commit47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3 (patch)
tree137298ce3964ec0160c23950daaa3f5f3323d914
parent8641127da5dd71d4f8fc7acc6ca0b2a34a4ede56 (diff)
downloadforums-47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3.tar
forums-47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3.tar.gz
forums-47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3.tar.bz2
forums-47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3.tar.xz
forums-47b998ae486ebe9c0f9df5be4e3d836b31f2c7a3.zip
[feature/oauth] Define method to perform login actions for a provider
PHPB3-11673
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php11
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/base.php23
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/interface.php14
3 files changed, 39 insertions, 9 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 9ee689172c..fc6fce3db0 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -128,15 +128,8 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
if ($this->request->is_set('code', phpbb_request_interface::GET))
{
- // This was a callback request from the service provider
- $service->requestAccessToken( $_GET['code'] );
-
- // Send a request with it
- $path = $this->get_path($service_name);
- if ($path)
- {
- $result = json_decode( $service->request($path), true );
- }
+ $this->services[$service_name]->set_external_service_provider($service);
+ $result = $this->services[$service_name]->perform_auth_login();
// Perform authentication
} else {
diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php
index 98a1fa16e4..d59199f987 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/base.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/base.php
@@ -23,10 +23,33 @@ if (!defined('IN_PHPBB'))
abstract class phpbb_auth_provider_oauth_service_base implements phpbb_auth_provider_oauth_service_interface
{
/**
+ * External OAuth service provider
+ *
+ * @var \OAuth\Common\Service\ServiceInterface
+ */
+ protected $service_provider;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_external_service_provider()
+ {
+ return $this->service_provider;
+ }
+
+ /**
* {@inheritdoc}
*/
public function get_auth_scope()
{
return array();
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider)
+ {
+ $this->service_provider = $service;
+ }
}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/interface.php b/phpBB/phpbb/auth/provider/oauth/service/interface.php
index 80f2ee7259..5893bc1740 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/interface.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/interface.php
@@ -30,6 +30,13 @@ interface phpbb_auth_provider_oauth_service_interface
public function get_auth_scope();
/**
+ * Returns the external library service provider once it has been set
+ *
+ * @param \OAuth\Common\Service\ServiceInterface|null
+ */
+ public function get_external_service_provider();
+
+ /**
* Returns an array containing the service credentials belonging to requested
* service.
*
@@ -41,4 +48,11 @@ interface phpbb_auth_provider_oauth_service_interface
* )
*/
public function get_service_credentials();
+
+ /**
+ * Sets the external library service provider
+ *
+ * @param \OAuth\Common\Service\ServiceInterface $service
+ */
+ public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider);
}