mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[feature/oauth] OAuth init method to minimally validate entered data
PHPBB3-11673
This commit is contained in:
parent
77c3264543
commit
9805927fac
2 changed files with 26 additions and 7 deletions
|
@ -394,6 +394,7 @@ $lang = array_merge($lang, array(
|
|||
|
||||
'AUTH_METHOD' => 'Select an authentication method',
|
||||
|
||||
'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.',
|
||||
'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server.<br />These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.<br />Any service that does not have both a key and a secret entered here will not be available for use by the forum users.',
|
||||
'AUTH_PROVIDER_OAUTH_KEY' => 'Key',
|
||||
'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly',
|
||||
|
|
|
@ -103,6 +103,24 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
|||
$this->service_providers = $service_providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
// This does not test whether or not the key and secret provided are valid.
|
||||
foreach ($this->service_providers as $service_provider)
|
||||
{
|
||||
$credentials = $service_provider->get_service_credentials();
|
||||
|
||||
if (($credentials['key'] && !$credentials['secret']) || (!$credentials['key'] && $credentials['secret']))
|
||||
{
|
||||
return $this->user->lang['AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue