Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
Facelifted book/security#2783
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
ad8267b
239a6e9
b377ecf
42cbad2
c58d1be
a79617b
b3cc1ed
75fdf55
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -25,8 +25,8 @@ application with HTTP Basic authentication. | ||
.. note:: | ||
:doc:`Symfony's security component </components/security/introduction>` is | ||
available as a standalone PHP libraryfor use inside any PHP project. | ||
Basic Example: HTTP Authentication | ||
---------------------------------- | ||
@@ -415,7 +415,7 @@ submission (i.e. ``/login_check``): | ||
``check_path`` ``logout`` keys. These keys can be route names (as shown | ||
in this example) or URLs that have routes configured for them. | ||
Notice that the name of the ``login`` route matches the``login_path`` config | ||
value, as that's where the security system will redirect users that need | ||
to login. | ||
@@ -674,14 +674,11 @@ see :doc:`/cookbook/security/form_login`. | ||
Authorization | ||
------------- | ||
The first step in security is always authentication. Once the user has been | ||
authenticated, authorization begins. Authorization provides a standard and | ||
powerful way to decide if a user can access any resource (a URL, a model | ||
object, a method call, ...). This works by assigning specific roles to each | ||
user, and then requiring different roles for different resources. | ||
The process of authorization has two different sides: | ||
@@ -700,12 +697,6 @@ URL pattern. You've seen this already in the first example of this chapter, | ||
where anything matching the regular expression pattern ``^/admin`` requires | ||
the ``ROLE_ADMIN`` role. | ||
You can define as many URL patterns as you need - each is a regular expression. | ||
.. configuration-block:: | ||
@@ -757,12 +748,15 @@ to find *one* that matches the current request. As soon as it finds a matching | ||
is used to enforce access. | ||
Each ``access_control`` has several options that configure two different | ||
things: | ||
* :ref:`should the incoming request match this access control entry<security-book-access-control-matching-options>` | ||
* :ref:`once it matches, should some sort of access restriction be enforced<security-book-access-control-enforcement-options>`: | ||
.. _security-book-access-control-matching-options: | ||
Matching Options | ||
................ | ||
Symfony2 creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher` | ||
for each ``access_control`` entry, which determines whether or not a given | ||
@@ -842,7 +836,8 @@ will match any ``ip``, ``host`` or ``method``: | ||
.. _security-book-access-control-enforcement-options: | ||
Access Enforcement | ||
.................. | ||
Once Symfony2 has decided which ``access_control`` entry matches (if any), | ||
it then *enforces* access restrictions based on the ``roles`` and ``requires_channel`` | ||
@@ -1185,7 +1180,9 @@ class: | ||
security: | ||
providers: | ||
main: | ||
entity: | ||
class: Acme\UserBundle\Entity\User | ||
property: username | ||
.. code-block:: xml | ||
@@ -1202,7 +1199,10 @@ class: | ||
$container->loadFromExtension('security', array( | ||
'providers' => array( | ||
'main' => array( | ||
'entity' => array( | ||
'class' => 'Acme\UserBundle\Entity\User', | ||
'property' => 'username', | ||
), | ||
), | ||
), | ||
)); | ||
@@ -1705,11 +1705,6 @@ Note that you will *not* need to implement a controller for the ``/logout`` | ||
URL as the firewall takes care of everything. You *do*, however, need to create | ||
a route so that you can use it to generate the URL: | ||
.. configuration-block:: | ||
.. code-block:: yaml | ||
@@ -1742,6 +1737,11 @@ a route so that you can use it to generate the URL: | ||
return $collection; | ||
.. caution:: | ||
As of Symfony 2.1, you *must* have a route that corresponds to your logout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. shouldn't we remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Only from bramches which are released after the deprecation. In this case, it's 2.3 | ||
path. Without this route, logging out will not work. | ||
Once the user has been logged out, he will be redirected to whatever path | ||
is defined by the ``target`` parameter above (e.g. the ``homepage``). For | ||
more information on configuring the logout, see the | ||
@@ -1861,7 +1861,7 @@ to show a link to exit impersonation: | ||
.. code-block:: html+jinja | ||
{% if is_granted('ROLE_PREVIOUS_ADMIN') %} | ||
<a href="{{ path('homepage', {'_switch_user': '_exit'}) }}">Exit impersonation</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. this change is not needed (unless you use an old Txig version) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It is, it's invalid jinja and thus it isn't highlighted on the website | ||
{% endif %} | ||
.. code-block:: html+php | ||
@@ -2040,7 +2040,6 @@ Learn more from the Cookbook | ||
* :doc:`Access Control Lists (ACLs) </cookbook/security/acl>` | ||
* :doc:`/cookbook/security/remember_me` | ||
.. _`JMSSecurityExtraBundle`: http://jmsyst.com/bundles/JMSSecurityExtraBundle/1.2 | ||
.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle | ||
.. _`implement the \Serializable interface`: http://php.net/manual/en/class.serializable.php | ||