Commit c3342c67 authored by Fabien Potencier's avatar Fabien Potencier

added an exception when the authentication type is not registered

parent 9ab6ee63
......@@ -163,11 +163,13 @@ class SecurityServiceProvider implements ServiceProviderInterface
$options = array();
}
if (isset($app['security.authentication.factory.'.$type])) {
list($listener, $entryPoint) = $app['security.authentication.factory.'.$type]($name, $options);
$listeners[] = $listener;
if (!isset($app['security.authentication.factory.'.$type])) {
throw new \LogicException(sprintf('The "%s" authentication entry is not registered.', $type));
}
list($listener, $entryPoint) = $app['security.authentication.factory.'.$type]($name, $options);
$listeners[] = $listener;
}
$listeners[] = $app['security.access_listener'];
......
......@@ -32,6 +32,24 @@ class SecurityServiceProviderTest extends WebTestCase
}
}
/**
* @expectedException \LogicException
*/
public function testWrongAuthenticationType()
{
$app = new Application();
$app->register(new SecurityServiceProvider(), array(
'security.firewalls' => array(
'wrong' => array(
'foobar' => true,
'users' => array(),
),
),
));
$app->get('/', function () {});
$app->handle(Request::create('/'));
}
public function testFormAuthentication()
{
$app = $this->createApplication('form');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment