Skip to content

Added a mention to the @Security annotation #4957

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
Closed
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions cookbook/security/remember_me.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,25 @@ In the following example, the action is only allowed if the user has the
The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior
to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service.

You can also choose to install and use the optional JMSSecurityExtraBundle_,
which can secure your controller using annotations:
If your application is based on the Symfony Standard Edition, you can also secure
your controller using annotations:

.. code-block:: php

use JMS\SecurityExtraBundle\Annotation\Secure;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;

/**
* @Secure(roles="IS_AUTHENTICATED_FULLY")
* @Security("has_role('IS_AUTHENTICATED_FULLY')")
*/
public function editAction($name)
{
// ...
}

.. versionadded:: 2.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as 2.4 was deprecated when 2.6 was released, we do not show any 2.4 versionadded in the 2.6 docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting this error. I've removed this versionadded directive.

The ``@Security`` annotation was introduced in SensioFrameworkExtraBundle 3.0,
which can only be used with Symfony 2.4 or later.

.. tip::

If you also had an access control in your security configuration that
Expand All @@ -212,5 +216,3 @@ which can secure your controller using annotations:

For more information on securing services or methods in this way,
see :doc:`/cookbook/security/securing_services`.

.. _JMSSecurityExtraBundle: https://github.com/schmittjoh/JMSSecurityExtraBundle