8000 xabbuh review · symfony/symfony-docs@a9f815a · GitHub
[go: up one dir, main page]

Skip to content

Commit a9f815a

Browse files
nykopolxabbuh
authored andcommitted
xabbuh review
1 parent 66c0e76 commit a9f815a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

security/access_denied_handler.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
How to Create a Custom Access Denied Handler
55
============================================
66

7-
When your application throw an ``AccessDeniedException`` you can catch this exception
7+
When your application throws an ``AccessDeniedException``, you can catch this exception
88
with a service to return a custom Response.
99

1010
On each firewall context you can define a custom access denied handler.
@@ -19,6 +19,14 @@ On each firewall context you can define a custom access denied handler.
1919
# ...
2020
access_denied_handler: custom_handler.service.id
2121
22+
.. code-block:: xml
23+
24+
<config>
25+
<firewall name="foo">
26+
<access_denied_handler>custom_handler.service.id</access_denied_handler>
27+
</firewall>
28+
</config>
29+
2230
.. code-block:: php
2331
2432
// app/config/security.php
@@ -32,20 +40,20 @@ On each firewall context you can define a custom access denied handler.
3240
));
3341
3442
35-
Your handler must implement the interface
43+
Your handler must implement the
3644
:class:`Symfony\\Component\\Security\\Http\\Authorization\\AccessDeniedHandlerInterface`.
37-
This interface define one method called ``handle()`` that can do whatever you want.
38-
You can use it to send a mail, log a message, or generally return a custom Response.
39-
45+
This interface defines one method called ``handle()`` that implements the logic you want
46+
to execute when access is denied to the current user (send a mail, log a message, or
47+
generally return a custom Response).
4048

4149
.. code-block:: php
4250
4351
namespace AppBundle\Security;
4452
45-
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
4653
use Symfony\Component\HttpFoundation\Request;
4754
use Symfony\Component\HttpFoundation\Response;
4855
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
56+
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
4957
5058
class AccessDeniedHandler implements AccessDeniedHandlerInterface
5159
{

0 commit comments

Comments
 (0)
0