From db73d324deda52ee04dd442fbde73f6abc1839db Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 12 Jun 2014 17:05:54 +0200 Subject: [PATCH] Autologin: Fix that the backend name must have been `autologin' Before, the code validated the name of the backend instead of the `backend' directive against `autologin'. --- library/Icinga/Authentication/UserBackend.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/library/Icinga/Authentication/UserBackend.php b/library/Icinga/Authentication/UserBackend.php index 70070aa2f..9dcf9c641 100644 --- a/library/Icinga/Authentication/UserBackend.php +++ b/library/Icinga/Authentication/UserBackend.php @@ -85,7 +85,14 @@ abstract class UserBackend implements Countable } return new $backendConfig->class($backendConfig); } - if ($name === 'autologin') { + if (($backendType = $backendConfig->backend) === null) { + throw new ConfigurationError( + 'Authentication configuration for backend "' . $name + . '" is missing the backend directive' + ); + } + $backendType = strtolower($backendType); + if ($backendType === 'autologin') { $backend = new AutoLoginBackend($backendConfig); $backend->setName($name); return $backend; @@ -96,12 +103,6 @@ abstract class UserBackend implements Countable . '" is missing the resource directive' ); } - if (($backendType = $backendConfig->backend) === null) { - throw new ConfigurationError( - 'Authentication configuration for backend "' . $name - . '" is missing the backend directive' - ); - } try { $resourceConfig = ResourceFactory::getResourceConfig($backendConfig->resource); } catch (ProgrammingError $e) { @@ -110,7 +111,7 @@ abstract class UserBackend implements Countable ); } $resource = ResourceFactory::createResource($resourceConfig); - switch (strtolower($backendType)) { + switch ($backendType) { case 'db': $backend = new DbUserBackend($resource); break;