Skip to content

Commit c45e135

Browse files
committed
Merge branch '4.4'
* 4.4: Revert "minor #12371 [Security] Deprecated using more than one role in access_control rules (javiereguiluz)" include xml and php examples Update security.rst Update mercure.rst
2 parents f90dfb7 + 462f36a commit c45e135

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

mercure.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Set it to the URL of the Mercure Hub (``http://localhost:3000/.well-known/mercur
9999
In addition, the Symfony application must bear a `JSON Web Token`_ (JWT)
100100
to the Mercure Hub to be authorized to publish updates.
101101

102-
This JWT should be stored in the ``MERCURE_JWT_SECRET`` environment variable.
102+
This JWT should be stored in the ``MERCURE_JWT_TOKEN`` environment variable.
103103

104104
The JWT must be signed with the same secret key as the one used by
105105
the Hub to verify the JWT (``aVerySecretKey`` in our example).
@@ -126,7 +126,7 @@ public updates (see the authorization_ section for further information).
126126

127127
.. caution::
128128

129-
Don't put the secret key in ``MERCURE_JWT_SECRET``, it will not work!
129+
Don't put the secret key in ``MERCURE_JWT_TOKEN``, it will not work!
130130
This environment variable must contain a JWT, signed with the secret key.
131131

132132
Also, be sure to keep both the secret key and the JWTs... secrets!

security.rst

+12
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ start with ``/admin``, you can:
438438
# require ROLE_ADMIN for /admin*
439439
- { path: '^/admin', roles: ROLE_ADMIN }
440440
441+
# or require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin*
442+
- { path: '^/admin', roles: [IS_AUTHENTICATED_FULLY, ROLE_ADMIN] }
443+
441444
# the 'path' value can be any valid regular expression
442445
# (this one will match URLs like /api/post/7298 and /api/comment/528491)
443446
- { path: ^/api/(post|comment)/\d+$, roles: ROLE_USER }
@@ -462,6 +465,12 @@ start with ``/admin``, you can:
462465
<!-- require ROLE_ADMIN for /admin* -->
463466
<rule path="^/admin" role="ROLE_ADMIN"/>
464467
468+
<!-- require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin* -->
469+
<rule path="^/admin">
470+
<role>ROLE_ADMIN</role>
471+
<role>IS_AUTHENTICATED_FULLY</role>
472+
</rule>
473+
465474
<!-- the 'path' value can be any valid regular expression
466475
(this one will match URLs like /api/post/7298 and /api/comment/528491) -->
467476
<rule path="^/api/(post|comment)/\d+$" role="ROLE_USER"/>
@@ -484,6 +493,9 @@ start with ``/admin``, you can:
484493
// require ROLE_ADMIN for /admin*
485494
['path' => '^/admin', 'roles' => 'ROLE_ADMIN'],
486495
496+
// require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin*
497+
['path' => '^/admin', 'roles' => ['ROLE_ADMIN', 'IS_AUTHENTICATED_FULLY']],
498+
487499
// the 'path' value can be any valid regular expression
488500
// (this one will match URLs like /api/post/7298 and /api/comment/528491)
489501
['path' => '^/api/(post|comment)/\d+$', 'roles' => 'ROLE_USER'],

security/access_control.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ options:
142142

143143
* ``roles`` If the user does not have the given role, then access is denied
144144
(internally, an :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException`
145-
is thrown).
145+
is thrown). If this value is an array of multiple roles, the user must have
146+
at least one of them.
146147

147148
* ``allow_if`` If the expression returns false, then access is denied;
148149

0 commit comments

Comments
 (0)