Commit 8a2f79e6 authored by DerManoMann's avatar DerManoMann Committed by Fabien Potencier

Allow to override the access denied handler

parent 235c4950
...@@ -233,7 +233,11 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -233,7 +233,11 @@ class SecurityServiceProvider implements ServiceProviderInterface
if (null == $entryPoint) { if (null == $entryPoint) {
$app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, array()); $app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, array());
} }
$app['security.exception_listener.'.$name] = $app['security.exception_listener._proto']($entryPoint, $name); $accessDeniedHandler = null;
if (isset($app['security.access_denied_handler.'.$name])) {
$accessDeniedHandler = $app['security.access_denied_handler.'.$name];
}
$app['security.exception_listener.'.$name] = $app['security.exception_listener._proto']($entryPoint, $name, $accessDeniedHandler);
} }
} }
...@@ -344,8 +348,8 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -344,8 +348,8 @@ class SecurityServiceProvider implements ServiceProviderInterface
}); });
}); });
$app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name) use ($app) { $app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name, $accessDeniedHandler = null) use ($app) {
return $app->share(function () use ($app, $entryPoint, $name) { return $app->share(function () use ($app, $entryPoint, $name, $accessDeniedHandler) {
return new ExceptionListener( return new ExceptionListener(
$app['security'], $app['security'],
$app['security.trust_resolver'], $app['security.trust_resolver'],
...@@ -353,7 +357,7 @@ class SecurityServiceProvider implements ServiceProviderInterface ...@@ -353,7 +357,7 @@ class SecurityServiceProvider implements ServiceProviderInterface
$name, $name,
$app[$entryPoint], $app[$entryPoint],
null, // errorPage null, // errorPage
null, // AccessDeniedHandlerInterface $accessDeniedHandler,
$app['logger'] $app['logger']
); );
}); });
......
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