1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[ticket/13248] Allow specifying different auth provider in provider collection

PHPBB3-13248
This commit is contained in:
Marc Alexander 2014-10-30 14:24:33 +01:00
parent 6b057e026c
commit c3f5dc75be

View File

@ -38,6 +38,7 @@ class provider_collection extends \phpbb\di\service_collection
/**
* Get an auth provider.
*
* @param string $provider_name The name of the auth provider
* @return object Default auth provider selected in config if it
* does exist. Otherwise the standard db auth
* provider.
@ -46,11 +47,12 @@ class provider_collection extends \phpbb\di\service_collection
* auth provider exist. The db auth provider
* should always exist in a phpBB installation.
*/
public function get_provider()
public function get_provider($provider_name = '')
{
if ($this->offsetExists('auth.provider.' . basename(trim($this->config['auth_method']))))
$provider_name = ($provider_name !== '') ?: basename(trim($this->config['auth_method']));
if ($this->offsetExists('auth.provider.' . $provider_name))
{
return $this->offsetGet('auth.provider.' . basename(trim($this->config['auth_method'])));
return $this->offsetGet('auth.provider.' . $provider_name);
}
// Revert to db auth provider if selected method does not exist
else if ($this->offsetExists('auth.provider.db'))