1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 23:11:45 +02:00

[ticket/12352] Use custom provider collection for auth providers

Using this custom provider collection, we can properly check whether the
configured auth provider does exist. The method get_provider() has been added
for returning the default auth provider or the standard db auth provider if
the specified one does not exist.
Additionally, the method get_provider() will throw an RuntimeException if
none of the above exist.

PHPBB3-12352
This commit is contained in:
Marc Alexander
2014-05-31 22:43:07 +02:00
parent 306beab4cb
commit 6f5f0d6d8d
5 changed files with 73 additions and 32 deletions

View File

@@ -408,16 +408,8 @@ class session
$session_expired = false;
// Check whether the session is still valid if we have one
$method = basename(trim($config['auth_method']));
$provider_collection = $phpbb_container->get('auth.provider_collection');
// Revert to db auth provider if selected method does not exist
if (!isset($provider_collection['auth.provider.' . $method]))
{
$method = 'db';
}
$provider = $provider_collection['auth.provider.' . $method];
$provider = $provider_collection->get_provider();
if (!($provider instanceof \phpbb\auth\provider\provider_interface))
{
@@ -584,16 +576,8 @@ class session
}
}
$method = basename(trim($config['auth_method']));
$provider_collection = $phpbb_container->get('auth.provider_collection');
// Revert to db auth provider if selected method does not exist
if (!isset($provider_collection['auth.provider.' . $method]))
{
$method = 'db';
}
$provider = $provider_collection['auth.provider.' . $method];
$provider = $provider_collection->get_provider();
$this->data = $provider->autologin();
if (sizeof($this->data))
@@ -912,9 +896,8 @@ class session
$db->sql_query($sql);
// Allow connecting logout with external auth method logout
$method = basename(trim($config['auth_method']));
$provider = $phpbb_container->get('auth.provider.' . $method);
$provider_collection = $phpbb_container->get('auth.provider_collection');
$provider = $provider_collection->get_provider();
$provider->logout($this->data, $new_session);
if ($this->data['user_id'] != ANONYMOUS)