aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider/oauth/token_storage.php
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-09-02 15:32:42 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-09-02 16:04:35 -0400
commit4348fd83501a56338c1584d96da91b1d6945b93b (patch)
treef35329492ca89251ccbd3b3600e2853adacc5b7b /phpBB/phpbb/auth/provider/oauth/token_storage.php
parenta2be0aab5f21ee7efe7d765b08853231a38fcf72 (diff)
downloadforums-4348fd83501a56338c1584d96da91b1d6945b93b.tar
forums-4348fd83501a56338c1584d96da91b1d6945b93b.tar.gz
forums-4348fd83501a56338c1584d96da91b1d6945b93b.tar.bz2
forums-4348fd83501a56338c1584d96da91b1d6945b93b.tar.xz
forums-4348fd83501a56338c1584d96da91b1d6945b93b.zip
[feature/oauth] Make token storage service ignorant
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth/token_storage.php')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php31
1 files changed, 11 insertions, 20 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
index 96f2e2fb0a..15f491c9dc 100644
--- a/phpBB/phpbb/auth/provider/oauth/token_storage.php
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -44,13 +44,6 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
protected $user;
/**
- * Name of the OAuth provider
- *
- * @var string
- */
- protected $service_name;
-
- /**
* OAuth token table
*
* @var string
@@ -67,21 +60,19 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*
* @param phpbb_db_driver $db
* @param phpbb_user $user
- * @param string $service_name
* @param string $auth_provider_oauth_table
*/
- public function __construct(phpbb_db_driver $db, phpbb_user $user, $service_name, $auth_provider_oauth_table)
+ public function __construct(phpbb_db_driver $db, phpbb_user $user, $auth_provider_oauth_table)
{
$this->db = $db;
$this->user = $user;
- $this->service_name = $service_name;
$this->auth_provider_oauth_table = $auth_provider_oauth_table;
}
/**
* {@inheritdoc}
*/
- public function retrieveAccessToken()
+ public function retrieveAccessToken($service)
{
if ($this->cachedToken instanceOf TokenInterface)
{
@@ -90,7 +81,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
$data = array(
'user_id' => $this->user->data['user_id'],
- 'provider' => $this->service_name,
+ 'provider' => $service,
);
if ($this->user->data['user_id'] === ANONYMOUS)
@@ -104,13 +95,13 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
/**
* {@inheritdoc}
*/
- public function storeAccessToken(TokenInterface $token)
+ public function storeAccessToken($service, TokenInterface $token)
{
$this->cachedToken = $token;
$data = array(
'user_id' => $this->user->data['user_id'],
- 'provider' => $this->service_name,
+ 'provider' => $service,
'oauth_token' => $this->json_encode_token($token),
'session_id' => $this->user->data['session_id'],
);
@@ -123,7 +114,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
/**
* {@inheritdoc}
*/
- public function hasAccessToken()
+ public function hasAccessToken($service)
{
if ($this->cachedToken) {
return true;
@@ -131,7 +122,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
$data = array(
'user_id' => $this->user->data['user_id'],
- 'provider' => $this->service_name,
+ 'provider' => $service,
);
if ($this->user->data['user_id'] === ANONYMOUS)
@@ -205,7 +196,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*
* @return bool true if they have token, false if they don't
*/
- public function has_access_token_by_session()
+ public function has_access_token_by_session($service)
{
if ($this->cachedToken)
{
@@ -214,7 +205,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
$data = array(
'session_id' => $this->user->data['session_id'],
- 'provider' => $this->service_name,
+ 'provider' => $service,
);
return $this->_has_acess_token($data);
@@ -231,7 +222,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
return (bool) $this->get_access_token_row($data);
}
- public function retrieve_access_token_by_session()
+ public function retrieve_access_token_by_session($service)
{
if ($this->cachedToken instanceOf TokenInterface) {
return $this->cachedToken;
@@ -239,7 +230,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
$data = array(
'session_id' => $this->user->data['session_id'],
- 'provider' => $this->service_name,
+ 'provider' => $service,
);
return $this->_retrieve_access_token($data);