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'.
This commit is contained in:
Eric Lippmann 2014-06-12 17:05:54 +02:00
parent 74fe4199fa
commit db73d324de
1 changed files with 9 additions and 8 deletions

View File

@ -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;