Skip to content

Update access_control.rst #9344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions security/access_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ access control should be used on this request. The following ``access_control``
options are used for matching:

* ``path``
* ``ip`` or ``ips``
* ``ip`` or ``ips`` (netmask is supported)
* ``host``
* ``methods``

Expand Down Expand Up @@ -176,7 +176,7 @@ pattern so that it is only accessible by requests from the local server itself:
# ...
access_control:
#
- { path: ^/internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] }
- { path: ^/internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1, 192.168.0.1/24] }
- { path: ^/internal, roles: ROLE_NO_ACCESS }

.. code-block:: xml
Expand All @@ -193,7 +193,7 @@ pattern so that it is only accessible by requests from the local server itself:
<!-- ... -->
<rule path="^/internal"
role="IS_AUTHENTICATED_ANONYMOUSLY"
ips="127.0.0.1, ::1"
ips="127.0.0.1, ::1, 192.168.0.1/24"
/>

<rule path="^/internal" role="ROLE_NO_ACCESS" />
Expand All @@ -209,7 +209,7 @@ pattern so that it is only accessible by requests from the local server itself:
array(
'path' => '^/internal',
'role' => 'IS_AUTHENTICATED_ANONYMOUSLY',
'ips' => '127.0.0.1, ::1',
'ips' => '127.0.0.1, ::1, 192.168.0.1/24',
),
array(
'path' => '^/internal',
Expand Down Expand Up @@ -239,6 +239,8 @@ address):

* The second access rule is not examined as the first rule matched.

IP netmask is supported. You can write ``ip`` or ``ips`` with ``192.168.0.1/24`` or ``192.168.0.1/32``.

.. _security-allow-if:

Securing by an Expression
Expand Down