From 6b057e026cfb9603c6260d619e0a37e3679aa0d5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 30 Oct 2014 13:58:09 +0100 Subject: [ticket/13248] Use auth provider collection for getting provider PHPBB3-13248 --- phpBB/phpbb/auth/auth.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 38755ccf99..b59f0e60ec 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -927,11 +927,11 @@ class auth */ function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) { - global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; - $method = trim(basename($config['auth_method'])); + $provider_collection = $phpbb_container->get('auth.provider_collection'); - $provider = $phpbb_container->get('auth.provider.' . $method); + $provider = $provider_collection->get_provider(); if ($provider) { $login = $provider->login($username, $password); -- cgit v1.2.1 From c3f5dc75bed689956b7d4ed1e5b7e0d2c80257c9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 30 Oct 2014 14:24:33 +0100 Subject: [ticket/13248] Allow specifying different auth provider in provider collection PHPBB3-13248 --- phpBB/phpbb/auth/provider_collection.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider_collection.php b/phpBB/phpbb/auth/provider_collection.php index a74a2135dc..bf724419b7 100644 --- a/phpBB/phpbb/auth/provider_collection.php +++ b/phpBB/phpbb/auth/provider_collection.php @@ -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')) -- cgit v1.2.1 From d9c868d0f5f9c2c097e3fded0ac6882c2f2ff988 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 30 Oct 2014 16:54:43 +0100 Subject: [ticket/13248] Correctly pass provider name PHPBB3-13248 --- phpBB/phpbb/auth/provider_collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider_collection.php b/phpBB/phpbb/auth/provider_collection.php index bf724419b7..8e7e9e2cc1 100644 --- a/phpBB/phpbb/auth/provider_collection.php +++ b/phpBB/phpbb/auth/provider_collection.php @@ -49,7 +49,7 @@ class provider_collection extends \phpbb\di\service_collection */ public function get_provider($provider_name = '') { - $provider_name = ($provider_name !== '') ?: basename(trim($this->config['auth_method'])); + $provider_name = ($provider_name !== '') ? $provider_name : basename(trim($this->config['auth_method'])); if ($this->offsetExists('auth.provider.' . $provider_name)) { return $this->offsetGet('auth.provider.' . $provider_name); -- cgit v1.2.1