aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-29 15:07:24 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-29 15:07:55 -0400
commit641433920e43478a021743557f69382292f60f68 (patch)
tree2fb00b680abdc23971acbc8c80979b1fdb77084d /phpBB
parent17d774af8ed8895c0f9b77d57c218f0d01d761e3 (diff)
downloadforums-641433920e43478a021743557f69382292f60f68.tar
forums-641433920e43478a021743557f69382292f60f68.tar.gz
forums-641433920e43478a021743557f69382292f60f68.tar.bz2
forums-641433920e43478a021743557f69382292f60f68.tar.xz
forums-641433920e43478a021743557f69382292f60f68.zip
[feature/oauth] Worked in at least one test
PHPBB3-11673
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 0bcbcda74e..56655fdfd9 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -177,8 +177,8 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
'error_msg' => 'LOGIN_OAUTH_ACCOUNT_NOT_LINKED',
'user_row' => array(),
'redirect_data' => array(
- 'auth_provider' => 'oauth',
- 'oauth_service' => $service_name_original,
+ 'auth_provider' => 'oauth',
+ 'login_link_oauth_service' => $service_name_original,
),
);
}
@@ -384,11 +384,30 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $service_name, $this->auth_provider_oauth_token_storage_table);
// Check for an access token, they should have one
- if (!$storage->has_access_token_by_sesion())
+ if (!$storage->has_access_token_by_session())
{
return 'LOGIN_LINK_ERROR_OAUTH_NO_ACCESS_TOKEN';
}
- $token = $storage->retrieve_access_token_by_session();
+ // Prepare for an authentication request
+ $this->get_current_uri(strtolower($link_data['oauth_service']));
+ $this->current_uri->setQuery('mode=login_link&login_link_oauth_service=' . $service_name);
+ $service_credentials = $this->service_providers[$service_name]->get_service_credentials();
+ $scopes = $this->service_providers[$service_name]->get_auth_scope();
+ $service = $this->get_service($service_name, $storage, $service_credentials, $scopes);
+ $this->service_providers[$service_name]->set_external_service_provider($service);
+
+ // The user has already authenticated successfully, request to authenticate again
+ $unique_id = $this->service_providers[$service_name]->perform_auth_login();
+
+ // Insert into table, they will be able to log in after this
+ $data = array(
+ 'user_id' => $this->user->data['user_id'],
+ 'provider' => strtolower($link_data['oauth_service']),
+ 'oauth_provider_id' => $unique_id,
+ );
+ $sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . '
+ ' . $this->db->sql_build_array('INSERT', $data);
+ $this->db->sql_query($sql);
}
}