1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 08:17:47 +02:00

[feature/oauth] Continue work on OAuth login

PHPBB3-11673
This commit is contained in:
Joseph Warner
2013-07-13 13:08:37 -04:00
parent 2e899c24f9
commit 93f7ed4fb5
2 changed files with 45 additions and 7 deletions

View File

@@ -42,5 +42,6 @@ services:
- @config - @config
- @request - @request
- @user - @user
- @cache.driver
tags: tags:
- { name: auth.provider } - { name: auth.provider }

View File

@@ -25,6 +25,41 @@ use OAuth\Common\Http\Uri\Uri;
*/ */
class phpbb_auth_provider_oauth extends phpbb_auth_provider_base class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
{ {
/**
* Database driver
*
* @var phpbb_db_driver
*/
protected $db;
/**
* phpBB config
*
* @var phpbb_config
*/
protected $config;
/**
* phpBB request object
*
* @var phpbb_request
*/
protected $request;
/**
* phpBB user
*
* @var phpbb_user
*/
protected $user;
/**
* Cache driver.
*
* @var phpbb_cache_driver_interface
*/
protected $driver;
/** /**
* OAuth Authentication Constructor * OAuth Authentication Constructor
* *
@@ -32,13 +67,15 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
* @param phpbb_config $config * @param phpbb_config $config
* @param phpbb_request $request * @param phpbb_request $request
* @param phpbb_user $user * @param phpbb_user $user
* @param phpbb_cache_driver_interface $driver
*/ */
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user) public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, phpbb_cache_driver_interface $driver)
{ {
$this->db = $db; $this->db = $db;
$this->config = $config; $this->config = $config;
$this->request = $request; $this->request = $request;
$this->user = $user; $this->user = $user;
$this->driver = $driver;
} }
/** /**
@@ -72,11 +109,11 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$service_factory = new \OAuth\ServiceFactory(); $service_factory = new \OAuth\ServiceFactory();
$uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); $uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
$current_uri = $uri_factory->createFromSuperGlobalArray((array)$_SERVER); $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(phpbb_request_interface::SERVER));
$current_uri->setQuery(''); $current_uri->setQuery('');
// In-memory storage // In-memory storage
$storage = new Memory(); $storage = new phpbb_auth_oauth_token_storage($this->driver);
// Setup the credentials for the requests // Setup the credentials for the requests
$credentials = new Credentials( $credentials = new Credentials(