Skip to content

Commit 8adaa2b

Browse files
committed
More updates
1 parent d8b9233 commit 8adaa2b

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

security/access_control.rst

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -140,39 +140,46 @@ if ``ip``, ``port``, ``host`` or ``method`` are not specified for an entry, that
140140
``access_control`` will match any ``ip``, ``port``, ``host`` or ``method``.
141141
See the following examples:
142142

143-
**URI** ``/admin/user``
144-
IP: ``127.0.0.1``, Port: ``80``, Host: ``example.com``, Method: ``GET``
145-
**Rule applied**: rule #2 (``ROLE_USER_IP``)
146-
**Why?** The URI matches ``path`` and the IP matches ``ip``.
147-
**URI** ``/admin/user``
148-
IP: ``127.0.0.1``, Port: ``80``, Host: ``symfony.com``, Method: ``GET``
149-
**Rule applied**: rule #2 (``ROLE_USER_IP``)
150-
**Why?** The ``path`` and ``ip`` still match. This would also match the
143+
Example #1:
144+
* **URI** ``/admin/user``
145+
* **IP**: ``127.0.0.1``, **Port**: ``80``, **Host**: ``example.com``, **Method**: ``GET``
146+
* **Rule applied**: rule #2 (``ROLE_USER_IP``)
147+
* **Why?** The URI matches ``path`` and the IP matches ``ip``.
148+
Example #2:
149+
* **URI** ``/admin/user``
150+
* **IP**: ``127.0.0.1``, **Port**: ``80``, **Host**: ``symfony.com``, **Method**: ``GET``
151+
* **Rule applied**: rule #2 (``ROLE_USER_IP``)
152+
* **Why?** The ``path`` and ``ip`` still match. This would also match the
151153
``ROLE_USER_HOST`` entry, but *only* the **first** ``access_control`` match is used.
152-
**URI** ``/admin/user``
153-
IP: ``127.0.0.1``, Port: ``8080``, Host: ``symfony.com``, Method: ``GET``
154-
**Rule applied**: rule #1 (``ROLE_USER_PORT``)
155-
**Why?** The ``path``, ``ip`` and ``port`` match.
156-
**URI** ``/admin/user``
157-
IP: ``168.0.0.1``, Port: ``80``, Host: ``symfony.com``, Method: ``GET``
158-
**Rule applied**: rule #3 (``ROLE_USER_HOST``)
159-
**Why?** The ``ip`` doesn't match neither the first rule nor the second rule.
160-
So the third rule (which matches) is used.
161-
**URI** ``/admin/user``
162-
IP: ``168.0.0.1``, Port: ``80``, Host: ``symfony.com``, Method: ``POST``
163-
**Rule applied**: rule #3 (``ROLE_USER_HOST``)
164-
**Why?** The third rule still matches. This would also match the fourth rule
165-
(``ROLE_USER_METHOD``), but only the **first** matched ``access_control`` is used.
166-
**URI** ``/admin/user``
167-
IP: ``168.0.0.1``, Port: ``80``, Host: ``example.com``, Method: ``POST``
168-
**Rule applied**: rule #4 (``ROLE_USER_METHOD``)
169-
**Why?** The ``ip`` and ``host`` don't match the first three entries, but
170-
the fourth - ``ROLE_USER_METHOD`` - matches and is used.
171-
**URI** ``/foo``
172-
IP: ``127.0.0.1``, Port: ``80``, Host: ``symfony.com``, Method: ``POST``
173-
**Rule applied**: matches no entries
174-
**Why?** This doesn't match any ``access_control`` rules, since its URI
175-
doesn't match any of the ``path`` values.
154+
Example #3:
155+
* **URI** ``/admin/user``
156+
* **IP**: ``127.0.0.1``, **Port**: ``8080``, **Host**: ``symfony.com``, **Method**: ``GET``
157+
* **Rule applied**: rule #1 (``ROLE_USER_PORT``)
158+
* **Why?** The ``path``, ``ip`` and ``port`` match.
159+
Example #4:
160+
* **URI** ``/admin/user``
161+
* **IP**: ``168.0.0.1``, **Port**: ``80``, **Host**: ``symfony.com``, **Method**: ``GET``
162+
* **Rule applied**: rule #3 (``ROLE_USER_HOST``)
163+
* **Why?** The ``ip`` doesn't match neither the first rule nor the second rule.
164+
* So the third rule (which matches) is used.
165+
Example #5:
166+
* **URI** ``/admin/user``
167+
* **IP**: ``168.0.0.1``, **Port**: ``80``, **Host**: ``symfony.com``, **Method**: ``POST``
168+
* **Rule applied**: rule #3 (``ROLE_USER_HOST``)
169+
* **Why?** The third rule still matches. This would also match the fourth rule
170+
* (``ROLE_USER_METHOD``), but only the **first** matched ``access_control`` is used.
171+
Example #6:
172+
* **URI** ``/admin/user``
173+
* **IP**: ``168.0.0.1``, **Port**: ``80``, **Host**: ``example.com``, **Method**: ``POST``
174+
* **Rule applied**: rule #4 (``ROLE_USER_METHOD``)
175+
* **Why?** The ``ip`` and ``host`` don't match the first three entries, but
176+
* the fourth - ``ROLE_USER_METHOD`` - matches and is used.
177+
Example #7:
178+
* **URI** ``/foo``
179+
* **IP**: ``127.0.0.1``, **Port**: ``80``, **Host**: ``symfony.com``, **Method**: ``POST``
180+
* **Rule applied**: matches no entries
181+
* **Why?** This doesn't match any ``access_control`` rules, since its URI
182+
* doesn't match any of the ``path`` values.
176183

177184
.. caution::
178185

0 commit comments

Comments
 (0)