File tree Expand file tree Collapse file tree 1 file changed +30
-5
lines changed Expand file tree Collapse file tree 1 file changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,36 @@ generally return a custom response).
6767
6868 Then, register the service for the access denied handler:
6969
70- .. code-block :: yaml
70+ .. configuration-block ::
71+
72+ .. code-block :: yaml
73+
74+ # app/config/services.yml
75+ services :
76+ app.security.access_denied_handler :
77+ class : AppBundle\Security\AccessDeniedHandler
78+
79+ .. code-block :: xml
80+
81+ <!-- app/config/services.xml -->
82+ <?xml version="1.0" encoding="UTF-8" ?>
83+ <container xmlns="http://symfony.com/schema/dic/services"
84+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
85+ xsi:schemaLocation="http://symfony.com/schema/dic/services
86+ http://symfony.com/schema/dic/services/services-1.0.xsd">
87+
88+ <services>
89+ <service id="app.security.access_denied_handler"
90+ class="AppBundle\S ecurity\A ccessDeniedHandler" />
91+ </services>
92+ </container>
93+
94+ .. code-block :: php
7195
72- # app/config/services.yml
73- services :
74- app.security.access_denied_handler :
75- class : AppBundle\Security\AccessDeniedHandler
96+ // app/config/services.php
97+ $container->register(
98+ 'app.security.access_denied_handler',
99+ 'AppBundle\S ecurity\A ccessDeniedHandler'
100+ );
76101
77102That's it! Any ``AccessDeniedException `` thrown by the ``foo `` firewall will now be handled by your service.
You can’t perform that action at this time.
0 commit comments