Commit 23dc19c3 authored by Fabien Potencier's avatar Fabien Potencier

fixed options for security entry points (closes #409)

parent e568ea7c
...@@ -127,7 +127,7 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -127,7 +127,7 @@ class SecurityServiceProvider implements ServiceProviderInterface
$app['security.authentication_listener.factory.'.$type] = $app->protect(function($name, $options) use ($type, $app, $entryPoint) { $app['security.authentication_listener.factory.'.$type] = $app->protect(function($name, $options) use ($type, $app, $entryPoint) {
if ($entryPoint && !isset($app['security.entry_point.'.$name.'.'.$entryPoint])) { if ($entryPoint && !isset($app['security.entry_point.'.$name.'.'.$entryPoint])) {
$app['security.entry_point.'.$name.'.'.$entryPoint] = $app['security.entry_point.'.$entryPoint.'._proto']($name); $app['security.entry_point.'.$name.'.'.$entryPoint] = $app['security.entry_point.'.$entryPoint.'._proto']($name, $options);
} }
if (!isset($app['security.authentication_listener.'.$name.'.'.$type])) { if (!isset($app['security.authentication_listener.'.$name.'.'.$type])) {
...@@ -416,15 +416,18 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -416,15 +416,18 @@ class SecurityServiceProvider implements ServiceProviderInterface
}); });
}); });
$app['security.entry_point.form._proto'] = $app->protect(function ($name, $loginPath = '/login', $useForward = false) use ($app) { $app['security.entry_point.form._proto'] = $app->protect(function ($name, array $options) use ($app) {
return $app->share(function () use ($app, $loginPath, $useForward) { return $app->share(function () use ($app, $options) {
$loginPath = isset($options['login_path']) ? $options['login_path'] : '/login';
$useForward = isset($options['use_forward']) ? $options['use_forward'] : false;
return new FormAuthenticationEntryPoint($app, $app['security.http_utils'], $loginPath, $useForward); return new FormAuthenticationEntryPoint($app, $app['security.http_utils'], $loginPath, $useForward);
}); });
}); });
$app['security.entry_point.http._proto'] = $app->protect(function ($name, $realName = 'Secured') use ($app) { $app['security.entry_point.http._proto'] = $app->protect(function ($name, array $options) use ($app) {
return $app->share(function () use ($app, $name, $realName) { return $app->share(function () use ($app, $name, $options) {
return new BasicAuthenticationEntryPoint($realName); return new BasicAuthenticationEntryPoint(isset($options['real_name']) ? $options['real_name'] : 'Secured');
}); });
}); });
......
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