Commit f4863ded authored by Fabien Potencier's avatar Fabien Potencier

minor #1208 updated the docs to show how to restrict a firewall by more than just the URL (fabpot)

This PR was merged into the 1.3 branch.

Discussion
----------

updated the docs to show how to restrict a firewall by more than just the URL

closes #1171 and #1044

Commits
-------

721043c2 updated the docs to show how to restrict a firewall by more than just the URL
parents b3bb4fc0 721043c2
......@@ -136,10 +136,24 @@ under ``/admin/``::
),
);
The ``pattern`` is a regular expression (it can also be a `RequestMatcher
The ``pattern`` is a regular expression on the URL path; the ``http`` setting
tells the security layer to use HTTP basic authentication and the ``users``
entry defines valid users.
If you want to restrict the firewall by more than the URL pattern (like the
HTTP method, the client IP, the hostname, or any Request attributes), use an
instance of a `RequestMatcher
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/RequestMatcher.html>`_
instance); the ``http`` setting tells the security layer to use HTTP basic
authentication and the ``users`` entry defines valid users.
for the ``pattern`` option::
use Symfony/Component/HttpFoundation/RequestMatcher;
$app['security.firewalls'] = array(
'admin' => array(
'pattern' => new RequestMatcher('^/admin', 'example.com', 'POST'),
// ...
),
);
Each user is defined with the following information:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment