File tree 1 file changed +30
-5
lines changed 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).
67
67
68
68
Then, register the service for the access denied handler:
69
69
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://symf
A211
ony.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
71
95
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
+ );
76
101
77
102
That'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