mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[feature/oauth] Start implementing login
PHPBB3-11673
This commit is contained in:
parent
232a8c6740
commit
65485253c9
1 changed files with 48 additions and 0 deletions
|
@ -15,6 +15,9 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use OAuth\Common\Consumer\Credentials;
|
||||||
|
use OAuth\Common\Http\Uri\Uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth authentication provider for phpBB3
|
* OAuth authentication provider for phpBB3
|
||||||
*
|
*
|
||||||
|
@ -43,6 +46,51 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
*/
|
*/
|
||||||
public function login($username, $password)
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue