@@ -131,63 +131,3 @@ the ``^`` and ``$`` regex characters) to the hostname ``admin.example.com``.
131
131
If the hostname does not match this pattern, the firewall will not be activated
132
132
and subsequent firewalls will have the opportunity to be matched for this
133
133
request.
134
-
135
- Restricting by HTTP Methods
136
- ---------------------------
137
-
138
- .. versionadded :: 2.5
139
- Support for restricting security firewalls to specific HTTP methods was introduced in
140
- Symfony 2.5.
141
-
142
- The configuration option ``methods `` restricts the initialization of the firewall to
143
- the provided HTTP methods.
144
-
145
- .. configuration-block ::
146
-
147
- .. code-block :: yaml
148
-
149
- # app/config/security.yml
150
-
151
- # ...
152
- security :
153
- firewalls :
154
- secured_area :
155
- methods : [GET, POST]
156
- # ...
157
-
158
- .. code-block :: xml
159
-
160
- <!-- app/config/security.xml -->
161
- <?xml version =" 1.0" encoding =" UTF-8" ?>
162
- <srv : container xmlns =" http://symfony.com/schema/dic/security"
163
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
164
- xmlns : srv =" http://symfony.com/schema/dic/services"
165
- xsi : schemaLocation =" http://symfony.com/schema/dic/services
166
- http://symfony.com/schema/dic/services/services-1.0.xsd" >
167
-
168
- <config >
169
- <!-- ... -->
170
- <firewall name =" secured_area" methods =" GET,POST" >
171
- <!-- ... -->
172
- </firewall >
173
- </config >
174
- </srv : container >
175
-
176
- .. code-block :: php
177
-
178
- // app/config/security.php
179
-
180
- // ...
181
- $container->loadFromExtension('security', array(
182
- 'firewalls' => array(
183
- 'secured_area' => array(
184
- 'methods' => array('GET', 'POST'),
185
- // ...
186
- ),
187
- ),
188
- ));
189
-
190
- In this example, the firewall will only be activated if the HTTP method of the
191
- request is either ``GET `` or ``POST ``. If the method is not in the array of the
192
- allowed methods, the firewall will not be activated and subsequent firewalls will again
193
- have the opportunity to be matched for this request.
0 commit comments