aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-13 11:19:35 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-14 14:22:42 -0400
commit1e38be3fa95d18d05c303d9c8be5af174dc6d07d (patch)
tree0763f2444eeec1b82e3db303e58fbe67e05fb556
parent65485253c9252340e5ff6556c7d34f40e87f4644 (diff)
downloadforums-1e38be3fa95d18d05c303d9c8be5af174dc6d07d.tar
forums-1e38be3fa95d18d05c303d9c8be5af174dc6d07d.tar.gz
forums-1e38be3fa95d18d05c303d9c8be5af174dc6d07d.tar.bz2
forums-1e38be3fa95d18d05c303d9c8be5af174dc6d07d.tar.xz
forums-1e38be3fa95d18d05c303d9c8be5af174dc6d07d.zip
[feature/oauth] Additional work on implementing login
PHPBB3-11673
-rw-r--r--phpBB/includes/auth/provider/oauth.php35
1 files changed, 18 insertions, 17 deletions
diff --git a/phpBB/includes/auth/provider/oauth.php b/phpBB/includes/auth/provider/oauth.php
index de7903b7a5..2004f87e97 100644
--- a/phpBB/includes/auth/provider/oauth.php
+++ b/phpBB/includes/auth/provider/oauth.php
@@ -46,7 +46,9 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
*/
public function login($username, $password)
{
- if (!$this->request->is_set_post('oauth_service'))
+ // Requst the name of the OAuth service
+ $service = $this->request->variable('oauth_service', '', false, phpbb_request_interface::POST);
+ if ($service === '')
{
return array(
'status' => LOGIN_ERROR_EXTERNAL_AUTH,
@@ -55,19 +57,23 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
);
}
- $serviceFactory = new \OAuth\ServiceFactory();
- $uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
- $currentUri = $uriFactory->createFromSuperGlobalArray((array)$_SERVER);
- $currentUri->setQuery('');
+ // Get the service credentials for the given service
+ $service_credentials = $this->get_credentials($service);
+
+
+ $service_factory = new \OAuth\ServiceFactory();
+ $uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
+ $current_uri = $uri_factory->createFromSuperGlobalArray((array)$_SERVER);
+ $current_uri->setQuery('');
// In-memory storage
$storage = new Memory();
// Setup the credentials for the requests
$credentials = new Credentials(
- $servicesCredentials['github']['key'],
- $servicesCredentials['github']['secret'],
- $currentUri->getAbsoluteUri()
+ $service_credentials['key'],
+ $service_credentials['secret'],
+ $current_uri->getAbsoluteUri()
);
if ($this->request->is_set('code', phpbb_request_interface::GET))
@@ -83,14 +89,9 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
*/
protected function get_service_credentials($service)
{
- return $service_credentials[$service];
- }
-
- /**
- *
- */
- public function get_credentials()
- {
- return array();
+ return array(
+ 'key' => $this->config['auth_oauth_' . $service . '_key'],
+ 'secret' => $this->config['auth_oauth_' . $service . '_secret'],
+ );
}
}