Commit c3342c67 authored by Fabien Potencier's avatar Fabien Potencier

added an exception when the authentication type is not registered

parent 9ab6ee63
...@@ -163,12 +163,14 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -163,12 +163,14 @@ class SecurityServiceProvider implements ServiceProviderInterface
$options = array(); $options = array();
} }
if (isset($app['security.authentication.factory.'.$type])) { 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); list($listener, $entryPoint) = $app['security.authentication.factory.'.$type]($name, $options);
$listeners[] = $listener; $listeners[] = $listener;
} }
}
$listeners[] = $app['security.access_listener']; $listeners[] = $app['security.access_listener'];
......
...@@ -32,6 +32,24 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -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() public function testFormAuthentication()
{ {
$app = $this->createApplication('form'); $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