[feature/oauth] Start implementing login

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-13 11:07:42 -04:00
parent 232a8c6740
commit 65485253c9

View file

@ -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();
}
}