Skip to content

Commit

Permalink
After backporting something from master (2.5), removing the 2.5-speci…
Browse files Browse the repository at this point in the history
…fic features
  • Loading branch information
weaverryan committed Mar 19, 2014
1 parent 9889dbe commit be46c76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 62 deletions.
4 changes: 2 additions & 2 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ can access ``/foo`` without being prompted to authenticate.

.. tip::

You can also match a request against other details of the request (e.g. host, method). For more
information and examples read :doc:`/cookbook/security/firewall_restriction`.
You can also match a request against other details of the request (e.g. host).
For more information and examples read :doc:`/cookbook/security/firewall_restriction`.

.. image:: /images/book/security_anonymous_user_access.png
:align: center
Expand Down
60 changes: 0 additions & 60 deletions cookbook/security/firewall_restriction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,63 +131,3 @@ the ``^`` and ``$`` regex characters) to the hostname ``admin.example.com``.
If the hostname does not match this pattern, the firewall will not be activated
and subsequent firewalls will have the opportunity to be matched for this
request.

Restricting by HTTP Methods
---------------------------

.. versionadded:: 2.5
Support for restricting security firewalls to specific HTTP methods was introduced in
Symfony 2.5.

The configuration option ``methods`` restricts the initialization of the firewall to
the provided HTTP methods.

.. configuration-block::

.. code-block:: yaml
# app/config/security.yml
# ...
security:
firewalls:
secured_area:
methods: [GET, POST]
# ...
.. code-block:: xml
<!-- app/config/security.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<config>
<!-- ... -->
<firewall name="secured_area" methods="GET,POST">
<!-- ... -->
</firewall>
</config>
</srv:container>
.. code-block:: php
// app/config/security.php
// ...
$container->loadFromExtension('security', array(
'firewalls' => array(
'secured_area' => array(
'methods' => array('GET', 'POST'),
// ...
),
),
));
In this example, the firewall will only be activated if the HTTP method of the
request is either ``GET`` or ``POST``. If the method is not in the array of the
allowed methods, the firewall will not be activated and subsequent firewalls will again
have the opportunity to be matched for this request.

0 comments on commit be46c76

Please sign in to comment.