Commit 9ac0fd70 authored by Mihail Ivanov(x0r)'s avatar Mihail Ivanov(x0r) Committed by Fabien Potencier

Allowing the use of both objects and arrays for the register()

parent 19de0cd2
......@@ -22,7 +22,7 @@ Changelog
1.3.1 (2015-XX-XX)
------------------
* n/a
* fixed session logout handler when a firewall is stateless
1.3.0 (2015-06-05)
------------------
......
......@@ -293,7 +293,7 @@ pattern::
'secured' => array(
'pattern' => '^/admin/',
'form' => array('login_path' => '/login', 'check_path' => '/admin/login_check'),
'logout' => array('logout_path' => '/admin/logout'),
'logout' => array('logout_path' => '/admin/logout', 'invalidate_session' => true),
// ...
),
......
......@@ -121,11 +121,11 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
* Registers a service provider.
*
* @param ServiceProviderInterface $provider A ServiceProviderInterface instance
* @param array $values An array of values that customizes the provider
* @param array|Traversable $values An array or a Traversable of values that customizes the provider
*
* @return Application
*/
public function register(ServiceProviderInterface $provider, array $values = array())
public function register(ServiceProviderInterface $provider, $values = array())
{
$this->providers[] = $provider;
......
......@@ -233,6 +233,8 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
throw new \LogicException(sprintf('The "%s" authentication entry is not registered.', $type));
}
$options['stateless'] = $stateless;
list($providerId, $listenerId, $entryPointId, $position) = $app['security.authentication_listener.factory.'.$type]($name, $options);
if (null !== $entryPointId) {
......@@ -504,7 +506,10 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
isset($options['with_csrf']) && $options['with_csrf'] && isset($app['form.csrf_provider']) ? $app['form.csrf_provider'] : null
);
$listener->addHandler(new SessionLogoutHandler());
$invalidateSession = isset($options['invalidate_session']) ? $options['invalidate_session'] : true;
if (true === $invalidateSession && false === $options['stateless']) {
$listener->addHandler(new SessionLogoutHandler());
}
return $listener;
};
......
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