Commit f55a6739 authored by Fabien Potencier's avatar Fabien Potencier

feature #910 Allow to override the access denied handler (DerManoMann)

This PR was squashed before being merged into the 2.0.x-dev branch (closes #910).

Discussion
----------

Allow to override the access denied handler

Allow to override the access denied handler

Commits
-------

8a2f79e6 Allow to override the access denied handler
parents df4e09e6 8a2f79e6
......@@ -242,7 +242,11 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
if (null == $entryPoint) {
$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);
}
}
......@@ -353,8 +357,8 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
};
});
$app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name) use ($app) {
return function () use ($app, $entryPoint, $name) {
$app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name, $accessDeniedHandler = null) use ($app) {
return function () use ($app, $entryPoint, $name, $accessDeniedHandler) {
return new ExceptionListener(
$app['security'],
$app['security.trust_resolver'],
......@@ -362,7 +366,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
$name,
$app[$entryPoint],
null, // errorPage
null, // AccessDeniedHandlerInterface
$accessDeniedHandler,
$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