aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/auth/provider/oauth.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/phpBB/includes/auth/provider/oauth.php b/phpBB/includes/auth/provider/oauth.php
index 1fecf490c8..de7903b7a5 100644
--- a/phpBB/includes/auth/provider/oauth.php
+++ b/phpBB/includes/auth/provider/oauth.php
@@ -15,6 +15,9 @@ if (!defined('IN_PHPBB'))
exit;
}
+use OAuth\Common\Consumer\Credentials;
+use OAuth\Common\Http\Uri\Uri;
+
/**
* OAuth authentication provider for phpBB3
*
@@ -43,6 +46,51 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
*/
public function login($username, $password)
{
+ if (!$this->request->is_set_post('oauth_service'))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $serviceFactory = new \OAuth\ServiceFactory();
+ $uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
+ $currentUri = $uriFactory->createFromSuperGlobalArray((array)$_SERVER);
+ $currentUri->setQuery('');
+
+ // In-memory storage
+ $storage = new Memory();
+
+ // Setup the credentials for the requests
+ $credentials = new Credentials(
+ $servicesCredentials['github']['key'],
+ $servicesCredentials['github']['secret'],
+ $currentUri->getAbsoluteUri()
+ );
+
+ if ($this->request->is_set('code', phpbb_request_interface::GET))
+ {
+ // Second pass: request access token, authenticate with phpBB
+ } else {
+ // First pass: get authorization uri, redirect to service
+ }
+ }
+
+ /**
+ *
+ */
+ protected function get_service_credentials($service)
+ {
+ return $service_credentials[$service];
+ }
+ /**
+ *
+ */
+ public function get_credentials()
+ {
+ return array();
}
}