Skip to content

Commit

Permalink
bug #4304 [DX] Suggest a hint to any auth-check (larsborn)
Browse files Browse the repository at this point in the history
This PR was submitted for the 2.5 branch but it was merged into the 2.3 branch instead (closes #4304).

Discussion
----------

[DX] Suggest a hint to any auth-check

Suggest a hint that you need a minimum of auth-check to let the voters vote.

Commits
-------

ccdda87 Suggest a hint to any auth-check
  • Loading branch information
weaverryan committed Mar 15, 2015
2 parents a801d57 + ccdda87 commit 206e613
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cookbook/security/voters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,36 @@ application configuration file with the following code.
That's it! Now, when deciding whether or not a user should have access,
the new voter will deny access to any user in the list of blacklisted IPs.

Note that the voters are only called, if any access is actually checked. So
you need at least something like

.. configuration-block::

.. code-block:: yaml
# app/config/security.yml
security:
access_control:
- { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }
.. code-block:: xml
<!-- app/config/security.xml -->
<config>
<access-control>
<rule path="^/" role="IS_AUTHENTICATED_ANONYMOUSLY" />
</access-control>
</config>
.. code-block:: php
// app/config/security.xml
$container->loadFromExtension('security', array(
'access_control' => array(
array('path' => '^/', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY'),
),
));
.. seealso::

For a more advanced usage see
Expand Down

0 comments on commit 206e613

Please sign in to comment.